Update IronChests to 1.9!

This commit is contained in:
Alexander 2016-03-21 12:44:27 -04:00
parent c4d5a5631f
commit 2b95aab95f
35 changed files with 512 additions and 440 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
build/
.classpath
.project
/*.launch
.gradle/
eclipse/
bin/

View File

@ -35,8 +35,8 @@ archivesBaseName = "ironchest"
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
minecraft {
version = "1.8.9-11.15.0.1689"
mappings = "stable_20"
version = "1.9-12.16.0.1781-1.9"
mappings = "snapshot_20160319"
runDir = "run"
}

View File

@ -6,12 +6,12 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* A marker for containers that have a chest-like persistant storage component. Enables the Inventroy Tweaks sorting
* buttons for this container.
* A marker for containers that have a chest-like persistant storage component. Enables the Inventroy Tweaks sorting buttons for this container.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ChestContainer {
public @interface ChestContainer
{
// Set to true if the Inventory Tweaks sorting buttons should be shown for this container.
boolean showButtons() default true;
@ -26,13 +26,15 @@ public @interface ChestContainer {
// Signature int func()
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface RowSizeCallback {
public @interface RowSizeCallback
{
}
// Annotation for method to get size of a chest row if it is not a fixed size for this container class
// Signature int func()
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface IsLargeCallback {
public @interface IsLargeCallback
{
}
}

View File

@ -14,11 +14,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Lists;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
@ -31,20 +33,21 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
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;
import com.google.common.collect.Lists;
public class BlockIronChest extends BlockContainer
{
public static final PropertyEnum<IronChestType> 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);
public BlockIronChest()
{
@ -52,26 +55,32 @@ public class BlockIronChest extends BlockContainer
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
this.setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
this.setHardness(3.0F);
this.setUnlocalizedName("IronChest");
this.setCreativeTab(CreativeTabs.tabDecorations);
}
@Override
public boolean isOpaqueCube()
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return IRON_CHEST_AABB;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullCube()
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumFacing direction, float p_180639_6_, float p_180639_7_, float p_180639_8_)
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack heldItem,
EnumFacing direction, float hitX, float hitY, float hitZ)
{
TileEntity te = world.getTileEntity(pos);
@ -122,21 +131,21 @@ public class BlockIronChest extends BlockContainer
@Override
public int getMetaFromState(IBlockState blockState)
{
return ((IronChestType) blockState.getValue(VARIANT_PROP)).ordinal();
return blockState.getValue(VARIANT_PROP).ordinal();
}
@Override
protected BlockState createBlockState()
protected BlockStateContainer createBlockState()
{
return new BlockState(this, new IProperty<?>[] { VARIANT_PROP });
return new BlockStateContainer(this, new IProperty<?>[] { VARIANT_PROP });
}
@Override
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
ArrayList<ItemStack> items = Lists.newArrayList();
ItemStack stack = new ItemStack(this, 1, getMetaFromState(state));
IronChestType.values()[IronChestType.validateMeta(getMetaFromState(state))].adornItemDrop(stack);
ItemStack stack = new ItemStack(this, 1, this.getMetaFromState(state));
IronChestType.values()[IronChestType.validateMeta(this.getMetaFromState(state))].adornItemDrop(stack);
items.add(stack);
return items;
}
@ -145,7 +154,7 @@ public class BlockIronChest extends BlockContainer
public void onBlockAdded(World world, BlockPos pos, IBlockState blockState)
{
super.onBlockAdded(world, pos, blockState);
world.markBlockForUpdate(pos);
world.notifyBlockUpdate(pos, blockState, blockState, 3);
}
@Override
@ -175,14 +184,14 @@ public class BlockIronChest extends BlockContainer
TileEntityIronChest teic = (TileEntityIronChest) te;
teic.wasPlaced(entityliving, itemStack);
teic.setFacing(chestFacing);
world.markBlockForUpdate(pos);
world.notifyBlockUpdate(pos, blockState, blockState, 3);
}
}
@Override
public int damageDropped(IBlockState state)
{
return IronChestType.validateMeta(((IronChestType) state.getValue(VARIANT_PROP)).ordinal());
return IronChestType.validateMeta(state.getValue(VARIANT_PROP).ordinal());
}
@Override
@ -192,7 +201,7 @@ public class BlockIronChest extends BlockContainer
if (tileentitychest != null)
{
tileentitychest.removeAdornments();
dropContent(0, tileentitychest, world, tileentitychest.getPos());
this.dropContent(0, tileentitychest, world, tileentitychest.getPos());
}
super.breakBlock(world, pos, blockState);
}
@ -219,7 +228,8 @@ public class BlockIronChest extends BlockContainer
i1 = itemstack.stackSize;
}
itemstack.stackSize -= i1;
EntityItem entityitem = new EntityItem(world, pos.getX() + f, (float) pos.getY() + (newSize > 0 ? 1 : 0) + f1, pos.getZ() + f2, new ItemStack(itemstack.getItem(), i1, itemstack.getMetadata()));
EntityItem entityitem = new EntityItem(world, pos.getX() + f, (float) pos.getY() + (newSize > 0 ? 1 : 0) + f1, pos.getZ() + f2,
new ItemStack(itemstack.getItem(), i1, itemstack.getMetadata()));
float f3 = 0.05F;
entityitem.motionX = (float) random.nextGaussian() * f3;
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
@ -249,13 +259,13 @@ public class BlockIronChest extends BlockContainer
}
@Override
public boolean hasComparatorInputOverride()
public boolean hasComparatorInputOverride(IBlockState state)
{
return true;
}
@Override
public int getComparatorInputOverride(World world, BlockPos pos)
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos)
{
TileEntity te = world.getTileEntity(pos);
if (te instanceof IInventory)

View File

@ -14,14 +14,16 @@ import static cpw.mods.ironchest.IronChestType.IRON;
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 cpw.mods.ironchest.client.ModelHelper;
import net.minecraftforge.fml.relauncher.Side;
public enum ChestChangerType {
public enum ChestChangerType
{
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"),
@ -48,8 +50,9 @@ public enum ChestChangerType {
this.recipe = recipe;
}
public IronChestType getSource(){
return source;
public IronChestType getSource()
{
return this.source;
}
public boolean canUpgrade(IronChestType from)
@ -64,22 +67,25 @@ public enum ChestChangerType {
public ItemChestChanger buildItem()
{
item = new ItemChestChanger(this);
GameRegistry.registerItem(item, itemName);
if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
ModelHelper.registerItem(item, "ironchest:" + itemName);
return item;
this.item = new ItemChestChanger(this);
GameRegistry.registerItem(this.item, this.itemName);
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
{
ModelHelper.registerItem(this.item, "ironchest:" + this.itemName);
}
return this.item;
}
public void addRecipes()
{
for (String sourceMat : source.getMatList())
for (String sourceMat : this.source.getMatList())
{
for (String targetMat : target.getMatList())
for (String targetMat : this.target.getMatList())
{
Object targetMaterial = IronChestType.translateOreName(targetMat);
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
IronChestType.addRecipe(new ItemStack(item), recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', "blockGlass", 'O', Blocks.obsidian);
IronChestType.addRecipe(new ItemStack(this.item), this.recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', "blockGlass", 'O',
Blocks.obsidian);
}
}
}

View File

@ -12,11 +12,12 @@ package cpw.mods.ironchest;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
public class CommonProxy implements IGuiHandler {
public class CommonProxy implements IGuiHandler
{
public void registerRenderInformation()
{

View File

@ -19,47 +19,48 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@ChestContainer(isLargeChest = true)
public class ContainerIronChest extends Container {
public class ContainerIronChest extends Container
{
private IronChestType type;
private EntityPlayer player;
private IInventory chest;
public ContainerIronChest(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
{
chest = chestInventory;
player = ((InventoryPlayer) playerInventory).player;
this.chest = chestInventory;
this.player = ((InventoryPlayer) playerInventory).player;
this.type = type;
chestInventory.openInventory(player);
layoutContainer(playerInventory, chestInventory, type, xSize, ySize);
chestInventory.openInventory(this.player);
this.layoutContainer(playerInventory, chestInventory, type, xSize, ySize);
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return chest.isUseableByPlayer(player);
return this.chest.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p, int i)
{
ItemStack itemstack = null;
Slot slot = (Slot) inventorySlots.get(i);
Slot slot = (Slot) this.inventorySlots.get(i);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (i < type.size)
if (i < this.type.size)
{
if (!mergeItemStack(itemstack1, type.size, inventorySlots.size(), true))
if (!this.mergeItemStack(itemstack1, this.type.size, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!type.acceptsStack(itemstack1))
else if (!this.type.acceptsStack(itemstack1))
{
return null;
}
else if (!mergeItemStack(itemstack1, 0, type.size, false))
else if (!this.mergeItemStack(itemstack1, 0, this.type.size, false))
{
return null;
}
@ -79,19 +80,22 @@ public class ContainerIronChest extends Container {
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onContainerClosed(entityplayer);
chest.closeInventory(entityplayer);
this.chest.closeInventory(entityplayer);
}
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
{
if (type == IronChestType.DIRTCHEST9000) {
addSlotToContainer(type.makeSlot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18));
} else {
if (type == IronChestType.DIRTCHEST9000)
{
this.addSlotToContainer(type.makeSlot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18));
}
else
{
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
{
for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++)
{
addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
this.addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
}
}
}
@ -101,25 +105,26 @@ public class ContainerIronChest extends Container {
{
for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++)
{
addSlotToContainer(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18
- 10));
this.addSlotToContainer(
new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18 - 10));
}
}
for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++)
{
addSlotToContainer(new Slot(playerInventory, hotbarSlot, leftCol + hotbarSlot * 18, ySize - 24));
this.addSlotToContainer(new Slot(playerInventory, hotbarSlot, leftCol + hotbarSlot * 18, ySize - 24));
}
}
public EntityPlayer getPlayer()
{
return player;
return this.player;
}
@ChestContainer.RowSizeCallback
public int getNumColumns() {
return type.getRowLength();
public int getNumColumns()
{
return this.type.getRowLength();
}
}

View File

@ -10,14 +10,7 @@
******************************************************************************/
package cpw.mods.ironchest;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderFireball;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
@ -25,14 +18,9 @@ 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.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[11.15.0,12.0]", acceptedMinecraftVersions="[1.8,1.8.9]")
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[12.16,)", acceptedMinecraftVersions = "[1.9]")
public class IronChest
{
public static BlockIronChest ironChestBlock;

View File

@ -2,7 +2,7 @@ package cpw.mods.ironchest;
import net.minecraft.entity.ai.EntityAIOcelotSit;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class IronChestAIOcelotSit extends EntityAIOcelotSit

View File

@ -33,7 +33,7 @@ public enum IronChestType implements IStringSerializable
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"),
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);
int size;
private int rowLength;
@ -49,8 +49,9 @@ public enum IronChestType implements IStringSerializable
IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String modelTexture, int textureRow, List<String> mats,
Class<? extends TileEntityIronChest> clazz, String... recipes)
{
this(size, rowLength, tieredChest, friendlyName, modelTexture, textureRow, mats, clazz, (Item)null, recipes);
this(size, rowLength, tieredChest, friendlyName, modelTexture, textureRow, mats, clazz, (Item) null, recipes);
}
IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String modelTexture, int textureRow, List<String> mats,
Class<? extends TileEntityIronChest> clazz, Item itemFilter, String... recipes)
{
@ -64,23 +65,23 @@ public enum IronChestType implements IStringSerializable
this.itemFilter = itemFilter;
this.recipes = recipes;
this.matList = new ArrayList<String>();
matList.addAll(mats);
this.matList.addAll(mats);
}
@Override
public String getName()
{
return name().toLowerCase();
return this.name().toLowerCase();
}
public String getModelTexture()
{
return modelTexture;
return this.modelTexture;
}
public int getTextureRow()
{
return textureRow;
return this.textureRow;
}
public static TileEntityIronChest makeEntity(int metadata)
@ -115,8 +116,11 @@ public enum IronChestType implements IStringSerializable
{
generateRecipesForType(blockResult, previous, typ);
ItemStack chest = new ItemStack(blockResult, 1, typ.ordinal());
//if (typ.isValidForCreativeMode()) GameRegistry.registerCustomItemStack(typ.friendlyName, chest);//TODO fix this!!
if (typ.tieredChest) previous = chest;
// if (typ.isValidForCreativeMode()) GameRegistry.registerCustomItemStack(typ.friendlyName, chest);//TODO fix this!!
if (typ.tieredChest)
{
previous = chest;
}
}
}
@ -163,12 +167,12 @@ public enum IronChestType implements IStringSerializable
public int getRowCount()
{
return size / rowLength;
return this.size / this.rowLength;
}
public int getRowLength()
{
return rowLength;
return this.rowLength;
}
public boolean isTransparent()
@ -178,7 +182,7 @@ public enum IronChestType implements IStringSerializable
public List<String> getMatList()
{
return matList;
return this.matList;
}
public static int validateMeta(int i)
@ -195,7 +199,7 @@ public enum IronChestType implements IStringSerializable
public boolean isValidForCreativeMode()
{
return validateMeta(ordinal()) == ordinal();
return validateMeta(this.ordinal()) == this.ordinal();
}
public boolean isExplosionResistant()
@ -210,7 +214,7 @@ public enum IronChestType implements IStringSerializable
public boolean acceptsStack(ItemStack itemstack)
{
return itemFilter == null || itemstack == null || itemstack.getItem() == itemFilter;
return this.itemFilter == null || itemstack == null || itemstack.getItem() == this.itemFilter;
}
public void adornItemDrop(ItemStack item)

View File

@ -11,14 +11,17 @@
package cpw.mods.ironchest;
import net.minecraft.block.BlockChest;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemChestChanger extends Item
@ -35,73 +38,114 @@ public class ItemChestChanger extends Item
}
@Override
public boolean onItemUseFirst (ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
return false;
if(this.type.canUpgrade(IronChestType.WOOD)){
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){
return false;
if (worldIn.isRemote)
{
return EnumActionResult.PASS;
}
}else{
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){
return false;
if (this.type.canUpgrade(IronChestType.WOOD))
{
if (!(worldIn.getBlockState(pos).getBlock() instanceof BlockChest))
{
return EnumActionResult.PASS;
}
}
TileEntity te = world.getTileEntity(pos);
else
{
if (worldIn.getBlockState(pos) != IronChest.ironChestBlock
.getStateFromMeta(IronChestType.valueOf(this.type.getSource().getName().toUpperCase()).ordinal()))
{
return EnumActionResult.PASS;
}
}
TileEntity te = worldIn.getTileEntity(pos);
TileEntityIronChest newchest = new TileEntityIronChest();
ItemStack[] chestContents = new ItemStack[27];
int chestFacing = 0;
if (te != null)
{
if (te instanceof TileEntityIronChest)
{
chestContents = ((TileEntityIronChest) te).chestContents;
chestFacing = ((TileEntityIronChest) te).getFacing();
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
if (newchest == null)
return false;
{
return EnumActionResult.PASS;
}
}
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)
return false;
if (!getType().canUpgrade(IronChestType.WOOD))
return false;
{
return EnumActionResult.PASS;
}
if (!this.getType().canUpgrade(IronChestType.WOOD))
{
return EnumActionResult.PASS;
}
chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
for (int i = 0; i < chestContents.length; i++)
{
chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
}
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
}
}
te.updateContainingBlockInfo();
if (te instanceof TileEntityChest)
{
((TileEntityChest) te).checkForAdjacentChests();
}
world.removeTileEntity(pos);
world.setBlockToAir(pos);
worldIn.removeTileEntity(pos);
worldIn.setBlockToAir(pos);
world.setTileEntity(pos, newchest);
world.setBlockState(pos, IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal()), 3);
IBlockState iblockstate = IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal());
world.markBlockForUpdate(pos);
worldIn.setTileEntity(pos, newchest);
worldIn.setBlockState(pos, iblockstate, 3);
TileEntity te2 = world.getTileEntity(pos);
worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
TileEntity te2 = worldIn.getTileEntity(pos);
if (te2 instanceof TileEntityIronChest)
{
((TileEntityIronChest) te2).setContents(chestContents);
((TileEntityIronChest) te2).setFacing((byte) chestFacing);
}
stack.stackSize = player.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
return true;
stack.stackSize = playerIn.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
return EnumActionResult.SUCCESS;
}
public int getTargetChestOrdinal(int sourceOrdinal)
{
return type.getTarget();
return this.type.getTarget();
}
public ChestChangerType getType()
{
return type;
return this.type;
}
}

View File

@ -1,28 +1,27 @@
package cpw.mods.ironchest;
import java.util.List;
import net.minecraft.entity.ai.EntityAIOcelotSit;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class OcelotsSitOnChestsHandler {
public class OcelotsSitOnChestsHandler
{
@SubscribeEvent
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
{
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
{
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
List<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
// EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
// Set<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
for (EntityAITasks.EntityAITaskEntry task : tasks) {
if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit)) {
task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
}
}
// for (EntityAITasks.EntityAITaskEntry task : tasks)
// {
// if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit))
// {
// task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
// }
// }
}
}
}

View File

@ -10,7 +10,8 @@
******************************************************************************/
package cpw.mods.ironchest;
public class TileEntityCopperChest extends TileEntityIronChest {
public class TileEntityCopperChest extends TileEntityIronChest
{
public TileEntityCopperChest()
{
super(IronChestType.COPPER);

View File

@ -10,7 +10,8 @@
******************************************************************************/
package cpw.mods.ironchest;
public class TileEntityCrystalChest extends TileEntityIronChest {
public class TileEntityCrystalChest extends TileEntityIronChest
{
public TileEntityCrystalChest()
{
super(IronChestType.CRYSTAL);

View File

@ -5,38 +5,45 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.StatCollector;
import net.minecraft.util.text.translation.I18n;
public class TileEntityDirtChest extends TileEntityIronChest {
public class TileEntityDirtChest extends TileEntityIronChest
{
private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.written_book);
static {
static
{
dirtChest9000GuideBook.setTagInfo("author", new NBTTagString("cpw"));
dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.title")));
dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.title")));
NBTTagList pages = new NBTTagList();
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page1")));
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page2")));
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page3")));
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page4")));
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page5")));
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page1")));
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page2")));
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page3")));
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page4")));
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page5")));
dirtChest9000GuideBook.setTagInfo("pages", pages);
}
public TileEntityDirtChest() {
public TileEntityDirtChest()
{
super(IronChestType.DIRTCHEST9000);
}
@Override
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
{
if (!(itemStack.hasTagCompound() && itemStack.getTagCompound().getBoolean("dirtchest"))) {
setInventorySlotContents(0, dirtChest9000GuideBook.copy());
if (!(itemStack.hasTagCompound() && itemStack.getTagCompound().getBoolean("dirtchest")))
{
this.setInventorySlotContents(0, dirtChest9000GuideBook.copy());
}
}
@Override
public void removeAdornments()
{
if (chestContents[0] != null && chestContents[0].isItemEqual(dirtChest9000GuideBook)) {
chestContents[0] = null;
if (this.chestContents[0] != null && this.chestContents[0].isItemEqual(dirtChest9000GuideBook))
{
this.chestContents[0] = null;
}
}
}

View File

@ -10,7 +10,8 @@
******************************************************************************/
package cpw.mods.ironchest;
public class TileEntityGoldChest extends TileEntityIronChest {
public class TileEntityGoldChest extends TileEntityIronChest
{
public TileEntityGoldChest()
{

View File

@ -14,9 +14,11 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -24,11 +26,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntityLockable;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.common.util.Constants;
public class TileEntityIronChest extends TileEntityLockable implements ITickable, IInventory
@ -54,32 +57,32 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
super();
this.type = type;
this.chestContents = new ItemStack[getSizeInventory()];
this.chestContents = new ItemStack[this.getSizeInventory()];
this.topStacks = new ItemStack[8];
}
public ItemStack[] getContents()
{
return chestContents;
return this.chestContents;
}
public void setContents(ItemStack[] contents)
{
chestContents = new ItemStack[getSizeInventory()];
this.chestContents = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < contents.length; i++)
{
if (i < chestContents.length)
if (i < this.chestContents.length)
{
chestContents[i] = contents[i];
this.chestContents[i] = contents[i];
}
}
inventoryTouched = true;
this.inventoryTouched = true;
}
@Override
public int getSizeInventory()
{
return type.size;
return this.type.size;
}
public int getFacing()
@ -89,121 +92,125 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
public IronChestType getType()
{
return type;
return this.type;
}
@Override
public ItemStack getStackInSlot(int i)
{
inventoryTouched = true;
return chestContents[i];
this.inventoryTouched = true;
return this.chestContents[i];
}
@Override
public void markDirty()
{
super.markDirty();
sortTopStacks();
this.sortTopStacks();
}
protected void sortTopStacks()
{
if (!type.isTransparent() || (worldObj != null && worldObj.isRemote))
if (!this.type.isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
{
return;
}
ItemStack[] tempCopy = new ItemStack[getSizeInventory()];
ItemStack[] tempCopy = new ItemStack[this.getSizeInventory()];
boolean hasStuff = false;
int compressedIdx = 0;
mainLoop: for (int i = 0; i < getSizeInventory(); i++)
mainLoop: for (int i = 0; i < this.getSizeInventory(); i++)
{
if (chestContents[i] != null)
if (this.chestContents[i] != null)
{
for (int j = 0; j < compressedIdx; j++)
{
if (tempCopy[j].isItemEqual(chestContents[i]))
if (tempCopy[j].isItemEqual(this.chestContents[i]))
{
tempCopy[j].stackSize += chestContents[i].stackSize;
tempCopy[j].stackSize += this.chestContents[i].stackSize;
continue mainLoop;
}
}
tempCopy[compressedIdx++] = chestContents[i].copy();
tempCopy[compressedIdx++] = this.chestContents[i].copy();
hasStuff = true;
}
}
if (!hasStuff && hadStuff)
if (!hasStuff && this.hadStuff)
{
hadStuff = false;
for (int i = 0; i < topStacks.length; i++)
this.hadStuff = false;
for (int i = 0; i < this.topStacks.length; i++)
{
topStacks[i] = null;
this.topStacks[i] = null;
}
if (worldObj != null)
if (this.worldObj != null)
{
worldObj.markBlockForUpdate(pos);
IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3);
}
return;
}
hadStuff = true;
Arrays.sort(tempCopy, new Comparator<ItemStack>()
{
this.hadStuff = true;
Arrays.sort(tempCopy, new Comparator<ItemStack>() {
@Override
public int compare(ItemStack o1, ItemStack o2)
{
if (o1 == null)
{
return 1;
} else if (o2 == null)
}
else if (o2 == null)
{
return -1;
} else
}
else
{
return o2.stackSize - o1.stackSize;
}
}
});
int p = 0;
for (int i = 0; i < tempCopy.length; i++)
for (ItemStack element : tempCopy)
{
if (tempCopy[i] != null && tempCopy[i].stackSize > 0)
if (element != null && element.stackSize > 0)
{
topStacks[p++] = tempCopy[i];
if (p == topStacks.length)
this.topStacks[p++] = element;
if (p == this.topStacks.length)
{
break;
}
}
}
for (int i = p; i < topStacks.length; i++)
for (int i = p; i < this.topStacks.length; i++)
{
topStacks[i] = null;
this.topStacks[i] = null;
}
if (worldObj != null)
if (this.worldObj != null)
{
worldObj.markBlockForUpdate(pos);
IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3);
}
}
@Override
public ItemStack decrStackSize(int i, int j)
{
if (chestContents[i] != null)
if (this.chestContents[i] != null)
{
if (chestContents[i].stackSize <= j)
if (this.chestContents[i].stackSize <= j)
{
ItemStack itemstack = chestContents[i];
chestContents[i] = null;
markDirty();
ItemStack itemstack = this.chestContents[i];
this.chestContents[i] = null;
this.markDirty();
return itemstack;
}
ItemStack itemstack1 = chestContents[i].splitStack(j);
if (chestContents[i].stackSize == 0)
ItemStack itemstack1 = this.chestContents[i].splitStack(j);
if (this.chestContents[i].stackSize == 0)
{
chestContents[i] = null;
this.chestContents[i] = null;
}
markDirty();
this.markDirty();
return itemstack1;
} else
}
else
{
return null;
}
@ -212,18 +219,18 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public void setInventorySlotContents(int i, ItemStack itemstack)
{
chestContents[i] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
this.chestContents[i] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
itemstack.stackSize = this.getInventoryStackLimit();
}
markDirty();
this.markDirty();
}
@Override
public String getName()
{
return this.hasCustomName() ? this.customName : type.name();
return this.hasCustomName() ? this.customName : this.type.name();
}
@Override
@ -243,7 +250,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
super.readFromNBT(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
this.chestContents = new ItemStack[getSizeInventory()];
this.chestContents = new ItemStack[this.getSizeInventory()];
if (nbttagcompound.hasKey("CustomName", Constants.NBT.TAG_STRING))
{
@ -254,13 +261,13 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
int j = nbttagcompound1.getByte("Slot") & 0xff;
if (j >= 0 && j < chestContents.length)
if (j >= 0 && j < this.chestContents.length)
{
chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
facing = nbttagcompound.getByte("facing");
sortTopStacks();
this.facing = nbttagcompound.getByte("facing");
this.sortTopStacks();
}
@Override
@ -268,19 +275,19 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
super.writeToNBT(nbttagcompound);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < chestContents.length; i++)
for (int i = 0; i < this.chestContents.length; i++)
{
if (chestContents[i] != null)
if (this.chestContents[i] != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i);
chestContents[i].writeToNBT(nbttagcompound1);
this.chestContents[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
}
nbttagcompound.setTag("Items", nbttaglist);
nbttagcompound.setByte("facing", facing);
nbttagcompound.setByte("facing", this.facing);
if (this.hasCustomName())
{
@ -297,26 +304,28 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
if (worldObj == null)
if (this.worldObj == null)
{
return true;
}
if (worldObj.getTileEntity(pos) != this)
if (this.worldObj.getTileEntity(this.pos) != this)
{
return false;
}
return entityplayer.getDistanceSq(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D) <= 64D;
return entityplayer.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64D;
}
@Override
public void update()
{
// Resynchronize clients with the server state
if (worldObj != null && !this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + pos.getX() + pos.getY() + pos.getZ()) % 200 == 0)
if (this.worldObj != null && !this.worldObj.isRemote && this.numUsingPlayers != 0
&& (this.ticksSinceSync + this.pos.getX() + this.pos.getY() + this.pos.getZ()) % 200 == 0)
{
this.numUsingPlayers = 0;
float var1 = 5.0F;
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() - var1, pos.getY() - var1, pos.getZ() - var1, pos.getX() + 1 + var1, pos.getY() + 1 + var1, pos.getZ() + 1 + var1));
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.pos.getX() - var1, this.pos.getY() - var1,
this.pos.getZ() - var1, this.pos.getX() + 1 + var1, this.pos.getY() + 1 + var1, this.pos.getZ() + 1 + var1));
for (EntityPlayer var4 : var2)
{
@ -327,49 +336,52 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
}
}
if (worldObj != null && !worldObj.isRemote && ticksSinceSync < 0)
if (this.worldObj != null && !this.worldObj.isRemote && this.ticksSinceSync < 0)
{
worldObj.addBlockEvent(pos, IronChest.ironChestBlock, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7));
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 3, ((this.numUsingPlayers << 3) & 0xF8) | (this.facing & 0x7));
}
if (!worldObj.isRemote && inventoryTouched)
if (!this.worldObj.isRemote && this.inventoryTouched)
{
inventoryTouched = false;
sortTopStacks();
this.inventoryTouched = false;
this.sortTopStacks();
}
this.ticksSinceSync++;
prevLidAngle = lidAngle;
this.prevLidAngle = this.lidAngle;
float f = 0.1F;
if (numUsingPlayers > 0 && lidAngle == 0.0F)
if (this.numUsingPlayers > 0 && this.lidAngle == 0.0F)
{
double d = pos.getX() + 0.5D;
double d1 = pos.getZ() + 0.5D;
worldObj.playSoundEffect(d, pos.getY() + 0.5D, d1, "random.chestopen", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F);
double d = this.pos.getX() + 0.5D;
double d1 = this.pos.getZ() + 0.5D;
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);
}
if (numUsingPlayers == 0 && lidAngle > 0.0F || numUsingPlayers > 0 && lidAngle < 1.0F)
if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
{
float f1 = lidAngle;
if (numUsingPlayers > 0)
float f1 = this.lidAngle;
if (this.numUsingPlayers > 0)
{
lidAngle += f;
} else
{
lidAngle -= f;
this.lidAngle += f;
}
if (lidAngle > 1.0F)
else
{
lidAngle = 1.0F;
this.lidAngle -= f;
}
if (this.lidAngle > 1.0F)
{
this.lidAngle = 1.0F;
}
float f2 = 0.5F;
if (lidAngle < f2 && f1 >= f2)
if (this.lidAngle < f2 && f1 >= f2)
{
double d2 = pos.getX() + 0.5D;
double d3 = pos.getZ() + 0.5D;
worldObj.playSoundEffect(d2, pos.getY() + 0.5D, d3, "random.chestclosed", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F);
double d2 = this.pos.getX() + 0.5D;
double d3 = this.pos.getZ() + 0.5D;
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);
}
if (lidAngle < 0.0F)
if (this.lidAngle < 0.0F)
{
lidAngle = 0.0F;
this.lidAngle = 0.0F;
}
}
}
@ -379,14 +391,16 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
if (i == 1)
{
numUsingPlayers = j;
} else if (i == 2)
this.numUsingPlayers = j;
}
else if (i == 2)
{
facing = (byte) j;
} else if (i == 3)
this.facing = (byte) j;
}
else if (i == 3)
{
facing = (byte) (j & 0x7);
numUsingPlayers = (j & 0xF8) >> 3;
this.facing = (byte) (j & 0x7);
this.numUsingPlayers = (j & 0xF8) >> 3;
}
return true;
}
@ -394,23 +408,23 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public void openInventory(EntityPlayer player)
{
if (worldObj == null)
if (this.worldObj == null)
{
return;
}
numUsingPlayers++;
worldObj.addBlockEvent(pos, IronChest.ironChestBlock, 1, numUsingPlayers);
this.numUsingPlayers++;
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numUsingPlayers);
}
@Override
public void closeInventory(EntityPlayer player)
{
if (worldObj == null)
if (this.worldObj == null)
{
return;
}
numUsingPlayers--;
worldObj.addBlockEvent(pos, IronChest.ironChestBlock, 1, numUsingPlayers);
this.numUsingPlayers--;
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numUsingPlayers);
}
public void setFacing(byte facing2)
@ -420,17 +434,17 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
public ItemStack[] getTopItemStacks()
{
return topStacks;
return this.topStacks;
}
public TileEntityIronChest updateFromMetadata(int l)
{
if (worldObj != null && worldObj.isRemote)
if (this.worldObj != null && this.worldObj.isRemote)
{
if (l != type.ordinal())
if (l != this.type.ordinal())
{
worldObj.setTileEntity(pos, IronChestType.makeEntity(l));
return (TileEntityIronChest) worldObj.getTileEntity(pos);
this.worldObj.setTileEntity(this.pos, IronChestType.makeEntity(l));
return (TileEntityIronChest) this.worldObj.getTileEntity(this.pos);
}
}
return this;
@ -441,9 +455,9 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("type", getType().ordinal());
nbt.setByte("facing", facing);
ItemStack[] stacks = buildItemStackDataList();
nbt.setInteger("type", this.getType().ordinal());
nbt.setByte("facing", this.facing);
ItemStack[] stacks = this.buildItemStackDataList();
if (stacks != null)
{
NBTTagList nbttaglist = new NBTTagList();
@ -460,20 +474,20 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
nbt.setTag("stacks", nbttaglist);
}
return new S35PacketUpdateTileEntity(pos, 0, nbt);
return new SPacketUpdateTileEntity(this.pos, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
if (pkt.getTileEntityType() == 0)
{
NBTTagCompound nbt = pkt.getNbtCompound();
type = IronChestType.values()[nbt.getInteger("type")];
facing = nbt.getByte("facing");
this.type = IronChestType.values()[nbt.getInteger("type")];
this.facing = nbt.getByte("facing");
NBTTagList tagList = nbt.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
ItemStack[] stacks = new ItemStack[topStacks.length];
ItemStack[] stacks = new ItemStack[this.topStacks.length];
for (int i = 0; i < stacks.length; i++)
{
@ -485,17 +499,18 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
}
}
if (type.isTransparent() && stacks != null)
if (this.type.isTransparent() && stacks != null)
{
int pos = 0;
for (int i = 0; i < topStacks.length; i++)
for (int i = 0; i < this.topStacks.length; i++)
{
if (stacks[pos] != null)
{
topStacks[i] = stacks[pos];
} else
this.topStacks[i] = stacks[pos];
}
else
{
topStacks[i] = null;
this.topStacks[i] = null;
}
pos++;
}
@ -505,16 +520,17 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
public ItemStack[] buildItemStackDataList()
{
if (type.isTransparent())
if (this.type.isTransparent())
{
ItemStack[] sortList = new ItemStack[topStacks.length];
ItemStack[] sortList = new ItemStack[this.topStacks.length];
int pos = 0;
for (ItemStack is : topStacks)
for (ItemStack is : this.topStacks)
{
if (is != null)
{
sortList[pos++] = is;
} else
}
else
{
sortList[pos++] = null;
}
@ -532,7 +548,8 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
ItemStack var2 = this.chestContents[par1];
this.chestContents[par1] = null;
return var2;
} else
}
else
{
return null;
}
@ -541,18 +558,18 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return type.acceptsStack(itemstack);
return this.type.acceptsStack(itemstack);
}
public void rotateAround()
{
facing++;
if (facing > EnumFacing.EAST.ordinal())
this.facing++;
if (this.facing > EnumFacing.EAST.ordinal())
{
facing = (byte) EnumFacing.NORTH.ordinal();
this.facing = (byte) EnumFacing.NORTH.ordinal();
}
setFacing(facing);
worldObj.addBlockEvent(pos, IronChest.ironChestBlock, 2, facing);
this.setFacing(this.facing);
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 2, this.facing);
}
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
@ -598,7 +615,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
@Override
public String getGuiID()
{
return "IronChest:" + type.name();
return "IronChest:" + this.type.name();
}
@Override

View File

@ -1,6 +1,7 @@
package cpw.mods.ironchest;
public class TileEntityObsidianChest extends TileEntityIronChest {
public class TileEntityObsidianChest extends TileEntityIronChest
{
public TileEntityObsidianChest()
{

View File

@ -10,7 +10,8 @@
******************************************************************************/
package cpw.mods.ironchest;
public class TileEntitySilverChest extends TileEntityIronChest {
public class TileEntitySilverChest extends TileEntityIronChest
{
public TileEntitySilverChest()
{
super(IronChestType.SILVER);

View File

@ -4,7 +4,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ValidatingSlot extends Slot {
public class ValidatingSlot extends Slot
{
private IronChestType type;
public ValidatingSlot(IInventory par1iInventory, int par2, int par3, int par4, IronChestType type)
@ -16,6 +17,6 @@ public class ValidatingSlot extends Slot {
@Override
public boolean isItemValid(ItemStack par1ItemStack)
{
return type.acceptsStack(par1ItemStack);
return this.type.acceptsStack(par1ItemStack);
}
}

View File

@ -10,21 +10,22 @@
******************************************************************************/
package cpw.mods.ironchest.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
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;
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.fml.client.registry.ClientRegistry;
public class ClientProxy extends CommonProxy
{
@ -40,7 +41,7 @@ public class ClientProxy extends CommonProxy
{
Item chestItem = Item.getItemFromBlock(IronChest.ironChestBlock);
mesher.register(chestItem, chestType.ordinal(), new ModelResourceLocation("ironchest:chest_" + chestType.getName().toLowerCase(), "inventory"));
ModelBakery.addVariantName(chestItem, "ironchest:chest_" + chestType.getName().toLowerCase());
ModelBakery.registerItemVariants(chestItem, new ResourceLocation("ironchest:chest_" + chestType.getName().toLowerCase()));
}
}
}
@ -64,7 +65,8 @@ public class ClientProxy extends CommonProxy
if (te != null && te instanceof TileEntityIronChest)
{
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
} else
}
else
{
return null;
}

View File

@ -10,39 +10,40 @@
******************************************************************************/
package cpw.mods.ironchest.client;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
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.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
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"));
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"));
public final ResourceLocation location;
private ResourceList(ResourceLocation loc) {
private ResourceList(ResourceLocation loc)
{
this.location = loc;
}
}
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);
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);
private int xSize;
private int ySize;
@ -60,7 +61,7 @@ public class GUIChest extends GuiContainer {
protected Container makeContainer(IInventory player, IInventory chest)
{
return new ContainerIronChest(player, chest, mainType, xSize, ySize);
return new ContainerIronChest(player, chest, this.mainType, this.xSize, this.ySize);
}
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory)
@ -71,7 +72,7 @@ public class GUIChest extends GuiContainer {
public int getRowLength()
{
return type.mainType.getRowLength();
return this.type.mainType.getRowLength();
}
private GUI type;
@ -90,9 +91,9 @@ public class GUIChest extends GuiContainer {
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// new "bind tex"
this.mc.getTextureManager().bindTexture(type.guiResourceList.location);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
this.mc.getTextureManager().bindTexture(this.type.guiResourceList.location);
int x = (this.width - this.xSize) / 2;
int y = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
}
}

View File

@ -13,7 +13,7 @@ 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.resources.model.ModelResourceLocation;
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;

View File

@ -35,10 +35,12 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
{
private static Map<IronChestType, ResourceLocation> locations;
static {
Builder<IronChestType, ResourceLocation> builder = ImmutableMap.<IronChestType,ResourceLocation>builder();
for (IronChestType typ : IronChestType.values()) {
builder.put(typ, new ResourceLocation("ironchest","textures/model/"+typ.getModelTexture()));
static
{
Builder<IronChestType, ResourceLocation> builder = ImmutableMap.<IronChestType, ResourceLocation> builder();
for (IronChestType typ : IronChestType.values())
{
builder.put(typ, new ResourceLocation("ironchest", "textures/model/" + typ.getModelTexture()));
}
locations = builder.build();
}
@ -52,19 +54,24 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
public TileEntityIronChestRenderer(Class<T> type)
{
model = new ModelChest();
random = new Random();
itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()){
this.model = new ModelChest();
this.random = new Random();
this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) {
@Override
public int func_177078_a(ItemStack stack) {
public int getModelCount(ItemStack stack)
{
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1);
}
@Override
public boolean shouldBob() {
public boolean shouldBob()
{
return false;
}
@Override
public boolean shouldSpreadItems() {
public boolean shouldSpreadItems()
{
return false;
}
};
@ -72,47 +79,58 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
public void render(TileEntityIronChest tile, double x, double y, double z, float partialTick, int breakStage)
{
if (tile == null) {
if (tile == null)
{
return;
}
int facing = 3;
IronChestType type = tile.getType();
if (tile != null && tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock) {
if (tile != null && tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock)
{
facing = tile.getFacing();
type = tile.getType();
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
type = (IronChestType)state.getValue(BlockIronChest.VARIANT_PROP);
type = state.getValue(BlockIronChest.VARIANT_PROP);
}
if (breakStage >= 0)
{
bindTexture(DESTROY_STAGES[breakStage]);
this.bindTexture(DESTROY_STAGES[breakStage]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(4.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else
bindTexture(locations.get(type));
}
else
{
this.bindTexture(locations.get(type));
}
GlStateManager.pushMatrix();
if(type == IronChestType.CRYSTAL)
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.translate(0.5F, 0.5F, 0.5F);
int k = 0;
if (facing == 2) {
if (facing == 2)
{
k = 180;
}
if (facing == 3) {
if (facing == 3)
{
k = 0;
}
if (facing == 4) {
if (facing == 4)
{
k = 90;
}
if (facing == 5) {
if (facing == 5)
{
k = -90;
}
GlStateManager.rotate(k, 0.0F, 1.0F, 0.0F);
@ -120,29 +138,34 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
float lidangle = tile.prevLidAngle + (tile.lidAngle - tile.prevLidAngle) * partialTick;
lidangle = 1.0F - lidangle;
lidangle = 1.0F - lidangle * lidangle * lidangle;
model.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);
this.model.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);
// Render the chest itself
model.renderAll();
this.model.renderAll();
if (breakStage >= 0)
{
GlStateManager.matrixMode(5890);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
}
if(type == IronChestType.CRYSTAL)
if (type == IronChestType.CRYSTAL)
{
GlStateManager.enableCull();
}
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (type.isTransparent() && tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d) {
random.setSeed(254L);
if (type.isTransparent()
&& tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d)
{
this.random.setSeed(254L);
float shiftX;
float shiftY;
float shiftZ;
int shift = 0;
float blockScale = 0.70F;
float timeD = (float) (360.0 * (double) (System.currentTimeMillis() & 0x3FFFL) / (double) 0x3FFFL);
if (tile.getTopItemStacks()[1] == null) {
float timeD = (float) (360.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
if (tile.getTopItemStacks()[1] == null)
{
shift = 8;
blockScale = 0.85F;
}
@ -150,11 +173,14 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
GlStateManager.translate((float) x, (float) y, (float) z);
EntityItem customitem = new EntityItem(this.getWorld());
customitem.hoverStart = 0f;
for (ItemStack item : tile.getTopItemStacks()) {
if (shift > shifts.length) {
for (ItemStack item : tile.getTopItemStacks())
{
if (shift > shifts.length)
{
break;
}
if (item == null) {
if (item == null)
{
shift++;
continue;
}
@ -167,15 +193,16 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
GlStateManager.rotate(timeD, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(blockScale, blockScale, blockScale);
customitem.setEntityItemStack(item);
itemRenderer.doRender(customitem, 0, 0, 0, 0, 0);
this.itemRenderer.doRender(customitem, 0, 0, 0, 0, 0);
GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
}
}
@Override
public void renderTileEntityAt(TileEntityIronChest tileentity, double x, double y, double z, float partialTick, int breakStage)
{
render(tileentity, x, y, z, partialTick, breakStage);
this.render(tileentity, x, y, z, partialTick, breakStage);
}
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/copperchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/crystalchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/diamondchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/dirtchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/goldchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/ironchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/obsidianchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/silverchest"
},
@ -36,12 +37,5 @@
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
],
"display": {
"thirdperson": {
"rotation": [ 0, 45, 190 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
]
}