diff --git a/src/main/java/cpw/mods/ironchest/BlockIronChest.java b/src/main/java/cpw/mods/ironchest/BlockIronChest.java index 14ddc7a..1ff40b0 100755 --- a/src/main/java/cpw/mods/ironchest/BlockIronChest.java +++ b/src/main/java/cpw/mods/ironchest/BlockIronChest.java @@ -13,13 +13,11 @@ package cpw.mods.ironchest; import java.util.List; import java.util.Random; -import cpw.mods.ironchest.client.IronChestTextureHandler; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.particle.EffectRenderer; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -37,7 +35,6 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -244,27 +241,6 @@ public class BlockIronChest extends Block return super.getExplosionResistance(world, pos, exploder, explosion); } - /* - * @Override public boolean addLandingEffects(IBlockState state, WorldServer world, BlockPos pos, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) { - * IronChestTextureHandler.addDestroyEffects(world, pos, state); return true; } - */ - - @Override - @SideOnly(Side.CLIENT) - public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) - { - IronChestTextureHandler.addHitEffects(worldObj, target.getBlockPos(), target.sideHit); - return true; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) - { - IronChestTextureHandler.addDestroyEffects(world, pos, world.getBlockState(pos)); - return true; - } - @Override public boolean hasComparatorInputOverride(IBlockState state) { diff --git a/src/main/java/cpw/mods/ironchest/ChestChangerType.java b/src/main/java/cpw/mods/ironchest/ChestChangerType.java index d24ed71..7990020 100755 --- a/src/main/java/cpw/mods/ironchest/ChestChangerType.java +++ b/src/main/java/cpw/mods/ironchest/ChestChangerType.java @@ -35,9 +35,9 @@ public enum ChestChangerType public static final ChestChangerType[] VALUES = values(); - private IronChestType source; - private IronChestType target; - public String itemName; + public final IronChestType source; + public final IronChestType target; + public final String itemName; public ItemChestChanger item; private String[] recipe; @@ -49,21 +49,11 @@ public enum ChestChangerType this.recipe = recipe; } - public IronChestType getSource() - { - return this.source; - } - public boolean canUpgrade(IronChestType from) { return from == this.source; } - - public IronChestType getTarget() - { - return this.target; - } - + public ItemChestChanger buildItem() { this.item = new ItemChestChanger(this); diff --git a/src/main/java/cpw/mods/ironchest/ItemChestChanger.java b/src/main/java/cpw/mods/ironchest/ItemChestChanger.java index 1e14f5a..bac35eb 100755 --- a/src/main/java/cpw/mods/ironchest/ItemChestChanger.java +++ b/src/main/java/cpw/mods/ironchest/ItemChestChanger.java @@ -55,7 +55,7 @@ public class ItemChestChanger extends Item else { if (worldIn.getBlockState(pos) != IronChest.ironChestBlock - .getStateFromMeta(IronChestType.valueOf(this.type.getSource().getName().toUpperCase()).ordinal())) + .getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal())) { return EnumActionResult.PASS; } @@ -70,7 +70,7 @@ public class ItemChestChanger extends Item { chestContents = ((TileEntityIronChest) te).chestContents; chestFacing = ((TileEntityIronChest) te).getFacing(); - newchest = this.type.getTarget().makeEntity(); + newchest = this.type.target.makeEntity(); if (newchest == null) { return EnumActionResult.PASS; @@ -95,7 +95,7 @@ public class ItemChestChanger extends Item { chestContents[i] = chest.getStackInSlot(i); } - newchest = this.type.getTarget().makeEntity(); + newchest = this.type.target.makeEntity(); } } diff --git a/src/main/java/cpw/mods/ironchest/ItemIronChest.java b/src/main/java/cpw/mods/ironchest/ItemIronChest.java index f86e9b8..25a7eb3 100755 --- a/src/main/java/cpw/mods/ironchest/ItemIronChest.java +++ b/src/main/java/cpw/mods/ironchest/ItemIronChest.java @@ -35,6 +35,6 @@ public class ItemIronChest extends ItemBlock @Override public String getUnlocalizedName(ItemStack itemstack) { - return "tile.ironchest:" + IronChestType.VALUES[itemstack.getMetadata()].getName(); + return "tile.ironchest:" + IronChestType.VALUES[itemstack.getMetadata()].name(); } } diff --git a/src/main/java/cpw/mods/ironchest/client/ClientProxy.java b/src/main/java/cpw/mods/ironchest/client/ClientProxy.java index 46cdc79..9d56e9b 100755 --- a/src/main/java/cpw/mods/ironchest/client/ClientProxy.java +++ b/src/main/java/cpw/mods/ironchest/client/ClientProxy.java @@ -40,8 +40,7 @@ public class ClientProxy extends CommonProxy { if (type != IronChestType.WOOD) { - ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(), - new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "chest_" + type.getName()), "inventory")); + ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(), new ModelResourceLocation(chestItem.getRegistryName(), "variant=" + type.getName())); } ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer()); @@ -49,11 +48,7 @@ public class ClientProxy extends CommonProxy for (ChestChangerType type : ChestChangerType.VALUES) { - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) - { - ModelLoader.setCustomModelResourceLocation(type.item, 0, - new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, type.itemName), "inventory")); - } + ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "ItemChestUpgrade"), "variant=" + type.itemName.toLowerCase())); } } diff --git a/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java b/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java deleted file mode 100644 index f6d7016..0000000 --- a/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java +++ /dev/null @@ -1,107 +0,0 @@ -package cpw.mods.ironchest.client; - -import java.util.Random; - -import cpw.mods.ironchest.BlockIronChest; -import cpw.mods.ironchest.IronChestType; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityDiggingFX; -import net.minecraft.client.renderer.block.model.ModelManager; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class IronChestTextureHandler -{ - public static void addHitEffects(World world, BlockPos pos, EnumFacing side) - { - IBlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - state = block.getActualState(state, world, pos); - Random rand = new Random(); - IronChestType type = state.getValue(BlockIronChest.VARIANT_PROP); - ModelManager modelmanager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager(); - - if (block.getRenderType(state) != EnumBlockRenderType.INVISIBLE) - { - int i = pos.getX(); - int j = pos.getY(); - int k = pos.getZ(); - float f = 0.1F; - AxisAlignedBB bb = block.getBoundingBox(state, world, pos); - - double d0 = i + rand.nextDouble() * (bb.maxX - bb.minX - f * 2.0F) + f + bb.minX; - double d1 = j + rand.nextDouble() * (bb.maxY - bb.minY - f * 2.0F) + f + bb.minY; - double d2 = k + rand.nextDouble() * (bb.maxZ - bb.minZ - f * 2.0F) + f + bb.minZ; - - if (side == EnumFacing.DOWN) - { - d1 = j + bb.minY - f; - } - - if (side == EnumFacing.UP) - { - d1 = j + bb.maxY + f; - } - - if (side == EnumFacing.NORTH) - { - d2 = k + bb.minZ - f; - } - - if (side == EnumFacing.SOUTH) - { - d2 = k + bb.maxZ + f; - } - - if (side == EnumFacing.WEST) - { - d0 = i + bb.minX - f; - } - - if (side == EnumFacing.EAST) - { - d0 = i + bb.maxX + f; - } - - EntityDiggingFX fx = ((EntityDiggingFX) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), - d0, d1, d2, 0.0D, 0.0D, 0.0D, Block.getIdFromBlock(state.getBlock()))); - - fx.setBlockPos(pos); - fx.multiplyVelocity(0.2F); - fx.multipleParticleScaleBy(0.6F); - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite(type.getBreakTexture())); - } - } - - public static void addDestroyEffects(World world, BlockPos pos, IBlockState state) - { - state = state.getBlock().getActualState(state, world, pos); - int i = 4; - IronChestType type = state.getValue(BlockIronChest.VARIANT_PROP); - ModelManager modelmanager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager(); - - for (int j = 0; j < i; ++j) - { - for (int k = 0; k < i; ++k) - { - for (int l = 0; l < i; ++l) - { - double d0 = pos.getX() + (j + 0.5D) / i; - double d1 = pos.getY() + (k + 0.5D) / i; - double d2 = pos.getZ() + (l + 0.5D) / i; - EntityDiggingFX fx = ((EntityDiggingFX) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle( - EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, - Block.getIdFromBlock(state.getBlock()))); - fx.setBlockPos(pos); - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite(type.getBreakTexture())); - } - } - } - } -} diff --git a/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java b/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java index 53e0378..3ec792a 100755 --- a/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java +++ b/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java @@ -145,7 +145,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer