From 1b6455421e656d8d518fb3feac185df710271a2f Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 29 Jan 2014 20:47:55 -0600 Subject: [PATCH] Particle Settings Grinder Fix. --- block/AEBaseBlock.java | 9 +++- block/misc/BlockCharger.java | 8 +++- block/misc/BlockQuartzTorch.java | 8 +++- block/qnb/BlockQuantumLinkChamber.java | 3 +- block/solids/BlockQuartzLamp.java | 14 ++++--- block/solids/OreQuartz.java | 7 ++++ block/solids/OreQuartzCharged.java | 8 +++- client/ClientHelper.java | 10 +++++ .../render/items/ToolBiometricCardRender.java | 3 -- core/CommonHelper.java | 3 ++ core/Configuration.java | 4 +- core/Registration.java | 2 + core/features/IAEFeature.java | 2 + .../registries/GrinderRecipeManager.java | 42 ++++++++++--------- items/AEBaseItem.java | 5 +++ items/materials/MaterialType.java | 8 ++-- items/tools/quartz/ToolQuartzAxe.java | 5 +++ items/tools/quartz/ToolQuartzHoe.java | 5 +++ items/tools/quartz/ToolQuartzPickaxe.java | 5 +++ items/tools/quartz/ToolQuartzSpade.java | 5 +++ items/tools/quartz/ToolQuartzSword.java | 5 +++ server/ServerHelper.java | 7 ++++ 22 files changed, 127 insertions(+), 41 deletions(-) diff --git a/block/AEBaseBlock.java b/block/AEBaseBlock.java index 511a38ef..1b7cd00e 100644 --- a/block/AEBaseBlock.java +++ b/block/AEBaseBlock.java @@ -94,7 +94,8 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature try { ResourceLocation resLoc = new ResourceLocation( Name ); - resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks", resLoc.getResourcePath(), ".png" } ) ); + resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks", + resLoc.getResourcePath(), ".png" } ) ); Resource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc ); if ( res != null ) @@ -687,4 +688,10 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature return AEBaseItemBlock.class; } + @Override + public void postInit() + { + // override! + } + } diff --git a/block/misc/BlockCharger.java b/block/misc/BlockCharger.java index a3617417..1f283ad9 100644 --- a/block/misc/BlockCharger.java +++ b/block/misc/BlockCharger.java @@ -18,6 +18,7 @@ import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderBlockCharger; import appeng.client.render.effects.LightningEffect; +import appeng.core.CommonHelper; import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.helpers.ICustomCollision; @@ -86,8 +87,11 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision for (int bolts = 0; bolts < 3; bolts++) { - LightningEffect fx = new LightningEffect( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + if ( CommonHelper.proxy.shouldAddParticles( r ) ) + { + LightningEffect fx = new LightningEffect( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D ); + Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + } } } diff --git a/block/misc/BlockQuartzTorch.java b/block/misc/BlockQuartzTorch.java index 99ef38bb..ef580002 100644 --- a/block/misc/BlockQuartzTorch.java +++ b/block/misc/BlockQuartzTorch.java @@ -19,6 +19,7 @@ import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderQuartzTorch; import appeng.client.render.effects.LightningEffect; +import appeng.core.CommonHelper; import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.helpers.ICustomCollision; @@ -119,9 +120,12 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I double zOff = -0.3 * up.offsetZ; for (int bolts = 0; bolts < 3; bolts++) { - LightningEffect fx = new LightningEffect( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D ); + if ( CommonHelper.proxy.shouldAddParticles( r ) ) + { + LightningEffect fx = new LightningEffect( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + } } } diff --git a/block/qnb/BlockQuantumLinkChamber.java b/block/qnb/BlockQuantumLinkChamber.java index 840025c3..b1b02912 100644 --- a/block/qnb/BlockQuantumLinkChamber.java +++ b/block/qnb/BlockQuantumLinkChamber.java @@ -40,7 +40,8 @@ public class BlockQuantumLinkChamber extends AEBaseBlock { if ( bridge.hasQES() ) { - CommonHelper.proxy.spawnEnergy( w, bx + 0.5, by + 0.5, bz + 0.5 ); + if ( CommonHelper.proxy.shouldAddParticles( r ) ) + CommonHelper.proxy.spawnEnergy( w, bx + 0.5, by + 0.5, bz + 0.5 ); } } } diff --git a/block/solids/BlockQuartzLamp.java b/block/solids/BlockQuartzLamp.java index 631a345c..6b321779 100644 --- a/block/solids/BlockQuartzLamp.java +++ b/block/solids/BlockQuartzLamp.java @@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; import appeng.client.render.effects.VibrantEffect; +import appeng.core.CommonHelper; import appeng.core.Configuration; import appeng.core.features.AEFeature; import cpw.mods.fml.relauncher.Side; @@ -29,13 +30,16 @@ public class BlockQuartzLamp extends BlockQuartzGlass if ( !Configuration.instance.enableEffects ) return; - double d0 = (double) (r.nextFloat() - 0.5F) * 0.96D; - double d1 = (double) (r.nextFloat() - 0.5F) * 0.96D; - double d2 = (double) (r.nextFloat() - 0.5F) * 0.96D; + if ( CommonHelper.proxy.shouldAddParticles( r ) ) + { + double d0 = (double) (r.nextFloat() - 0.5F) * 0.96D; + double d1 = (double) (r.nextFloat() - 0.5F) * 0.96D; + double d2 = (double) (r.nextFloat() - 0.5F) * 0.96D; - VibrantEffect fx = new VibrantEffect( w, 0.5 + x + d0, 0.5 + y + d1, 0.5 + z + d2, 0.0D, 0.0D, 0.0D ); + VibrantEffect fx = new VibrantEffect( w, 0.5 + x + d0, 0.5 + y + d1, 0.5 + z + d2, 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + } } } diff --git a/block/solids/OreQuartz.java b/block/solids/OreQuartz.java index 4167b7d6..af88271f 100644 --- a/block/solids/OreQuartz.java +++ b/block/solids/OreQuartz.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; import appeng.api.util.IOrientable; import appeng.api.util.IOrientableBlock; @@ -34,6 +35,12 @@ public class OreQuartz extends AEBaseBlock implements IOrientableBlock enhanceBrightness = false; } + @Override + public void postInit() + { + OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( this ) ); + } + @Override protected Class getRenderer() { diff --git a/block/solids/OreQuartzCharged.java b/block/solids/OreQuartzCharged.java index 1ccedf8d..5d87147a 100644 --- a/block/solids/OreQuartzCharged.java +++ b/block/solids/OreQuartzCharged.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import appeng.api.AEApi; import appeng.client.render.effects.ChargedOreEffect; +import appeng.core.CommonHelper; import appeng.core.Configuration; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -63,8 +64,11 @@ public class OreQuartzCharged extends OreQuartz break; } - ChargedOreEffect fx = new ChargedOreEffect( w, x + xOff, y + yOff, z + zOff, 0.0f, 0.0f, 0.0f ); - Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + if ( CommonHelper.proxy.shouldAddParticles( r ) ) + { + ChargedOreEffect fx = new ChargedOreEffect( w, x + xOff, y + yOff, z + zOff, 0.0f, 0.0f, 0.0f ); + Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); + } } } diff --git a/client/ClientHelper.java b/client/ClientHelper.java index 149e14e7..c02d23f7 100644 --- a/client/ClientHelper.java +++ b/client/ClientHelper.java @@ -2,6 +2,7 @@ package appeng.client; import java.util.ArrayList; import java.util.List; +import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; @@ -104,4 +105,13 @@ public class ClientHelper extends ServerHelper Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); } + + @Override + public boolean shouldAddParticles(Random r) + { + if ( Minecraft.getMinecraft().gameSettings.particleSetting == 0 ) + return true; + return r.nextInt( Minecraft.getMinecraft().gameSettings.particleSetting ) == 0; + } + } \ No newline at end of file diff --git a/client/render/items/ToolBiometricCardRender.java b/client/render/items/ToolBiometricCardRender.java index 0372d94e..073748db 100644 --- a/client/render/items/ToolBiometricCardRender.java +++ b/client/render/items/ToolBiometricCardRender.java @@ -37,9 +37,6 @@ public class ToolBiometricCardRender implements IItemRenderer float f5 = ((Icon) par2Icon).getMaxU(); float f6 = ((Icon) par2Icon).getMinV(); float f7 = ((Icon) par2Icon).getMaxV(); - float f8 = 1.0F; - float f9 = 0.0F; - float f10 = 0.0F; float f12 = 0.0625F; Tessellator tessellator = Tessellator.instance; diff --git a/core/CommonHelper.java b/core/CommonHelper.java index a4cccaa4..5a952ed5 100644 --- a/core/CommonHelper.java +++ b/core/CommonHelper.java @@ -1,6 +1,7 @@ package appeng.core; import java.util.List; +import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.packet.Packet; @@ -28,4 +29,6 @@ public abstract class CommonHelper public abstract void spawnEnergy(World w, double posX, double posY, double posZ); + public abstract boolean shouldAddParticles(Random r); + } diff --git a/core/Configuration.java b/core/Configuration.java index 5db67c88..79335ea5 100644 --- a/core/Configuration.java +++ b/core/Configuration.java @@ -63,9 +63,11 @@ public class Configuration extends net.minecraftforge.common.Configuration imple public String grinderOres[] = { // Vanilla Items - "Obsidian", "EnderPearl", "Coal", "Iron", "Gold", "Charcoal", + "Obsidian", "Ender", "Coal", "Iron", "Gold", "Charcoal", "NetherQuartz", // Common Mod Ores "Copper", "Tin", "Silver", "Lead", "Bronze", + // AE + "CertusQuartz", "Wheat", "Fluix", // Other Mod Ores "Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum" }; diff --git a/core/Registration.java b/core/Registration.java index 4ed925cc..77150dc1 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -348,6 +348,8 @@ public class Registration feature.feature().register(); + feature.postInit(); + return feature.feature(); } else if ( obj == null ) diff --git a/core/features/IAEFeature.java b/core/features/IAEFeature.java index ea6b703b..aee4671d 100644 --- a/core/features/IAEFeature.java +++ b/core/features/IAEFeature.java @@ -5,4 +5,6 @@ public interface IAEFeature public AEFeatureHandler feature(); + void postInit(); + } diff --git a/core/features/registries/GrinderRecipeManager.java b/core/features/registries/GrinderRecipeManager.java index 45ab968a..23c0a84b 100644 --- a/core/features/registries/GrinderRecipeManager.java +++ b/core/features/registries/GrinderRecipeManager.java @@ -33,15 +33,23 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener public GrinderRecipeManager() { RecipeList = new ArrayList(); - addOre( "Gold", new ItemStack( Block.oreGold ) ); - addOre( "Iron", new ItemStack( Block.oreIron ) ); - addIngot( "Gold", new ItemStack( Item.ingotGold ) ); - addIngot( "Iron", new ItemStack( Item.ingotIron ) ); - addOre( "Obsidian", new ItemStack( Block.obsidian ) ); - addOre( "EnderPearl", new ItemStack( Item.enderPearl ) ); addOre( "Coal", new ItemStack( Item.coal ) ); addOre( "Charcoal", new ItemStack( Item.coal, 1, 1 ) ); + addOre( "NetherQuartz", new ItemStack( Block.oreNetherQuartz ) ); + addIngot( "NetherQuartz", new ItemStack( Item.netherQuartz ) ); + + addOre( "Gold", new ItemStack( Block.oreGold ) ); + addIngot( "Gold", new ItemStack( Item.ingotGold ) ); + + addOre( "Iron", new ItemStack( Block.oreIron ) ); + addIngot( "Iron", new ItemStack( Item.ingotIron ) ); + + addOre( "Obsidian", new ItemStack( Block.obsidian ) ); + addIngot( "Ender", new ItemStack( Item.enderPearl ) ); + + addIngot( "Wheat", new ItemStack( Item.wheat ) ); + OreDictionaryHandler.instance.observe( this ); } @@ -61,8 +69,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener return; } - log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " for " - + cost ); + log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " for " + cost ); RecipeList.add( new AppEngGrinderRecipe( copy( in ), copy( out ), cost ) ); } @@ -75,8 +82,8 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener return; } - log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) - + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost ); + log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + + Platform.getItemDisplayName( optional ) + " for " + cost ); RecipeList.add( new AppEngGrinderRecipe( copy( in ), copy( out ), copy( optional ), chance, cost ) ); } @@ -110,14 +117,10 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener { if ( name.equals( "Obsidian" ) ) return 1; - if ( name.equals( "EnderPearl" ) ) - return 1; if ( name.equals( "Charcoal" ) ) return 1; if ( name.equals( "Coal" ) ) return 1; - if ( name.contains( "Quartz" ) ) - return 1; return 2; } @@ -200,19 +203,18 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener @Override public void oreRegistered(String Name, ItemStack item) { - if ( Name.startsWith( "ore" ) || Name.startsWith( "ingot" ) || Name.startsWith( "dust" ) ) + if ( Name.startsWith( "ore" ) || Name.startsWith( "crystal" ) || Name.startsWith( "ingot" ) || Name.startsWith( "dust" ) ) { for (String ore : Configuration.instance.grinderOres) { - if ( ore.equals( "CertusQuartz" ) ) - continue; - if ( ore.equals( "NetherQuartz" ) ) - continue; - if ( Name.equals( "ore" + ore ) ) { addOre( ore, item ); } + else if ( Name.equals( "crystal" + ore ) ) + { + addIngot( ore, item ); + } else if ( Name.equals( "ingot" + ore ) ) { addIngot( ore, item ); diff --git a/items/AEBaseItem.java b/items/AEBaseItem.java index 5ebe4df2..afa45d91 100644 --- a/items/AEBaseItem.java +++ b/items/AEBaseItem.java @@ -49,4 +49,9 @@ public class AEBaseItem extends Item implements IAEFeature return false; } + @Override + public void postInit() + { + // override! + } } diff --git a/items/materials/MaterialType.java b/items/materials/MaterialType.java index 0beae5b1..fe784dc2 100644 --- a/items/materials/MaterialType.java +++ b/items/materials/MaterialType.java @@ -16,14 +16,14 @@ import cpw.mods.fml.relauncher.SideOnly; public enum MaterialType { - CertusQuartzCrystal(AEFeature.Core), CertusQuartzCrystalCharged(AEFeature.Core, EntityChargedQuartz.class), + CertusQuartzCrystal(AEFeature.Core, "crystalCertusQuartz"), CertusQuartzCrystalCharged(AEFeature.Core, EntityChargedQuartz.class), - CertusQuartzDust, NetherQuartzDust(AEFeature.Core, "dustNetherQuartz"), Flour(AEFeature.Flour, "dustWheat"), GoldDust(AEFeature.Core, "dustGold"), IronDust( - AEFeature.Core, "dustIron"), IronNugget(AEFeature.Core, "nuggetIron"), + CertusQuartzDust(AEFeature.Core, "dustCertusQuartz"), NetherQuartzDust(AEFeature.Core, "dustNetherQuartz"), Flour(AEFeature.Flour, "dustWheat"), GoldDust( + AEFeature.Core, "dustGold"), IronDust(AEFeature.Core, "dustIron"), IronNugget(AEFeature.Core, "nuggetIron"), Silicon(AEFeature.Core, "itemSilicon"), MatterBall, - FluixCrystal(AEFeature.Core, "crystalFLuix"), FluixDust(AEFeature.Core, "dustFluix"), FluixPearl(AEFeature.Core, "pearlFluix"), + FluixCrystal(AEFeature.Core, "crystalFluix"), FluixDust(AEFeature.Core, "dustFluix"), FluixPearl(AEFeature.Core, "pearlFluix"), PureifiedCertusQuartzCrystal, PureifiedNetherQuartzCrystal, PureifiedFluixCrystal, diff --git a/items/tools/quartz/ToolQuartzAxe.java b/items/tools/quartz/ToolQuartzAxe.java index f1531056..5ab2cf45 100644 --- a/items/tools/quartz/ToolQuartzAxe.java +++ b/items/tools/quartz/ToolQuartzAxe.java @@ -27,4 +27,9 @@ public class ToolQuartzAxe extends ItemAxe implements IAEFeature feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzAxe ), this, Type.name() ); } + @Override + public void postInit() + { + // override! + } } diff --git a/items/tools/quartz/ToolQuartzHoe.java b/items/tools/quartz/ToolQuartzHoe.java index 04b68359..5d6d240c 100644 --- a/items/tools/quartz/ToolQuartzHoe.java +++ b/items/tools/quartz/ToolQuartzHoe.java @@ -27,4 +27,9 @@ public class ToolQuartzHoe extends ItemHoe implements IAEFeature feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzHoe ), this, Type.name() ); } + @Override + public void postInit() + { + // override! + } } \ No newline at end of file diff --git a/items/tools/quartz/ToolQuartzPickaxe.java b/items/tools/quartz/ToolQuartzPickaxe.java index cbc79d3a..8c67097b 100644 --- a/items/tools/quartz/ToolQuartzPickaxe.java +++ b/items/tools/quartz/ToolQuartzPickaxe.java @@ -27,4 +27,9 @@ public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzPickaxe ), this, Type.name() ); } + @Override + public void postInit() + { + // override! + } } diff --git a/items/tools/quartz/ToolQuartzSpade.java b/items/tools/quartz/ToolQuartzSpade.java index c157ea5f..fd3765a6 100644 --- a/items/tools/quartz/ToolQuartzSpade.java +++ b/items/tools/quartz/ToolQuartzSpade.java @@ -27,4 +27,9 @@ public class ToolQuartzSpade extends ItemSpade implements IAEFeature feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSpade ), this, Type.name() ); } + @Override + public void postInit() + { + // override! + } } diff --git a/items/tools/quartz/ToolQuartzSword.java b/items/tools/quartz/ToolQuartzSword.java index ad2bc29b..415eba8f 100644 --- a/items/tools/quartz/ToolQuartzSword.java +++ b/items/tools/quartz/ToolQuartzSword.java @@ -25,4 +25,9 @@ public class ToolQuartzSword extends ItemSword implements IAEFeature feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSword ), this, Type.name() ); } + @Override + public void postInit() + { + // override! + } } diff --git a/server/ServerHelper.java b/server/ServerHelper.java index 5cb38323..6b54c210 100644 --- a/server/ServerHelper.java +++ b/server/ServerHelper.java @@ -2,6 +2,7 @@ package appeng.server; import java.util.ArrayList; import java.util.List; +import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -84,4 +85,10 @@ public class ServerHelper extends CommonHelper // :P } + @Override + public boolean shouldAddParticles(Random r) + { + return false; + } + }