diff --git a/src/main/java/cpw/mods/ironchest/BlockIronChest.java b/src/main/java/cpw/mods/ironchest/BlockIronChest.java index 247ac0d..14ddc7a 100755 --- a/src/main/java/cpw/mods/ironchest/BlockIronChest.java +++ b/src/main/java/cpw/mods/ironchest/BlockIronChest.java @@ -4,25 +4,22 @@ * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html - * + *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
-import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-import com.google.common.collect.Lists;
-
import cpw.mods.ironchest.client.IronChestTextureHandler;
-import net.minecraft.block.BlockContainer;
+import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
-import net.minecraft.block.properties.IProperty;
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,9 +34,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
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.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
@@ -47,7 +44,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockIronChest extends BlockContainer
+public class BlockIronChest extends Block
{
public static final PropertyEnum
* Contributors: cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -15,40 +15,37 @@ import static cpw.mods.ironchest.IronChestType.OBSIDIAN;
import static cpw.mods.ironchest.IronChestType.SILVER;
import static cpw.mods.ironchest.IronChestType.WOOD;
-import cpw.mods.ironchest.client.ModelHelper;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.registry.GameRegistry;
-import net.minecraftforge.fml.relauncher.Side;
public enum ChestChangerType
{
//@formatter:off
- IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "Iron to Gold Chest Upgrade", "mmm", "msm", "mmm"),
- GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "Gold to Diamond Chest Upgrade", "GGG", "msm", "GGG"),
- COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "Copper to Silver Chest Upgrade", "mmm", "msm", "mmm"),
- SILVERGOLD(SILVER, GOLD, "silverGoldUpgrade", "Silver to Gold Chest Upgrade", "mGm", "GsG", "mGm"),
- COPPERIRON(COPPER, IRON, "copperIronUpgrade", "Copper to Iron Chest Upgrade", "mGm", "GsG", "mGm"),
- DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamondCrystalUpgrade", "Diamond to Crystal Chest Upgrade", "GGG", "GOG", "GGG"),
- WOODIRON(WOOD, IRON, "woodIronUpgrade", "Normal chest to Iron Chest Upgrade", "mmm", "msm", "mmm"),
- WOODCOPPER(WOOD, COPPER, "woodCopperUpgrade", "Normal chest to Copper Chest Upgrade", "mmm", "msm", "mmm"),
- DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamondObsidianUpgrade", "Diamond to Obsidian Chest Upgrade", "mmm", "mGm", "mmm");
+ IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "mmm", "msm", "mmm"),
+ GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "GGG", "msm", "GGG"),
+ COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "mmm", "msm", "mmm"),
+ SILVERGOLD(SILVER, GOLD, "silverGoldUpgrade", "mGm", "GsG", "mGm"),
+ COPPERIRON(COPPER, IRON, "copperIronUpgrade", "mGm", "GsG", "mGm"),
+ DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamondCrystalUpgrade", "GGG", "GOG", "GGG"),
+ WOODIRON(WOOD, IRON, "woodIronUpgrade", "mmm", "msm", "mmm"),
+ WOODCOPPER(WOOD, COPPER, "woodCopperUpgrade", "mmm", "msm", "mmm"),
+ DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamondObsidianUpgrade", "mmm", "mGm", "mmm");
//@formatter:on
+ public static final ChestChangerType[] VALUES = values();
+
private IronChestType source;
private IronChestType target;
public String itemName;
- public String descriptiveName;
public ItemChestChanger item;
private String[] recipe;
- private ChestChangerType(IronChestType source, IronChestType target, String itemName, String descriptiveName, String... recipe)
+ ChestChangerType(IronChestType source, IronChestType target, String itemName, String... recipe)
{
this.source = source;
this.target = target;
this.itemName = itemName;
- this.descriptiveName = descriptiveName;
this.recipe = recipe;
}
@@ -62,31 +59,24 @@ public enum ChestChangerType
return from == this.source;
}
- public int getTarget()
+ public IronChestType getTarget()
{
- return this.target.ordinal();
+ return this.target;
}
public ItemChestChanger buildItem()
{
this.item = new ItemChestChanger(this);
this.item.setRegistryName(this.itemName);
-
GameRegistry.register(this.item);
-
- if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
- {
- ModelHelper.registerItem(this.item, "ironchest:" + this.itemName);
- }
-
return this.item;
}
public void addRecipes()
{
- for (String sourceMat : this.source.getMatList())
+ for (String sourceMat : this.source.matList)
{
- for (String targetMat : this.target.getMatList())
+ for (String targetMat : this.target.matList)
{
Object targetMaterial = IronChestType.translateOreName(targetMat);
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
@@ -99,7 +89,7 @@ public enum ChestChangerType
public static void buildItems()
{
- for (ChestChangerType type : values())
+ for (ChestChangerType type : VALUES)
{
type.buildItem();
}
@@ -107,7 +97,7 @@ public enum ChestChangerType
public static void generateRecipes()
{
- for (ChestChangerType item : values())
+ for (ChestChangerType item : VALUES)
{
item.addRecipes();
}
diff --git a/src/main/java/cpw/mods/ironchest/CommonProxy.java b/src/main/java/cpw/mods/ironchest/CommonProxy.java
index cc1ab21..505be12 100755
--- a/src/main/java/cpw/mods/ironchest/CommonProxy.java
+++ b/src/main/java/cpw/mods/ironchest/CommonProxy.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -20,12 +20,6 @@ public class CommonProxy implements IGuiHandler
{
public void registerRenderInformation()
{
-
- }
-
- public
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -44,7 +44,7 @@ public class ContainerIronChest extends Container
public ItemStack transferStackInSlot(EntityPlayer p, int i)
{
ItemStack itemstack = null;
- Slot slot = (Slot) this.inventorySlots.get(i);
+ Slot slot = this.inventorySlots.get(i);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
@@ -93,9 +93,9 @@ public class ContainerIronChest extends Container
{
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
{
- for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++)
+ for (int chestCol = 0; chestCol < type.rowLength; chestCol++)
{
- this.addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
+ this.addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.rowLength, 12 + chestCol * 18, 8 + chestRow * 18));
}
}
}
@@ -125,6 +125,6 @@ public class ContainerIronChest extends Container
@ChestContainer.RowSizeCallback
public int getNumColumns()
{
- return this.type.getRowLength();
+ return this.type.rowLength;
}
}
diff --git a/src/main/java/cpw/mods/ironchest/IronChest.java b/src/main/java/cpw/mods/ironchest/IronChest.java
index 0abc966..e672265 100755
--- a/src/main/java/cpw/mods/ironchest/IronChest.java
+++ b/src/main/java/cpw/mods/ironchest/IronChest.java
@@ -4,66 +4,68 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
+import java.util.Properties;
+
import cpw.mods.ironchest.client.IronChestEventHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
-import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
-@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[12.16.0.1819,)", acceptedMinecraftVersions = "[1.9]")
+@Mod(modid = IronChest.MOD_ID, name = "Iron Chests", dependencies = "required-after:Forge@[12.16.0.1819,)", acceptedMinecraftVersions = "[1.9]")
public class IronChest
{
- public static BlockIronChest ironChestBlock;
- public static ItemIronChest ironChestItemBlock;
+ public static final String MOD_ID = "IronChest";
+
+ @Instance(IronChest.MOD_ID)
+ public static IronChest instance;
+
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
public static CommonProxy proxy;
- @Instance("IronChest")
- public static IronChest instance;
+
+ public static BlockIronChest ironChestBlock;
+ public static ItemIronChest ironChestItemBlock;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
- Version.init(event.getVersionProperties());
- event.getModMetadata().version = Version.fullVersionString();
- }
+ Properties properties = event.getVersionProperties();
+
+ if (properties != null)
+ {
+ String major = properties.getProperty("IronChest.build.major.number");
+ String minor = properties.getProperty("IronChest.build.minor.number");
+ String rev = properties.getProperty("IronChest.build.revision.number");
+ String build = properties.getProperty("IronChest.build.number");
+ // String mcversion = properties.getProperty("IronChest.build.mcversion");
+ event.getModMetadata().version = String.format("%s.%s.%s build %s", major, minor, rev, build);
+ }
- @EventHandler
- public void load(FMLInitializationEvent evt)
- {
- // Registration has been moved to init to account for the registration of inventory models
- // Minecraft.getRenderItem() returns null before this stage
ChestChangerType.buildItems();
- ironChestBlock = new BlockIronChest();
- ironChestItemBlock = new ItemIronChest(ironChestBlock);
-
- ironChestBlock.setRegistryName("BlockIronChest");
- ironChestItemBlock.setRegistryName("BlockIronChest");
-
- GameRegistry.register(ironChestBlock);
+ ironChestBlock = GameRegistry.register(new BlockIronChest());
+ ironChestItemBlock = GameRegistry.register(new ItemIronChest(ironChestBlock));
GameRegistry.register(ironChestItemBlock);
- for (IronChestType typ : IronChestType.values())
+ for (IronChestType typ : IronChestType.VALUES)
{
- GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest." + typ.name(), typ.name());
- proxy.registerTileEntitySpecialRenderer(typ.clazz);
+ GameRegistry.registerTileEntity(typ.clazz, "IronChest." + typ.name());
}
+
IronChestType.registerBlocksAndRecipes(ironChestBlock);
ChestChangerType.generateRecipes();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
proxy.registerRenderInformation();
- MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
-
+ // FIXME: MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
MinecraftForge.EVENT_BUS.register(IronChestEventHandler.INSTANCE);
}
}
diff --git a/src/main/java/cpw/mods/ironchest/IronChestType.java b/src/main/java/cpw/mods/ironchest/IronChestType.java
index cd844b0..5aacd11 100755
--- a/src/main/java/cpw/mods/ironchest/IronChestType.java
+++ b/src/main/java/cpw/mods/ironchest/IronChestType.java
@@ -4,15 +4,15 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
+import java.util.Collection;
+import java.util.Collections;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
@@ -21,94 +21,77 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.util.IStringSerializable;
+import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
public enum IronChestType implements IStringSerializable
{
//@formatter:off
- IRON(54, 9, true, "Iron Chest", "ironchest.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
- GOLD(81, 9, true, "Gold Chest", "goldchest.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
- DIAMOND(108, 12, true, "Diamond Chest", "diamondchest.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
- COPPER(45, 9, false, "Copper Chest", "copperchest.png", 3, Arrays.asList("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"),
- SILVER(72, 9, false, "Silver Chest", "silverchest.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
- CRYSTAL(108, 12, true, "Crystal Chest", "crystalchest.png", 5, Arrays.asList("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"),
- OBSIDIAN(108, 12, false, "Obsidian Chest", "obsidianchest.png", 6, Arrays.asList("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"),
- DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "dirtchest.png", 7, Arrays.asList("dirt"), TileEntityDirtChest.class, Item.getItemFromBlock(Blocks.DIRT), "mmmmCmmmm"),
- WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
+ IRON(54, 9, true, "ironchest.png", Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
+ GOLD(81, 9, true, "goldchest.png", Collections.singleton("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
+ DIAMOND(108, 12, true, "diamondchest.png", Collections.singleton("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
+ COPPER(45, 9, false, "copperchest.png", Collections.singleton("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"),
+ SILVER(72, 9, false, "silverchest.png", Collections.singleton("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
+ CRYSTAL(108, 12, true, "crystalchest.png", Collections.singleton("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"),
+ OBSIDIAN(108, 12, false, "obsidianchest.png", Collections.singleton("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"),
+ DIRTCHEST9000(1, 1, false, "dirtchest.png", Collections.singleton("dirt"), TileEntityDirtChest.class, "mmmmCmmmm"),
+ WOOD(0, 0, false, "", Collections.singleton("plankWood"), null);
//@formatter:on
- int size;
- private int rowLength;
- public String friendlyName;
- private boolean tieredChest;
- private String modelTexture;
- private int textureRow;
- public Class extends TileEntityIronChest> clazz;
- private String[] recipes;
- private ArrayList
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -26,12 +26,11 @@ import net.minecraft.world.World;
public class ItemChestChanger extends Item
{
- private ChestChangerType type;
+ public final ChestChangerType type;
public ItemChestChanger(ChestChangerType type)
{
this.type = type;
-
this.setMaxStackSize(1);
this.setUnlocalizedName("ironchest:" + type.name());
this.setCreativeTab(CreativeTabs.MISC);
@@ -64,14 +63,14 @@ public class ItemChestChanger extends Item
TileEntity te = worldIn.getTileEntity(pos);
TileEntityIronChest newchest = new TileEntityIronChest();
ItemStack[] chestContents = new ItemStack[27];
- int chestFacing = 0;
+ EnumFacing chestFacing = EnumFacing.DOWN;
if (te != null)
{
if (te instanceof TileEntityIronChest)
{
chestContents = ((TileEntityIronChest) te).chestContents;
chestFacing = ((TileEntityIronChest) te).getFacing();
- newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
+ newchest = this.type.getTarget().makeEntity();
if (newchest == null)
{
return EnumActionResult.PASS;
@@ -80,37 +79,23 @@ public class ItemChestChanger extends Item
else if (te instanceof TileEntityChest)
{
IBlockState chestState = worldIn.getBlockState(pos);
- EnumFacing orientation = chestState.getValue(BlockChest.FACING);
- if (orientation == EnumFacing.NORTH)
- {
- chestFacing = 2;
- }
- if (orientation == EnumFacing.EAST)
- {
- chestFacing = 5;
- }
- if (orientation == EnumFacing.SOUTH)
- {
- chestFacing = 3;
- }
- if (orientation == EnumFacing.WEST)
- {
- chestFacing = 4;
- }
- if (((TileEntityChest) te).numPlayersUsing > 0)
+ chestFacing = chestState.getValue(BlockChest.FACING);
+ TileEntityChest chest = (TileEntityChest) te;
+
+ if (chest.numPlayersUsing > 0)
{
return EnumActionResult.PASS;
}
- if (!this.getType().canUpgrade(IronChestType.WOOD))
+ if (!this.type.canUpgrade(IronChestType.WOOD))
{
return EnumActionResult.PASS;
}
- chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
+ chestContents = new ItemStack[chest.getSizeInventory()];
for (int i = 0; i < chestContents.length; i++)
{
- chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
+ chestContents[i] = chest.getStackInSlot(i);
}
- newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
+ newchest = this.type.getTarget().makeEntity();
}
}
@@ -134,20 +119,10 @@ public class ItemChestChanger extends Item
if (te2 instanceof TileEntityIronChest)
{
((TileEntityIronChest) te2).setContents(chestContents);
- ((TileEntityIronChest) te2).setFacing((byte) chestFacing);
+ ((TileEntityIronChest) te2).setFacing(chestFacing);
}
stack.stackSize = playerIn.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
return EnumActionResult.SUCCESS;
}
-
- public int getTargetChestOrdinal(int sourceOrdinal)
- {
- return this.type.getTarget();
- }
-
- public ChestChangerType getType()
- {
- return this.type;
- }
}
diff --git a/src/main/java/cpw/mods/ironchest/ItemIronChest.java b/src/main/java/cpw/mods/ironchest/ItemIronChest.java
index 294501d..f86e9b8 100755
--- a/src/main/java/cpw/mods/ironchest/ItemIronChest.java
+++ b/src/main/java/cpw/mods/ironchest/ItemIronChest.java
@@ -4,21 +4,23 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
public class ItemIronChest extends ItemBlock
{
public ItemIronChest(Block block)
{
super(block);
+ this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "BlockIronChest"));
this.setMaxDamage(0);
this.setHasSubtypes(true);
@@ -27,12 +29,12 @@ public class ItemIronChest extends ItemBlock
@Override
public int getMetadata(int meta)
{
- return IronChestType.validateMeta(meta);
+ return meta;
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
- return "tile.ironchest:" + IronChestType.values()[itemstack.getMetadata()].name();
+ return "tile.ironchest:" + IronChestType.VALUES[itemstack.getMetadata()].getName();
}
}
diff --git a/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java b/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java
index 31ee052..d57331a 100755
--- a/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java
+++ b/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java
@@ -6,7 +6,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class OcelotsSitOnChestsHandler
{
-
@SubscribeEvent
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
{
diff --git a/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java b/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java
index d54f6a4..f3929ef 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -16,5 +16,4 @@ public class TileEntityCopperChest extends TileEntityIronChest
{
super(IronChestType.COPPER);
}
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java b/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java
index 5b9625e..6a65262 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -16,4 +16,4 @@ public class TileEntityCrystalChest extends TileEntityIronChest
{
super(IronChestType.CRYSTAL);
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java b/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java
index 7060825..f81ab57 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -16,4 +16,4 @@ public class TileEntityDiamondChest extends TileEntityIronChest
{
super(IronChestType.DIAMOND);
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java b/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java
index 15489c9..d70d4f6 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java
@@ -46,4 +46,4 @@ public class TileEntityDirtChest extends TileEntityIronChest
this.chestContents[0] = null;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java b/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java
index 01eda3d..2c36323 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
diff --git a/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java b/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java
index e5903bc..73636f7 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
@@ -40,10 +40,9 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
public float prevLidAngle;
public float lidAngle;
private int numUsingPlayers;
- private IronChestType type;
public ItemStack[] chestContents;
private ItemStack[] topStacks;
- private byte facing;
+ private EnumFacing facing;
private boolean inventoryTouched;
private boolean hadStuff;
private String customName;
@@ -56,19 +55,14 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
protected TileEntityIronChest(IronChestType type)
{
super();
- this.type = type;
- this.chestContents = new ItemStack[this.getSizeInventory()];
+ this.chestContents = new ItemStack[type.size];
this.topStacks = new ItemStack[8];
- }
-
- public ItemStack[] getContents()
- {
- return this.chestContents;
+ this.facing = EnumFacing.NORTH;
}
public void setContents(ItemStack[] contents)
{
- this.chestContents = new ItemStack[this.getSizeInventory()];
+ this.chestContents = new ItemStack[this.getType().size];
for (int i = 0; i < contents.length; i++)
{
if (i < this.chestContents.length)
@@ -82,17 +76,17 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public int getSizeInventory()
{
- return this.type.size;
+ return this.chestContents.length;
}
- public int getFacing()
+ public EnumFacing getFacing()
{
return this.facing;
}
public IronChestType getType()
{
- return this.type;
+ return this.hasWorldObj() ? this.worldObj.getBlockState(this.pos).getValue(BlockIronChest.VARIANT_PROP) : IronChestType.WOOD;
}
@Override
@@ -111,7 +105,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
protected void sortTopStacks()
{
- if (!this.type.isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
+ if (!this.getType().isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
{
return;
}
@@ -230,7 +224,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public String getName()
{
- return this.hasCustomName() ? this.customName : this.type.name();
+ return this.hasCustomName() ? this.customName : this.getType().name();
}
@Override
@@ -266,7 +260,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
- this.facing = nbttagcompound.getByte("facing");
+ this.facing = EnumFacing.VALUES[nbttagcompound.getByte("facing")];
this.sortTopStacks();
}
@@ -287,7 +281,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
}
nbttagcompound.setTag("Items", nbttaglist);
- nbttagcompound.setByte("facing", this.facing);
+ nbttagcompound.setByte("facing", (byte) this.facing.ordinal());
if (this.hasCustomName())
{
@@ -339,7 +333,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
if (this.worldObj != null && !this.worldObj.isRemote && this.ticksSinceSync < 0)
{
- this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 3, ((this.numUsingPlayers << 3) & 0xF8) | (this.facing & 0x7));
+ this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 3, ((this.numUsingPlayers << 3) & 0xF8) | (this.facing.ordinal() & 0x7));
}
if (!this.worldObj.isRemote && this.inventoryTouched)
{
@@ -355,7 +349,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
double d = this.pos.getX() + 0.5D;
double d1 = this.pos.getZ() + 0.5D;
//@formatter:off
- this.worldObj.playSound((EntityPlayer) null, d, this.pos.getY() + 0.5D, d1, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
+ this.worldObj.playSound(null, d, this.pos.getY() + 0.5D, d1, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
//@formatter:on
}
if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
@@ -379,7 +373,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
double d2 = this.pos.getX() + 0.5D;
double d3 = this.pos.getZ() + 0.5D;
//@formatter:off
- this.worldObj.playSound((EntityPlayer) null, d2, this.pos.getY() + 0.5D, d3, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
+ this.worldObj.playSound(null, d2, this.pos.getY() + 0.5D, d3, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
//@formatter:on
}
if (this.lidAngle < 0.0F)
@@ -398,11 +392,11 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
}
else if (i == 2)
{
- this.facing = (byte) j;
+ this.facing = EnumFacing.VALUES[j];
}
else if (i == 3)
{
- this.facing = (byte) (j & 0x7);
+ this.facing = EnumFacing.VALUES[j & 0x7];
this.numUsingPlayers = (j & 0xF8) >> 3;
}
return true;
@@ -430,7 +424,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numUsingPlayers);
}
- public void setFacing(byte facing2)
+ public void setFacing(EnumFacing facing2)
{
this.facing = facing2;
}
@@ -440,26 +434,12 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
return this.topStacks;
}
- public TileEntityIronChest updateFromMetadata(int l)
- {
- if (this.worldObj != null && this.worldObj.isRemote)
- {
- if (l != this.type.ordinal())
- {
- this.worldObj.setTileEntity(this.pos, IronChestType.makeEntity(l));
- return (TileEntityIronChest) this.worldObj.getTileEntity(this.pos);
- }
- }
- return this;
- }
-
@Override
public Packet> getDescriptionPacket()
{
NBTTagCompound nbt = new NBTTagCompound();
- nbt.setInteger("type", this.getType().ordinal());
- nbt.setByte("facing", this.facing);
+ nbt.setByte("facing", (byte) this.facing.ordinal());
ItemStack[] stacks = this.buildItemStackDataList();
if (stacks != null)
{
@@ -486,8 +466,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
if (pkt.getTileEntityType() == 0)
{
NBTTagCompound nbt = pkt.getNbtCompound();
- this.type = IronChestType.values()[nbt.getInteger("type")];
- this.facing = nbt.getByte("facing");
+ this.facing = EnumFacing.VALUES[nbt.getByte("facing")];
NBTTagList tagList = nbt.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
ItemStack[] stacks = new ItemStack[this.topStacks.length];
@@ -502,7 +481,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
}
}
- if (this.type.isTransparent() && stacks != null)
+ if (this.getType().isTransparent() && stacks != null)
{
int pos = 0;
for (int i = 0; i < this.topStacks.length; i++)
@@ -523,7 +502,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
public ItemStack[] buildItemStackDataList()
{
- if (this.type.isTransparent())
+ if (this.getType().isTransparent())
{
ItemStack[] sortList = new ItemStack[this.topStacks.length];
int pos = 0;
@@ -561,18 +540,13 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
- return this.type.acceptsStack(itemstack);
+ return this.getType().acceptsStack(itemstack);
}
public void rotateAround()
{
- this.facing++;
- if (this.facing > EnumFacing.EAST.ordinal())
- {
- this.facing = (byte) EnumFacing.NORTH.ordinal();
- }
- this.setFacing(this.facing);
- this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 2, this.facing);
+ this.setFacing(this.facing.rotateY());
+ this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 2, this.facing.ordinal());
}
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
@@ -618,7 +592,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public String getGuiID()
{
- return "IronChest:" + this.type.name();
+ return "IronChest:" + this.getType().name();
}
@Override
diff --git a/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java b/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java
index c0702a1..1769186 100755
--- a/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java
+++ b/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java
@@ -4,9 +4,9 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest;
diff --git a/src/main/java/cpw/mods/ironchest/Version.java b/src/main/java/cpw/mods/ironchest/Version.java
deleted file mode 100755
index fc623a7..0000000
--- a/src/main/java/cpw/mods/ironchest/Version.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 cpw. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
- * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
- *
- * Contributors: cpw - initial API and implementation
- ******************************************************************************/
-package cpw.mods.ironchest;
-
-import java.util.Properties;
-
-public class Version
-{
- private static String major;
- private static String minor;
- private static String rev;
- private static String build;
- @SuppressWarnings("unused")
- private static String mcversion;
-
- static void init(Properties properties)
- {
- if (properties != null)
- {
- major = properties.getProperty("IronChest.build.major.number");
- minor = properties.getProperty("IronChest.build.minor.number");
- rev = properties.getProperty("IronChest.build.revision.number");
- build = properties.getProperty("IronChest.build.number");
- mcversion = properties.getProperty("IronChest.build.mcversion");
- }
- }
-
- public static String fullVersionString()
- {
- return String.format("%s.%s.%s build %s", major, minor, rev, build);
- }
-}
diff --git a/src/main/java/cpw/mods/ironchest/client/ClientProxy.java b/src/main/java/cpw/mods/ironchest/client/ClientProxy.java
index 67cfe2d..46cdc79 100755
--- a/src/main/java/cpw/mods/ironchest/client/ClientProxy.java
+++ b/src/main/java/cpw/mods/ironchest/client/ClientProxy.java
@@ -4,19 +4,17 @@
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest.client;
+import cpw.mods.ironchest.ChestChangerType;
import cpw.mods.ironchest.CommonProxy;
import cpw.mods.ironchest.IronChest;
import cpw.mods.ironchest.IronChestType;
import cpw.mods.ironchest.TileEntityIronChest;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.ItemModelMesher;
-import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -24,40 +22,41 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
-import net.minecraftforge.fml.client.FMLClientHandler;
+import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.ClientRegistry;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy
{
@Override
public void registerRenderInformation()
{
- Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getBlockModelShapes().registerBuiltInBlocks(IronChest.ironChestBlock);
+ Item chestItem = Item.getItemFromBlock(IronChest.ironChestBlock);
- ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
- for (IronChestType chestType : IronChestType.values())
+ for (IronChestType type : IronChestType.values())
{
- if (chestType != IronChestType.WOOD)
+ if (type != IronChestType.WOOD)
{
- Item chestItem = Item.getItemFromBlock(IronChest.ironChestBlock);
- mesher.register(chestItem, chestType.ordinal(), new ModelResourceLocation("ironchest:chest_" + chestType.getName().toLowerCase(), "inventory"));
- ModelBakery.registerItemVariants(chestItem, new ResourceLocation("ironchest:chest_" + chestType.getName().toLowerCase()));
+ ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(),
+ new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "chest_" + type.getName()), "inventory"));
+ }
+
+ ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer());
+ }
+
+ 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"));
}
}
}
- @Override
- public
* Contributors:
- * cpw - initial API and implementation
+ * cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest.client;
-import org.lwjgl.opengl.GL11;
-
import cpw.mods.ironchest.ContainerIronChest;
import cpw.mods.ironchest.IronChestType;
import cpw.mods.ironchest.TileEntityIronChest;
import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
@@ -24,15 +23,17 @@ public class GUIChest extends GuiContainer
{
public enum ResourceList
{
- IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")), COPPER(
- new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")), SILVER(
- new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")), GOLD(
- new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")), DIAMOND(
- new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")), DIRT(
- new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png"));
+ //@formatter:off
+ IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")),
+ COPPER(new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")),
+ SILVER(new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")),
+ GOLD(new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")),
+ DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")),
+ DIRT(new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png"));
+ //@formatter:on
public final ResourceLocation location;
- private ResourceList(ResourceLocation loc)
+ ResourceList(ResourceLocation loc)
{
this.location = loc;
}
@@ -40,23 +41,28 @@ public class GUIChest extends GuiContainer
public enum GUI
{
- IRON(184, 202, ResourceList.IRON, IronChestType.IRON), GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD), DIAMOND(238, 256, ResourceList.DIAMOND,
- IronChestType.DIAMOND), COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER), SILVER(184, 238, ResourceList.SILVER,
- IronChestType.SILVER), CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL), OBSIDIAN(238, 256, ResourceList.DIAMOND,
- IronChestType.OBSIDIAN), DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000);
+ //@formatter:off
+ IRON(184, 202, ResourceList.IRON, IronChestType.IRON),
+ GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD),
+ DIAMOND(238, 256, ResourceList.DIAMOND, IronChestType.DIAMOND),
+ COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER),
+ SILVER(184, 238, ResourceList.SILVER, IronChestType.SILVER),
+ CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL),
+ OBSIDIAN(238, 256, ResourceList.DIAMOND,IronChestType.OBSIDIAN),
+ DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000);
+ //@formatter:on
private int xSize;
private int ySize;
private ResourceList guiResourceList;
private IronChestType mainType;
- private GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType)
+ GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType)
{
this.xSize = xSize;
this.ySize = ySize;
this.guiResourceList = guiResourceList;
this.mainType = mainType;
-
}
protected Container makeContainer(IInventory player, IInventory chest)
@@ -70,11 +76,6 @@ public class GUIChest extends GuiContainer
}
}
- public int getRowLength()
- {
- return this.type.mainType.getRowLength();
- }
-
private GUI type;
private GUIChest(GUI type, IInventory player, IInventory chest)
@@ -89,7 +90,7 @@ public class GUIChest extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
// new "bind tex"
this.mc.getTextureManager().bindTexture(this.type.guiResourceList.location);
int x = (this.width - this.xSize) / 2;
diff --git a/src/main/java/cpw/mods/ironchest/client/IronChestEventHandler.java b/src/main/java/cpw/mods/ironchest/client/IronChestEventHandler.java
index f6f8d37..d94910c 100644
--- a/src/main/java/cpw/mods/ironchest/client/IronChestEventHandler.java
+++ b/src/main/java/cpw/mods/ironchest/client/IronChestEventHandler.java
@@ -1,11 +1,12 @@
package cpw.mods.ironchest.client;
+import cpw.mods.ironchest.IronChestType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
public class IronChestEventHandler
{
@@ -17,12 +18,10 @@ public class IronChestEventHandler
{
if (event.getMap() == FMLClientHandler.instance().getClient().getTextureMapBlocks())
{
- event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/copperbreak"));
- event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/crystalbreak"));
- event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/diamondbreak"));
- event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/goldbreak"));
- event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/ironbreak"));
- event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/silverbreak"));
+ for (IronChestType t : IronChestType.VALUES)
+ {
+ event.getMap().registerSprite(new ResourceLocation(t.getBreakTexture()));
+ }
}
}
}
diff --git a/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java b/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java
index bb11053..f6d7016 100644
--- a/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java
+++ b/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java
@@ -1,11 +1,8 @@
package cpw.mods.ironchest.client;
-import java.util.Map;
import java.util.Random;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-
+import cpw.mods.ironchest.BlockIronChest;
import cpw.mods.ironchest.IronChestType;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -15,37 +12,19 @@ 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.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class IronChestTextureHandler
{
- private static Map
* Contributors:
* cpw - initial API and implementation
******************************************************************************/
package cpw.mods.ironchest.client;
-import java.util.Map;
import java.util.Random;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.primitives.SignedBytes;
import cpw.mods.ironchest.BlockIronChest;
@@ -29,67 +26,39 @@ import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.EnumFacing;
-public class TileEntityIronChestRenderer