diff --git a/src/main/java/cpw/mods/ironchest/BlockIronChest.java b/src/main/java/cpw/mods/ironchest/BlockIronChest.java index 247ac0d..1ff40b0 100755 --- a/src/main/java/cpw/mods/ironchest/BlockIronChest.java +++ b/src/main/java/cpw/mods/ironchest/BlockIronChest.java @@ -4,22 +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; -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; @@ -37,17 +32,16 @@ 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; 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 VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class); protected static final AxisAlignedBB IRON_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); @@ -55,6 +49,7 @@ public class BlockIronChest extends BlockContainer public BlockIronChest() { super(Material.IRON); + this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "BlockIronChest")); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON)); @@ -114,16 +109,22 @@ public class BlockIronChest extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int metadata) + public boolean hasTileEntity(IBlockState state) { - return IronChestType.makeEntity(metadata); + return true; + } + + @Override + public TileEntity createTileEntity(World world, IBlockState state) + { + return state.getValue(VARIANT_PROP).makeEntity(); } @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { - for (IronChestType type : IronChestType.values()) + for (IronChestType type : IronChestType.VALUES) { if (type.isValidForCreativeMode()) { @@ -135,7 +136,7 @@ public class BlockIronChest extends BlockContainer @Override public IBlockState getStateFromMeta(int meta) { - return this.getDefaultState().withProperty(VARIANT_PROP, IronChestType.values()[meta]); + return this.getDefaultState().withProperty(VARIANT_PROP, IronChestType.VALUES[meta]); } @Override @@ -147,17 +148,7 @@ public class BlockIronChest extends BlockContainer @Override protected BlockStateContainer createBlockState() { - return new BlockStateContainer(this, new IProperty[] { VARIANT_PROP }); - } - - @Override - public ArrayList getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) - { - ArrayList items = Lists.newArrayList(); - ItemStack stack = new ItemStack(this, 1, this.getMetaFromState(state)); - IronChestType.values()[IronChestType.validateMeta(this.getMetaFromState(state))].adornItemDrop(stack); - items.add(stack); - return items; + return new BlockStateContainer(this, VARIANT_PROP); } @Override @@ -170,30 +161,12 @@ public class BlockIronChest extends BlockContainer @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack) { - byte chestFacing = 0; - int facing = MathHelper.floor_double((entityliving.rotationYaw * 4F) / 360F + 0.5D) & 3; - if (facing == 0) - { - chestFacing = 2; - } - if (facing == 1) - { - chestFacing = 5; - } - if (facing == 2) - { - chestFacing = 3; - } - if (facing == 3) - { - chestFacing = 4; - } TileEntity te = world.getTileEntity(pos); if (te != null && te instanceof TileEntityIronChest) { TileEntityIronChest teic = (TileEntityIronChest) te; teic.wasPlaced(entityliving, itemStack); - teic.setFacing(chestFacing); + teic.setFacing(entityliving.getHorizontalFacing().getOpposite()); world.notifyBlockUpdate(pos, blockState, blockState, 3); } } @@ -201,7 +174,7 @@ public class BlockIronChest extends BlockContainer @Override public int damageDropped(IBlockState state) { - return IronChestType.validateMeta(state.getValue(VARIANT_PROP).ordinal()); + return state.getValue(VARIANT_PROP).ordinal(); } @Override @@ -268,22 +241,6 @@ public class BlockIronChest extends BlockContainer return super.getExplosionResistance(world, pos, exploder, explosion); } - @Override - @SideOnly(Side.CLIENT) - public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) - { - IronChestTextureHandler.addHitEffects(worldObj, target.getBlockPos(), target.sideHit); - return true; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) - { - IronChestTextureHandler.addDestroyEffects(world, pos, world.getBlockState(pos)); - return true; - } - @Override public boolean hasComparatorInputOverride(IBlockState state) { @@ -328,4 +285,12 @@ public class BlockIronChest extends BlockContainer } return false; } -} \ No newline at end of file + + @Override + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { + super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam); + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam); + } +} diff --git a/src/main/java/cpw/mods/ironchest/ChestChangerType.java b/src/main/java/cpw/mods/ironchest/ChestChangerType.java index 593715a..7990020 100755 --- a/src/main/java/cpw/mods/ironchest/ChestChangerType.java +++ b/src/main/java/cpw/mods/ironchest/ChestChangerType.java @@ -1,7 +1,7 @@ /******************************************************************************* * 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; @@ -15,78 +15,58 @@ 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 - private IronChestType source; - private IronChestType target; - public String itemName; - public String descriptiveName; + public static final ChestChangerType[] VALUES = values(); + + public final IronChestType source; + public final IronChestType target; + public final String itemName; 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; } - public IronChestType getSource() - { - return this.source; - } - public boolean canUpgrade(IronChestType from) { return from == this.source; } - - public int getTarget() - { - return this.target.ordinal(); - } - + 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 +79,7 @@ public enum ChestChangerType public static void buildItems() { - for (ChestChangerType type : values()) + for (ChestChangerType type : VALUES) { type.buildItem(); } @@ -107,7 +87,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 void registerTileEntitySpecialRenderer(Class typ) - { - } @Override @@ -48,10 +42,4 @@ public class CommonProxy implements IGuiHandler return null; } } - - public World getClientWorld() - { - return null; - } - -} +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/ContainerIronChest.java b/src/main/java/cpw/mods/ironchest/ContainerIronChest.java index 5c55cfe..b69fea3 100755 --- a/src/main/java/cpw/mods/ironchest/ContainerIronChest.java +++ b/src/main/java/cpw/mods/ironchest/ContainerIronChest.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; @@ -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..1b507ec 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 clazz; - private String[] recipes; - private ArrayList matList; - private Item itemFilter; - IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String modelTexture, int textureRow, List mats, - Class clazz, String... recipes) - { - this(size, rowLength, tieredChest, friendlyName, modelTexture, textureRow, mats, clazz, (Item) null, recipes); - } + public static final IronChestType VALUES[] = values(); - IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String modelTexture, int textureRow, List mats, - Class clazz, Item itemFilter, String... recipes) + public final String name; + public final int size; + public final int rowLength; + public final boolean tieredChest; + public final ResourceLocation modelTexture; + private String breakTexture; + public final Class clazz; + public final Collection recipes; + public final Collection matList; + + IronChestType(int size, int rowLength, boolean tieredChest, String modelTexture, Collection mats, Class clazz, + String... recipes) { + this.name = this.name().toLowerCase(); this.size = size; this.rowLength = rowLength; this.tieredChest = tieredChest; - this.friendlyName = friendlyName; - this.modelTexture = modelTexture; - this.textureRow = textureRow; + this.modelTexture = new ResourceLocation("ironchest", "textures/model/" + modelTexture); + this.matList = Collections.unmodifiableCollection(mats); this.clazz = clazz; - this.itemFilter = itemFilter; - this.recipes = recipes; - this.matList = new ArrayList(); - this.matList.addAll(mats); + this.recipes = Collections.unmodifiableCollection(Arrays.asList(recipes)); + } + + public String getBreakTexture() + { + if (this.breakTexture == null) + { + switch (this) + { + case DIRTCHEST9000: + { + this.breakTexture = "minecraft:blocks/dirt"; + } + case OBSIDIAN: + { + this.breakTexture = "minecraft:blocks/obsidian"; + } + default: + { + this.breakTexture = "ironchest:blocks/" + this.getName() + "break"; + } + } + } + + return this.breakTexture; } @Override public String getName() { - return this.name().toLowerCase(); - } - - public String getModelTexture() - { - return this.modelTexture; - } - - public int getTextureRow() - { - return this.textureRow; - } - - public static TileEntityIronChest makeEntity(int metadata) - { - // Compatibility - int chesttype = validateMeta(metadata); - if (chesttype == metadata) - { - try - { - TileEntityIronChest te = values()[chesttype].clazz.newInstance(); - return te; - } - catch (InstantiationException e) - { - // unpossible - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - // unpossible - e.printStackTrace(); - } - } - return null; + return this.name; } public static void registerBlocksAndRecipes(BlockIronChest blockResult) @@ -136,15 +119,12 @@ public enum IronChestType implements IStringSerializable { mainMaterial = translateOreName(mat); //@formatter:off - addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit, - 'm', mainMaterial, 'P', previousTier, /* previous tier of chest */ - 'G', "blockGlass", 'C', "chestWood", - '0', new ItemStack(blockResult, 1, 0), /* Iron Chest */ + addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit, 'm', mainMaterial, 'P', previousTier, /* previous tier of chest */ + 'G', "blockGlass", 'C', "chestWood", '0', new ItemStack(blockResult, 1, 0), /* Iron Chest */ '1', new ItemStack(blockResult, 1, 1), /* Gold Chest */ '2', new ItemStack(blockResult, 1, 2), /* Diamond Chest */ '3', new ItemStack(blockResult, 1, 3), /* Copper Chest */ - '4', new ItemStack(blockResult, 1, 4) /* Silver Chest */ - ); + '4', new ItemStack(blockResult, 1, 4) /* Silver Chest */); //@formatter:on } } @@ -174,36 +154,14 @@ public enum IronChestType implements IStringSerializable return this.size / this.rowLength; } - public int getRowLength() - { - return this.rowLength; - } - public boolean isTransparent() { return this == CRYSTAL; } - public List getMatList() - { - return this.matList; - } - - public static int validateMeta(int i) - { - if (i < values().length && values()[i].size > 0) - { - return i; - } - else - { - return 0; - } - } - public boolean isValidForCreativeMode() { - return validateMeta(this.ordinal()) == this.ordinal(); + return this != WOOD; } public boolean isExplosionResistant() @@ -216,9 +174,16 @@ public enum IronChestType implements IStringSerializable return new ValidatingSlot(chestInventory, index, x, y, this); } + private static final Item DIRT_ITEM = Item.getItemFromBlock(Blocks.DIRT); + public boolean acceptsStack(ItemStack itemstack) { - return this.itemFilter == null || itemstack == null || itemstack.getItem() == this.itemFilter; + if (this == DIRTCHEST9000) + { + return itemstack == null || itemstack.getItem() == DIRT_ITEM; + } + + return true; } public void adornItemDrop(ItemStack item) @@ -228,4 +193,29 @@ public enum IronChestType implements IStringSerializable item.setTagInfo("dirtchest", new NBTTagByte((byte) 1)); } } + + public TileEntityIronChest makeEntity() + { + switch (this) + { + case IRON: + return new TileEntityIronChest(); + case GOLD: + return new TileEntityGoldChest(); + case DIAMOND: + return new TileEntityDiamondChest(); + case COPPER: + return new TileEntityCopperChest(); + case SILVER: + return new TileEntitySilverChest(); + case CRYSTAL: + return new TileEntityCrystalChest(); + case OBSIDIAN: + return new TileEntityObsidianChest(); + case DIRTCHEST9000: + return new TileEntityDirtChest(); + default: + return null; + } + } } \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/ItemChestChanger.java b/src/main/java/cpw/mods/ironchest/ItemChestChanger.java index 62cd8bd..8f79c8f 100755 --- a/src/main/java/cpw/mods/ironchest/ItemChestChanger.java +++ b/src/main/java/cpw/mods/ironchest/ItemChestChanger.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; @@ -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); @@ -56,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; } @@ -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.target.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.target.makeEntity(); } } @@ -123,7 +108,7 @@ public class ItemChestChanger extends Item worldIn.removeTileEntity(pos); worldIn.setBlockToAir(pos); - IBlockState iblockstate = IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal()); + IBlockState iblockstate = IronChest.ironChestBlock.getDefaultState().withProperty(BlockIronChest.VARIANT_PROP, type.target); worldIn.setTileEntity(pos, newchest); worldIn.setBlockState(pos, iblockstate, 3); @@ -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..25a7eb3 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()].name(); } } 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..9d56e9b 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,38 +22,34 @@ 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(chestItem.getRegistryName(), "variant=" + type.getName())); } + + ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer()); } - } - @Override - public void registerTileEntitySpecialRenderer(Class type) - { - ClientRegistry.bindTileEntitySpecialRenderer(type, new TileEntityIronChestRenderer(type)); - } - - @Override - public World getClientWorld() - { - return FMLClientHandler.instance().getClient().theWorld; + for (ChestChangerType type : ChestChangerType.VALUES) + { + ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "ItemChestUpgrade"), "variant=" + type.itemName.toLowerCase())); + } } @Override diff --git a/src/main/java/cpw/mods/ironchest/client/GUIChest.java b/src/main/java/cpw/mods/ironchest/client/GUIChest.java index 1371aa3..ae8f205 100755 --- a/src/main/java/cpw/mods/ironchest/client/GUIChest.java +++ b/src/main/java/cpw/mods/ironchest/client/GUIChest.java @@ -4,18 +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 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 deleted file mode 100644 index bb11053..0000000 --- a/src/main/java/cpw/mods/ironchest/client/IronChestTextureHandler.java +++ /dev/null @@ -1,139 +0,0 @@ -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.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.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class IronChestTextureHandler -{ - private static Map locations; - - static - { - Builder builder = ImmutableMap. builder(); - for (IronChestType typ : IronChestType.values()) - { - if (typ != IronChestType.DIRTCHEST9000 && typ != IronChestType.OBSIDIAN) - builder.put(typ, new ResourceLocation("ironchest", "blocks/" + typ.getModelTexture().replace("chest", "break").replace(".png", ""))); - else if (typ == IronChestType.DIRTCHEST9000) - builder.put(typ, new ResourceLocation("minecraft", "blocks/dirt")); - else if (typ == IronChestType.OBSIDIAN) - builder.put(typ, new ResourceLocation("minecraft", "blocks/obsidian")); - } - locations = builder.build(); - } - - 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 = IronChestType.values()[IronChestType.validateMeta(block.getMetaFromState(state))]; - 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); - - if (type != IronChestType.DIRTCHEST9000 && type != IronChestType.OBSIDIAN) - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("ironchest:" + locations.get(type).getResourcePath())); - else if (type == IronChestType.DIRTCHEST9000) - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath())); - else if (type == IronChestType.OBSIDIAN) - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath())); - } - } - - public static void addDestroyEffects(World world, BlockPos pos, IBlockState state) - { - state = state.getBlock().getActualState(state, world, pos); - int i = 4; - IronChestType type = IronChestType.values()[IronChestType.validateMeta(state.getBlock().getMetaFromState(state))]; - 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); - if (type != IronChestType.DIRTCHEST9000 && type != IronChestType.OBSIDIAN) - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("ironchest:" + locations.get(type).getResourcePath())); - else if (type == IronChestType.DIRTCHEST9000) - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath())); - else if (type == IronChestType.OBSIDIAN) - fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath())); - } - } - } - } -} diff --git a/src/main/java/cpw/mods/ironchest/client/ModelHelper.java b/src/main/java/cpw/mods/ironchest/client/ModelHelper.java deleted file mode 100644 index 645208b..0000000 --- a/src/main/java/cpw/mods/ironchest/client/ModelHelper.java +++ /dev/null @@ -1,44 +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.client; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemModelMesher; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class ModelHelper -{ - public static void registerItem(Item item, int metadata, String itemName) - { - ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); - mesher.register(item, metadata, new ModelResourceLocation(itemName, "inventory")); - } - - public static void registerBlock(Block block, int metadata, String blockName) - { - registerItem(Item.getItemFromBlock(block), metadata, blockName); - } - - public static void registerBlock(Block block, String blockName) - { - registerBlock(block, 0, blockName); - } - - public static void registerItem(Item item, String itemName) - { - registerItem(item, 0, itemName); - } -} diff --git a/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java b/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java index 551d878..3ec792a 100755 --- a/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java +++ b/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java @@ -4,17 +4,14 @@ * 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.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 extends TileEntitySpecialRenderer +public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { - private static Map locations; - - static - { - Builder builder = ImmutableMap. builder(); - for (IronChestType typ : IronChestType.values()) - { - builder.put(typ, new ResourceLocation("ironchest", "textures/model/" + typ.getModelTexture())); - } - locations = builder.build(); - } - private Random random; private RenderEntityItem itemRenderer; private ModelChest model; private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F }, { 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F }, }; + private static EntityItem customitem = new EntityItem(null); + private static float halfPI = (float) (Math.PI / 2D); - public TileEntityIronChestRenderer(Class type) + public TileEntityIronChestRenderer() { this.model = new ModelChest(); this.random = new Random(); - this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) { - @Override - public int getModelCount(ItemStack stack) - { - return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1); - } - - @Override - public boolean shouldBob() - { - return false; - } - - @Override - public boolean shouldSpreadItems() - { - return false; - } - }; } - public void render(TileEntityIronChest tile, double x, double y, double z, float partialTick, int breakStage) + @Override + public void renderTileEntityAt(TileEntityIronChest tile, double x, double y, double z, float partialTick, int breakStage) { - if (tile == null) + if (tile == null || tile.isInvalid()) { return; } - int facing = 3; + + EnumFacing facing = EnumFacing.SOUTH; IronChestType type = tile.getType(); - if (tile != null && tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock) + if (tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock) { facing = tile.getFacing(); - type = tile.getType(); IBlockState state = tile.getWorld().getBlockState(tile.getPos()); type = state.getValue(BlockIronChest.VARIANT_PROP); } @@ -99,46 +68,59 @@ public class TileEntityIronChestRenderer extends this.bindTexture(DESTROY_STAGES[breakStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); - GlStateManager.scale(4.0F, 4.0F, 1.0F); + GlStateManager.scale(4F, 4F, 1F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else { - this.bindTexture(locations.get(type)); + this.bindTexture(type.modelTexture); } GlStateManager.pushMatrix(); if (type == IronChestType.CRYSTAL) { GlStateManager.disableCull(); } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F); - GlStateManager.scale(1.0F, -1F, -1F); + GlStateManager.color(1F, 1F, 1F, 1F); + GlStateManager.translate((float) x, (float) y + 1F, (float) z + 1F); + GlStateManager.scale(1F, -1F, -1F); GlStateManager.translate(0.5F, 0.5F, 0.5F); - int k = 0; - if (facing == 2) + + switch (facing) { - k = 180; - } - if (facing == 3) + case NORTH: { - k = 0; + GlStateManager.rotate(180F, 0F, 1F, 0F); + break; } - if (facing == 4) + case SOUTH: { - k = 90; + GlStateManager.rotate(0F, 0F, 1F, 0F); + break; } - if (facing == 5) + case WEST: { - k = -90; + GlStateManager.rotate(90F, 0F, 1F, 0F); + break; } - GlStateManager.rotate(k, 0.0F, 1.0F, 0.0F); + case EAST: + { + GlStateManager.rotate(270F, 0F, 1F, 0F); + break; + } + } + GlStateManager.translate(-0.5F, -0.5F, -0.5F); float lidangle = tile.prevLidAngle + (tile.lidAngle - tile.prevLidAngle) * partialTick; - lidangle = 1.0F - lidangle; - lidangle = 1.0F - lidangle * lidangle * lidangle; - this.model.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F); + lidangle = 1F - lidangle; + lidangle = 1F - lidangle * lidangle * lidangle; + + if (type.isTransparent()) + { + GlStateManager.scale(1F, 0.99F, 1F); + } + + this.model.chestLid.rotateAngleX = -lidangle * halfPI; // Render the chest itself this.model.renderAll(); if (breakStage >= 0) @@ -152,7 +134,7 @@ public class TileEntityIronChestRenderer extends GlStateManager.enableCull(); } GlStateManager.popMatrix(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.color(1F, 1F, 1F, 1F); if (type.isTransparent() && tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d) @@ -163,7 +145,7 @@ public class TileEntityIronChestRenderer extends float shiftZ; int shift = 0; float blockScale = 0.70F; - float timeD = (float) (360.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); + float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTick; if (tile.getTopItemStacks()[1] == null) { shift = 8; @@ -171,8 +153,9 @@ public class TileEntityIronChestRenderer extends } GlStateManager.pushMatrix(); GlStateManager.translate((float) x, (float) y, (float) z); - EntityItem customitem = new EntityItem(this.getWorld()); - customitem.hoverStart = 0f; + + customitem.setWorld(this.getWorld()); + customitem.hoverStart = 0F; for (ItemStack item : tile.getTopItemStacks()) { if (shift > shifts.length) @@ -190,19 +173,39 @@ public class TileEntityIronChestRenderer extends shift++; GlStateManager.pushMatrix(); GlStateManager.translate(shiftX, shiftY, shiftZ); - GlStateManager.rotate(timeD, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(timeD, 0F, 1F, 0F); GlStateManager.scale(blockScale, blockScale, blockScale); customitem.setEntityItemStack(item); - this.itemRenderer.doRender(customitem, 0, 0, 0, 0, 0); + + if (this.itemRenderer == null) + { + this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) { + @Override + public int getModelCount(ItemStack stack) + { + return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1); + } + + @Override + public boolean shouldBob() + { + return false; + } + + @Override + public boolean shouldSpreadItems() + { + return true; + } + }; + } + + this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTick); GlStateManager.popMatrix(); } + GlStateManager.popMatrix(); } - } - @Override - public void renderTileEntityAt(TileEntityIronChest tileentity, double x, double y, double z, float partialTick, int breakStage) - { - this.render(tileentity, x, y, z, partialTick, breakStage); } } diff --git a/src/main/resources/assets/ironchest/blockstates/BlockIronChest.json b/src/main/resources/assets/ironchest/blockstates/BlockIronChest.json new file mode 100644 index 0000000..f006699 --- /dev/null +++ b/src/main/resources/assets/ironchest/blockstates/BlockIronChest.json @@ -0,0 +1,59 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "ironchest:chest", + "transform": "forge:default-block" + }, + "variants": { + "variant": { + "iron": { + "textures": { + "particle": "ironchest:blocks/ironbreak", + "texture": "ironchest:model/ironchest" + } + }, + "gold": { + "textures": { + "particle": "ironchest:blocks/goldbreak", + "texture": "ironchest:model/goldchest" + } + }, + "diamond": { + "textures": { + "particle": "ironchest:blocks/diamondbreak", + "texture": "ironchest:model/diamondchest" + } + }, + "copper": { + "textures": { + "particle": "ironchest:blocks/copperbreak", + "texture": "ironchest:model/copperchest" + } + }, + "silver": { + "textures": { + "particle": "ironchest:blocks/silverbreak", + "texture": "ironchest:model/silverchest" + } + }, + "crystal": { + "textures": { + "particle": "ironchest:blocks/crystalbreak", + "texture": "ironchest:model/crystalchest" + } + }, + "obsidian": { + "textures": { + "particle": "minecraft:blocks/obsidian", + "texture": "ironchest:model/obsidianchest" + } + }, + "dirtchest9000": { + "textures": { + "particle": "minecraft:blocks/dirt", + "texture": "ironchest:model/dirtchest" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ironchest/blockstates/ItemChestUpgrade.json b/src/main/resources/assets/ironchest/blockstates/ItemChestUpgrade.json new file mode 100644 index 0000000..108e2ba --- /dev/null +++ b/src/main/resources/assets/ironchest/blockstates/ItemChestUpgrade.json @@ -0,0 +1,61 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "builtin/generated", + "transform": "forge:default-item" + }, + "variants": { + "variant": { + "irongoldupgrade": { + "textures": { + "layer0": "ironchest:items/ironGoldUpgrade" + } + }, + "coppersilverupgrade": { + "textures": { + "layer0": "ironchest:items/copperSilverUpgrade" + } + }, + "diamondcrystalupgrade": { + "textures": { + "layer0": "ironchest:items/diamondCrystalUpgrade" + } + }, + "diamondobsidianupgrade": { + "textures": { + "layer0": "ironchest:items/diamondObsidianUpgrade" + } + }, + "golddiamondupgrade": { + "textures": { + "layer0": "ironchest:items/goldDiamondUpgrade" + } + }, + "irongoldupgrade": { + "textures": { + "layer0": "ironchest:items/ironGoldUpgrade" + } + }, + "silvergoldupgrade": { + "textures": { + "layer0": "ironchest:items/silverGoldUpgrade" + } + }, + "woodcopperupgrade": { + "textures": { + "layer0": "ironchest:items/woodCopperUpgrade" + } + }, + "woodironupgrade": { + "textures": { + "layer0": "ironchest:items/woodIronUpgrade" + } + }, + "copperironupgrade": { + "textures": { + "layer0": "ironchest:items/copperIronUpgrade" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ironchest/models/item/chest_copper.json b/src/main/resources/assets/ironchest/models/block/chest.json old mode 100755 new mode 100644 similarity index 98% rename from src/main/resources/assets/ironchest/models/item/chest_copper.json rename to src/main/resources/assets/ironchest/models/block/chest.json index 8b6638e..eba0514 --- a/src/main/resources/assets/ironchest/models/item/chest_copper.json +++ b/src/main/resources/assets/ironchest/models/block/chest.json @@ -1,41 +1,41 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/copperchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} +{ + "parent": "block/block", + "textures": { + "texture": "ironchest:model/copperchest" + }, + "elements": [ + { "from": [ 1, 0, 1 ], + "to": [ 15, 10, 15 ], + "faces": { + "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, + "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, + "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, + "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, + "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, + "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } + } + }, + { "from": [ 1, 9, 1 ], + "to": [ 15, 14, 15 ], + "faces": { + "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, + "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, + "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, + "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, + "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, + "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } + } + }, + { "from": [ 7, 7, 0 ], + "to": [ 9, 11, 1 ], + "faces": { + "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, + "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, + "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, + "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, + "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, + "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } + } + } + ] +} diff --git a/src/main/resources/assets/ironchest/models/item/chest_crystal.json b/src/main/resources/assets/ironchest/models/item/chest_crystal.json deleted file mode 100755 index 6c4ed79..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_crystal.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/crystalchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/chest_diamond.json b/src/main/resources/assets/ironchest/models/item/chest_diamond.json deleted file mode 100755 index 98b5191..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_diamond.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/diamondchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/chest_dirtchest9000.json b/src/main/resources/assets/ironchest/models/item/chest_dirtchest9000.json deleted file mode 100755 index 8dd5307..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_dirtchest9000.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/dirtchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/chest_gold.json b/src/main/resources/assets/ironchest/models/item/chest_gold.json deleted file mode 100755 index cd7785e..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_gold.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/goldchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/chest_iron.json b/src/main/resources/assets/ironchest/models/item/chest_iron.json deleted file mode 100755 index 1fc4688..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_iron.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/ironchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/chest_obsidian.json b/src/main/resources/assets/ironchest/models/item/chest_obsidian.json deleted file mode 100755 index 17ca991..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_obsidian.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/obsidianchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/chest_silver.json b/src/main/resources/assets/ironchest/models/item/chest_silver.json deleted file mode 100755 index ea0ceab..0000000 --- a/src/main/resources/assets/ironchest/models/item/chest_silver.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "texture": "ironchest:model/silverchest" - }, - "elements": [ - { "from": [ 1, 0, 1 ], - "to": [ 15, 10, 15 ], - "faces": { - "down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" } - } - }, - { "from": [ 1, 9, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" }, - "up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" }, - "north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" }, - "south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" }, - "west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" }, - "east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" } - } - }, - { "from": [ 7, 7, 0 ], - "to": [ 9, 11, 1 ], - "faces": { - "down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" }, - "north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" }, - "south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" }, - "west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" }, - "east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" } - } - } - ] -} diff --git a/src/main/resources/assets/ironchest/models/item/copperIronUpgrade.json b/src/main/resources/assets/ironchest/models/item/copperIronUpgrade.json deleted file mode 100644 index 3ef545e..0000000 --- a/src/main/resources/assets/ironchest/models/item/copperIronUpgrade.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "ironchest:items/copperIronUpgrade" - }, - "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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/copperSilverUpgrade.json b/src/main/resources/assets/ironchest/models/item/copperSilverUpgrade.json deleted file mode 100755 index 0194165..0000000 --- a/src/main/resources/assets/ironchest/models/item/copperSilverUpgrade.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "ironchest:items/copperSilverUpgrade" - }, - "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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/diamondCrystalUpgrade.json b/src/main/resources/assets/ironchest/models/item/diamondCrystalUpgrade.json deleted file mode 100644 index 846f6e9..0000000 --- a/src/main/resources/assets/ironchest/models/item/diamondCrystalUpgrade.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "ironchest:items/diamondCrystalUpgrade" - }, - "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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/diamondObsidianUpgrade.json b/src/main/resources/assets/ironchest/models/item/diamondObsidianUpgrade.json deleted file mode 100644 index 04e94ba..0000000 --- a/src/main/resources/assets/ironchest/models/item/diamondObsidianUpgrade.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "ironchest:items/diamondObsidianUpgrade" - }, - "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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/goldDiamondUpgrade.json b/src/main/resources/assets/ironchest/models/item/goldDiamondUpgrade.json deleted file mode 100755 index 0a0e626..0000000 --- a/src/main/resources/assets/ironchest/models/item/goldDiamondUpgrade.json +++ /dev/null @@ -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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/ironGoldUpgrade.json b/src/main/resources/assets/ironchest/models/item/ironGoldUpgrade.json deleted file mode 100755 index 4579f8a..0000000 --- a/src/main/resources/assets/ironchest/models/item/ironGoldUpgrade.json +++ /dev/null @@ -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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/silverGoldUpgrade.json b/src/main/resources/assets/ironchest/models/item/silverGoldUpgrade.json deleted file mode 100755 index 62351b2..0000000 --- a/src/main/resources/assets/ironchest/models/item/silverGoldUpgrade.json +++ /dev/null @@ -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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/woodCopperUpgrade.json b/src/main/resources/assets/ironchest/models/item/woodCopperUpgrade.json deleted file mode 100644 index 51918f7..0000000 --- a/src/main/resources/assets/ironchest/models/item/woodCopperUpgrade.json +++ /dev/null @@ -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 ] - } - } -} diff --git a/src/main/resources/assets/ironchest/models/item/woodIronUpgrade.json b/src/main/resources/assets/ironchest/models/item/woodIronUpgrade.json deleted file mode 100644 index 84e149d..0000000 --- a/src/main/resources/assets/ironchest/models/item/woodIronUpgrade.json +++ /dev/null @@ -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 ] - } - } -}