Add new chest upgrades & Fix upgrading changing the direction the chest faces.

This commit is contained in:
61352151511 2016-02-06 12:37:31 -04:00
parent c4d5a5631f
commit 08e7319e5c
50 changed files with 596 additions and 382 deletions

View File

@ -6,97 +6,90 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import static cpw.mods.ironchest.IronChestType.COPPER; import static cpw.mods.ironchest.IronChestTypeSimple.COPPER;
import static cpw.mods.ironchest.IronChestType.CRYSTAL; import static cpw.mods.ironchest.IronChestTypeSimple.CRYSTAL;
import static cpw.mods.ironchest.IronChestType.DIAMOND; import static cpw.mods.ironchest.IronChestTypeSimple.DIAMOND;
import static cpw.mods.ironchest.IronChestType.GOLD; import static cpw.mods.ironchest.IronChestTypeSimple.GOLD;
import static cpw.mods.ironchest.IronChestType.IRON; import static cpw.mods.ironchest.IronChestTypeSimple.IRON;
import static cpw.mods.ironchest.IronChestType.OBSIDIAN; import static cpw.mods.ironchest.IronChestTypeSimple.OBSIDIAN;
import static cpw.mods.ironchest.IronChestType.SILVER; import static cpw.mods.ironchest.IronChestTypeSimple.SILVER;
import static cpw.mods.ironchest.IronChestType.WOOD; import static cpw.mods.ironchest.IronChestTypeSimple.WOOD;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import cpw.mods.ironchest.client.ModelHelper;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import cpw.mods.ironchest.client.ModelHelper;
public enum ChestChangerType { public enum ChestChangerType {
IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "Iron to Gold Chest Upgrade", "mmm", "msm", "mmm"), WOOD_UPGRADE(WOOD, new IronChestTypeSimple[] {IRON, GOLD, DIAMOND, OBSIDIAN}, "woodUpgrade", new String[][] {{"ttt", "tst", "ttt"}, {"ttt", "tst", "ttt"}, {"GGG", "tst", "GGG"}, {"tst", "tGt", "ttt"}}),
GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "Gold to Diamond Chest Upgrade", "GGG", "msm", "GGG"), IRON_UPGRADE(IRON, new IronChestTypeSimple[] {GOLD, DIAMOND, OBSIDIAN}, "ironUpgrade", new String[][] {{"ttt", "tst", "ttt"}, {"GGG", "tst", "GGG"}, {"tst", "tGt", "ttt"}}),
COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "Copper to Silver Chest Upgrade", "mmm", "msm", "mmm"), GOLD_UPGRADE(GOLD, new IronChestTypeSimple[] {DIAMOND, OBSIDIAN}, "goldUpgrade", new String[][] {{"GGG", "tst", "GGG"}, {"tst", "tGt", "ttt"}}),
SILVERGOLD(SILVER, GOLD, "silverGoldUpgrade", "Silver to Gold Chest Upgrade", "mGm", "GsG", "mGm"), DIAMOND_OBSIDIAN_UPGRADE(DIAMOND, new IronChestTypeSimple[] {OBSIDIAN}, "diamondObsidianUpgrade", new String[][] {{"tst", "tGt", "ttt"}}),
COPPERIRON(COPPER, IRON, "copperIronUpgrade", "Copper to Iron Chest Upgrade", "mGm", "GsG", "mGm"), DIAMOND_CRYSTAL_UPGRADE(DIAMOND, new IronChestTypeSimple[] {CRYSTAL}, "diamondCrystalUpgrade", new String[][] {{"GsG", "GOG", "GGG"}}),
DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamondCrystalUpgrade", "Diamond to Crystal Chest Upgrade", "GGG", "GOG", "GGG"), COPPER_UPGRADE(COPPER, new IronChestTypeSimple[] {IRON, GOLD, DIAMOND, OBSIDIAN}, "copperUpgrade", new String[][] {{"tGt", "GsG", "tGt"}, {"ttt", "tst", "ttt"}, {"GGG", "tst", "GGG"}, {"tst", "tGt", "ttt"}}),
WOODIRON(WOOD, IRON, "woodIronUpgrade", "Normal chest to Iron Chest Upgrade", "mmm", "msm", "mmm"), SILVER_UPGRADE(SILVER, new IronChestTypeSimple[] {GOLD, DIAMOND, OBSIDIAN}, "silverUpgrade", new String[][] {{"tGt", "GsG", "tGt"}, {"GGG", "tst", "GGG"}, {"tst", "tGt", "ttt"}});
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");
private IronChestType source; private IronChestTypeSimple source;
private IronChestType target; IronChestTypeSimple[] upgradeChain;
public String itemName; public ItemChestChanger item;
public String descriptiveName; public String itemName;
public ItemChestChanger item; private String[][] recipe;
private String[] recipe;
private ChestChangerType(IronChestType source, IronChestType target, String itemName, String descriptiveName, String... recipe) private ChestChangerType(IronChestTypeSimple source, IronChestTypeSimple[] upgradeChain, String itemName, String[][] recipes) {
{ this.source = source;
this.source = source; this.upgradeChain = upgradeChain;
this.target = target; this.itemName = itemName;
this.itemName = itemName; this.recipe = recipes;
this.descriptiveName = descriptiveName; }
this.recipe = recipe;
}
public IronChestType getSource(){ public IronChestTypeSimple getSource() {
return source; return source;
} }
public boolean canUpgrade(IronChestType from) public boolean canUpgrade(IronChestTypeSimple from) {
{ return from == this.source;
return from == this.source; }
}
public int getTarget() public int getTarget(int meta) {
{ return this.upgradeChain[meta].ordinal();
return this.target.ordinal(); }
}
public ItemChestChanger buildItem() public String getTargetName(int meta) {
{ return this.upgradeChain[meta].getName();
item = new ItemChestChanger(this); }
GameRegistry.registerItem(item, itemName);
if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
ModelHelper.registerItem(item, "ironchest:" + itemName);
return item;
}
public void addRecipes() public ItemChestChanger buildItem() {
{ item = new ItemChestChanger(this);
for (String sourceMat : source.getMatList()) GameRegistry.registerItem(item, itemName);
{ if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
for (String targetMat : target.getMatList()) for (int i = 0; i < this.upgradeChain.length; i ++) {
{ String targetName = this.upgradeChain[i].getName().substring(0, 1).toUpperCase() + this.upgradeChain[i].getName().substring(1);
Object targetMaterial = IronChestType.translateOreName(targetMat); ModelHelper.registerItem(item, i, itemName + targetName);
Object sourceMaterial = IronChestType.translateOreName(sourceMat); }
IronChestType.addRecipe(new ItemStack(item), recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', "blockGlass", 'O', Blocks.obsidian); }
} return item;
} }
}
public static void buildItems() public void addRecipes() {
{ Object sourceMaterial = this.source.toObject();
for (ChestChangerType type : values()) Object targetMaterial = this.upgradeChain[0].toObject();
{ IronChestType.addRecipe(new ItemStack(item), recipe[0], 's', sourceMaterial, 't', targetMaterial, 'G', "blockGlass", 'O', Blocks.obsidian);
type.buildItem(); for (int i = 1; i < this.upgradeChain.length; i ++) {
} targetMaterial = this.upgradeChain[i].toObject();
} IronChestType.addRecipe(new ItemStack(item, 1, i), recipe[i], 's', new ItemStack(this.item, 1, i - 1), 't', targetMaterial, 'G', "blockGlass", 'O', Blocks.obsidian);
}
}
public static void generateRecipes() public static void buildItems() {
{ for (ChestChangerType type : values()) {
for (ChestChangerType item : values()) type.buildItem();
{ }
item.addRecipes(); }
}
} public static void generateRecipes() {
for (ChestChangerType item : values()) {
item.addRecipes();
}
}
} }

View File

@ -10,14 +10,7 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderFireball;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
@ -25,12 +18,7 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[11.15.0,12.0]", acceptedMinecraftVersions="[1.8,1.8.9]") @Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[11.15.0,12.0]", acceptedMinecraftVersions="[1.8,1.8.9]")
public class IronChest public class IronChest

View File

@ -26,18 +26,19 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
public enum IronChestType implements IStringSerializable public enum IronChestType implements IStringSerializable
{ {
IRON(54, 9, true, "Iron Chest", "ironchest.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"), 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"), 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"), 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"), 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"), 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"), 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"), 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"), 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); WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
int size; int size;
private int rowLength; private int rowLength;
public String friendlyName; public String friendlyName;
public String tierName;
private boolean tieredChest; private boolean tieredChest;
private String modelTexture; private String modelTexture;
private int textureRow; private int textureRow;
@ -58,6 +59,7 @@ public enum IronChestType implements IStringSerializable
this.rowLength = rowLength; this.rowLength = rowLength;
this.tieredChest = tieredChest; this.tieredChest = tieredChest;
this.friendlyName = friendlyName; this.friendlyName = friendlyName;
this.tierName = friendlyName.replace(" Chest", "").replace(" 9000", "");
this.modelTexture = modelTexture; this.modelTexture = modelTexture;
this.textureRow = textureRow; this.textureRow = textureRow;
this.clazz = clazz; this.clazz = clazz;

View File

@ -0,0 +1,33 @@
package cpw.mods.ironchest;
import net.minecraft.init.Blocks;
public enum IronChestTypeSimple {
IRON("ingotIron"),
GOLD("ingotGold"),
DIAMOND("gemDiamond"),
COPPER("ingotCopper"),
SILVER("ingotSilver"),
CRYSTAL("blockGlass"),
OBSIDIAN("obsidian"),
DIRTCHEST9000("dirt"),
WOOD("plankWood");
private String material;
IronChestTypeSimple(String material) {
this.material = material;
}
public String getMaterial() { return this.material; }
public Object toObject() {
if (this == OBSIDIAN) return Blocks.obsidian;
if (this == DIRTCHEST9000) return Blocks.dirt;
return this.material;
}
public String getName() {
return name().toLowerCase();
}
}

View File

@ -10,7 +10,10 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import java.util.List;
import net.minecraft.block.BlockChest; import net.minecraft.block.BlockChest;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -20,88 +23,88 @@ import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemChestChanger extends Item public class ItemChestChanger extends Item {
{ private ChestChangerType type;
private ChestChangerType type;
public ItemChestChanger(ChestChangerType type) public ItemChestChanger(ChestChangerType type) {
{ this.type = type;
this.type = type;
this.setMaxStackSize(1); this.setHasSubtypes(true);
this.setUnlocalizedName("ironchest:" + type.name()); this.setMaxStackSize(1);
this.setCreativeTab(CreativeTabs.tabMisc); this.setUnlocalizedName("ironchest:" + type.name());
} this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override @Override public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onItemUseFirst (ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) if (world.isRemote) return false;
{ if (this.type.canUpgrade(IronChestTypeSimple.WOOD)) {
if (world.isRemote) if (!(world.getBlockState(pos).getBlock() instanceof BlockChest)) { return false; }
return false; } else {
if(this.type.canUpgrade(IronChestType.WOOD)){ if (world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())) { return false; }
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){ }
return false; TileEntity te = world.getTileEntity(pos);
} TileEntityIronChest newchest = new TileEntityIronChest();
}else{ ItemStack[] chestContents = new ItemStack[27];
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){ int chestFacing = 0;
return false; if (te != null) {
} if (te instanceof TileEntityIronChest) {
} chestContents = ((TileEntityIronChest) te).chestContents;
TileEntity te = world.getTileEntity(pos); chestFacing = ((TileEntityIronChest) te).getFacing();
TileEntityIronChest newchest = new TileEntityIronChest(); newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal(), stack.getItemDamage()));
ItemStack[] chestContents = new ItemStack[27]; if (newchest == null) return false;
if (te != null) } else if (te instanceof TileEntityChest) {
{ IBlockState chestState = world.getBlockState(pos);
if (te instanceof TileEntityIronChest) EnumFacing facing = chestState.getValue(BlockChest.FACING);
{ if (facing == EnumFacing.NORTH) chestFacing = 2;
chestContents = ((TileEntityIronChest) te).chestContents; if (facing == EnumFacing.EAST) chestFacing = 5;
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal())); if (facing == EnumFacing.SOUTH) chestFacing = 3;
if (newchest == null) if (facing == EnumFacing.WEST) chestFacing = 4;
return false; if (((TileEntityChest) te).numPlayersUsing > 0) return false;
} if (!getType().canUpgrade(IronChestTypeSimple.WOOD)) return false;
else if (te instanceof TileEntityChest) chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
{ for (int i = 0; i < chestContents.length; i ++)
if (((TileEntityChest) te).numPlayersUsing > 0) chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
return false; newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal(), stack.getItemDamage()));
if (!getType().canUpgrade(IronChestType.WOOD)) }
return false; }
chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
for (int i = 0; i < chestContents.length; i++)
chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
}
}
te.updateContainingBlockInfo(); te.updateContainingBlockInfo();
if (te instanceof TileEntityChest) if (te instanceof TileEntityChest) ((TileEntityChest) te).checkForAdjacentChests();
((TileEntityChest) te).checkForAdjacentChests();
world.removeTileEntity(pos); world.removeTileEntity(pos);
world.setBlockToAir(pos); world.setBlockToAir(pos);
world.setTileEntity(pos, newchest); world.setTileEntity(pos, newchest);
world.setBlockState(pos, IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal()), 3); world.setBlockState(pos, IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal()), 3);
world.markBlockForUpdate(pos); world.markBlockForUpdate(pos);
TileEntity te2 = world.getTileEntity(pos); TileEntity te2 = world.getTileEntity(pos);
if (te2 instanceof TileEntityIronChest) if (te2 instanceof TileEntityIronChest) {
{ ((TileEntityIronChest) te2).setContents(chestContents);
((TileEntityIronChest) te2).setContents(chestContents); ((TileEntityIronChest) te2).setFacing((byte) chestFacing);
} }
stack.stackSize = player.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1; stack.stackSize = player.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
return true; return true;
} }
public int getTargetChestOrdinal(int sourceOrdinal) @Override @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
{ for (int i = 0; i < this.type.upgradeChain.length; i ++) list.add(new ItemStack(item, 1, i));
return type.getTarget(); }
}
public ChestChangerType getType() @Override public String getUnlocalizedName(ItemStack stack) {
{ return super.getUnlocalizedName(stack) + "_" + this.type.getTargetName(stack.getItemDamage()).toUpperCase();
return type; }
}
public int getTargetChestOrdinal(int sourceOrdinal, int meta) {
return type.getTarget(meta);
}
public ChestChangerType getType() {
return type;
}
} }

View File

@ -10,35 +10,41 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.client; package cpw.mods.ironchest.client;
import net.minecraft.block.Block; import java.util.ArrayList;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ModelHelper public class ModelHelper {
{ public static void registerItemInternal(Item item, String[] registryNames, int[] registryMetas) {
public static void registerItem(Item item, int metadata, String itemName) if (registryNames.length != registryMetas.length) { return; }
{ ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); for (int i = 0; i < registryNames.length; i ++) {
mesher.register(item, metadata, new ModelResourceLocation(itemName, "inventory")); mesher.register(item, registryMetas[i], new ModelResourceLocation("ironchest:" + registryNames[i], "inventory"));
} }
}
public static void registerBlock(Block block, int metadata, String blockName) public static void registerItem(Item item, String[] registryNames, int[] registryMetas) {
{ ModelBakery.registerItemVariants(item, generateVariants(registryNames));
registerItem(Item.getItemFromBlock(block), metadata, blockName); registerItemInternal(item, registryNames, registryMetas);
} }
public static void registerBlock(Block block, String blockName) public static void registerItem(Item item, int meta, String registryName) {
{ registerItem(item, new String[] {registryName}, new int[] {meta});
registerBlock(block, 0, blockName); }
}
public static void registerItem(Item item, String itemName) static ResourceLocation[] generateVariants(String[] registryNames) {
{ ArrayList<ResourceLocation> ret = new ArrayList<ResourceLocation>();
registerItem(item, 0, itemName); for (String aString : registryNames) {
} ret.add(new ResourceLocation("ironchest", aString.contains("ironchest:") ? aString.replace("ironchest:", "") : aString));
}
return ret.toArray(new ResourceLocation[] {});
}
} }

View File

@ -7,15 +7,24 @@ tile.ironchest:CRYSTAL.name=Crystal Chest
tile.ironchest:OBSIDIAN.name=Obsidian Chest tile.ironchest:OBSIDIAN.name=Obsidian Chest
tile.ironchest:DIRTCHEST9000.name=DirtChest 9000! tile.ironchest:DIRTCHEST9000.name=DirtChest 9000!
item.ironchest:IRONGOLD.name=Iron to Gold Chest Upgrade item.ironchest:WOOD_UPGRADE_IRON.name=Wood to Iron Chest Upgrade
item.ironchest:GOLDDIAMOND.name=Gold to Diamond Chest Upgrade item.ironchest:WOOD_UPGRADE_GOLD.name=Wood to Gold Chest Upgrade
item.ironchest:COPPERSILVER.name=Copper to Silver Chest Upgrade item.ironchest:WOOD_UPGRADE_DIAMOND.name=Wood to Diamond Chest Upgrade
item.ironchest:SILVERGOLD.name=Silver to Gold Chest Upgrade item.ironchest:WOOD_UPGRADE_OBSIDIAN.name=Wood to Obsidian Chest Upgrade
item.ironchest:COPPERIRON.name=Copper to Iron Chest Upgrade item.ironchest:IRON_UPGRADE_GOLD.name=Iron to Gold Chest Upgrade
item.ironchest:DIAMONDCRYSTAL.name=Diamond to Crystal Chest Upgrade item.ironchest:IRON_UPGRADE_DIAMOND.name=Iron to Diamond Chest Upgrade
item.ironchest:WOODIRON.name=Wood to Iron Chest Upgrade item.ironchest:IRON_UPGRADE_OBSIDIAN.name=Iron to Obsidian Chest Upgrade
item.ironchest:WOODCOPPER.name=Wood to Copper Chest Upgrade item.ironchest:GOLD_UPGRADE_DIAMOND.name=Gold to Diamond Chest Upgrade
item.ironchest:DIAMONDOBSIDIAN.name=Diamond to Obsidian Chest Upgrade item.ironchest:GOLD_UPGRADE_OBSIDIAN.name=Gold to Obsidian Chest Upgrade
item.ironchest:DIAMOND_OBSIDIAN_UPGRADE_OBSIDIAN.name=Diamond to Obsidian Chest Upgrade
item.ironchest:DIAMOND_CRYSTAL_UPGRADE_CRYSTAL.name=Diamond to Crystal Chest Upgrade
item.ironchest:COPPER_UPGRADE_IRON.name=Copper to Iron Chest Upgrade
item.ironchest:COPPER_UPGRADE_GOLD.name=Copper to Gold Chest Upgrade
item.ironchest:COPPER_UPGRADE_DIAMOND.name=Copper to Diamond Chest Upgrade
item.ironchest:COPPER_UPGRADE_OBSIDIAN.name=Copper to Obsidian Chest Upgrade
item.ironchest:SILVER_UPGRADE_GOLD.name=Silver to Gold Chest Upgrade
item.ironchest:SILVER_UPGRADE_DIAMOND.name=Silver to Diamond Chest Upgrade
item.ironchest:SILVER_UPGRADE_OBSIDIAN.name=Silver to Obsidian Chest Upgrade
book.ironchest:dirtchest9000.title=How to use your DirtChest 9000! book.ironchest:dirtchest9000.title=How to use your DirtChest 9000!
book.ironchest:dirtchest9000.page1=Welcome to your new DirtChest 9000! We hope you will enjoy many happy years of storing your stack of dirt in our storage utility. book.ironchest:dirtchest9000.page1=Welcome to your new DirtChest 9000! We hope you will enjoy many happy years of storing your stack of dirt in our storage utility.

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/copperChest",
"layer1": "ironchest:items/diamondUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,7 +1,8 @@
{ {
"parent": "builtin/generated", "parent": "builtin/generated",
"textures": { "textures": {
"layer0": "ironchest:items/diamondObsidianUpgrade" "layer0": "ironchest:items/copperChest",
"layer1": "ironchest:items/goldUpgrade"
}, },
"display": { "display": {
"thirdperson": { "thirdperson": {

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/copperChest",
"layer1": "ironchest:items/ironUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/copperChest",
"layer1": "ironchest:items/obsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/diamondChest",
"layer1": "ironchest:items/crystalUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/diamondChest",
"layer1": "ironchest:items/obsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,18 +0,0 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/goldDiamondUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/goldChest",
"layer1": "ironchest:items/diamondUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/goldChest",
"layer1": "ironchest:items/obsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,18 +0,0 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/ironGoldUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/ironChest",
"layer1": "ironchest:items/diamondUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,7 +1,8 @@
{ {
"parent": "builtin/generated", "parent": "builtin/generated",
"textures": { "textures": {
"layer0": "ironchest:items/copperIronUpgrade" "layer0": "ironchest:items/ironChest",
"layer1": "ironchest:items/goldUpgrade"
}, },
"display": { "display": {
"thirdperson": { "thirdperson": {

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/ironChest",
"layer1": "ironchest:items/obsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,18 +0,0 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/silverGoldUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/silverChest",
"layer1": "ironchest:items/diamondUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/silverChest",
"layer1": "ironchest:items/goldUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/silverChest",
"layer1": "ironchest:items/obsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,18 +0,0 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/woodCopperUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,18 +0,0 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/woodIronUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/woodChest",
"layer1": "ironchest:items/diamondUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -1,7 +1,8 @@
{ {
"parent": "builtin/generated", "parent": "builtin/generated",
"textures": { "textures": {
"layer0": "ironchest:items/copperSilverUpgrade" "layer0": "ironchest:items/woodChest",
"layer1": "ironchest:items/goldUpgrade"
}, },
"display": { "display": {
"thirdperson": { "thirdperson": {

View File

@ -1,7 +1,8 @@
{ {
"parent": "builtin/generated", "parent": "builtin/generated",
"textures": { "textures": {
"layer0": "ironchest:items/diamondCrystalUpgrade" "layer0": "ironchest:items/woodChest",
"layer1": "ironchest:items/ironUpgrade"
}, },
"display": { "display": {
"thirdperson": { "thirdperson": {

View File

@ -0,0 +1,19 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/woodChest",
"layer1": "ironchest:items/obsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B