Work on the 1.11 update more, some is still buggy but nearly complete.
This commit is contained in:
parent
a43c7259c3
commit
9fe6c6912a
|
@ -43,7 +43,7 @@ archivesBaseName = "ironchest"
|
|||
|
||||
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
|
||||
minecraft {
|
||||
version = "1.11-13.19.0.2130"
|
||||
version = "1.11-13.19.0.2148"
|
||||
mappings = "snapshot_20161111"
|
||||
runDir = "run"
|
||||
}
|
||||
|
|
0
src/api/java/invtweaks/api/container/ChestContainer.java → src/main/api/java/invtweaks/api/container/ChestContainer.java
Executable file → Normal file
0
src/api/java/invtweaks/api/container/ChestContainer.java → src/main/api/java/invtweaks/api/container/ChestContainer.java
Executable file → Normal file
|
@ -10,8 +10,6 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
|
@ -30,6 +28,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -42,6 +41,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
public class BlockIronChest extends Block
|
||||
{
|
||||
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()
|
||||
|
@ -82,27 +82,28 @@ public class BlockIronChest extends Block
|
|||
|
||||
@Override
|
||||
//@formatter:off
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing direction, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
|
||||
//public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing direction, float hitX, float hitY, float hitZ)
|
||||
//@formatter:on
|
||||
{
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = worldIn.getTileEntity(pos);
|
||||
|
||||
if (te == null || !(te instanceof TileEntityIronChest))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (world.isSideSolid(pos.add(0, 1, 0), EnumFacing.DOWN))
|
||||
if (worldIn.isSideSolid(pos.add(0, 1, 0), EnumFacing.DOWN))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (world.isRemote)
|
||||
if (worldIn.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
player.openGui(IronChest.instance, ((TileEntityIronChest) te).getType().ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
playerIn.openGui(IronChest.instance, ((TileEntityIronChest) te).getType().ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -120,7 +121,8 @@ public class BlockIronChest extends Block
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
//public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (IronChestType type : IronChestType.VALUES)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest;
|
||||
|
||||
import invtweaks.api.container.ChestContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
@ -18,11 +17,13 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ChestContainer(isLargeChest = true)
|
||||
//@ChestContainer(isLargeChest = true)
|
||||
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)
|
||||
|
@ -43,7 +44,7 @@ public class ContainerIronChest extends Container
|
|||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p, int i)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack = ItemStack.field_190927_a;
|
||||
Slot slot = this.inventorySlots.get(i);
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
|
@ -53,20 +54,20 @@ public class ContainerIronChest extends Container
|
|||
{
|
||||
if (!this.mergeItemStack(itemstack1, this.type.size, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
}
|
||||
else if (!this.type.acceptsStack(itemstack1))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 0, this.type.size, false))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
if (itemstack1.func_190916_E() == 0)
|
||||
{
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.field_190927_a);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -122,9 +123,9 @@ public class ContainerIronChest extends Container
|
|||
return this.player;
|
||||
}
|
||||
|
||||
@ChestContainer.RowSizeCallback
|
||||
public int getNumColumns()
|
||||
{
|
||||
return this.type.rowLength;
|
||||
}
|
||||
//@ChestContainer.RowSizeCallback
|
||||
//public int getNumColumns()
|
||||
//{
|
||||
// return this.type.rowLength;
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = IronChest.MOD_ID, name = "Iron Chests", dependencies = "required-after:Forge@[12.17.0.1909,)", acceptedMinecraftVersions = "[1.11, 1.12)")
|
||||
@Mod(modid = IronChest.MOD_ID, name = "Iron Chests", /*dependencies = "required-after:Forge@[12.17.0.1909,)",*/ acceptedMinecraftVersions = "[1.11, 1.12)")
|
||||
public class IronChest
|
||||
{
|
||||
public static final String MOD_ID = "ironchest";
|
||||
|
@ -33,6 +33,7 @@ public class IronChest
|
|||
public static CommonProxy proxy;
|
||||
|
||||
public static BlockIronChest ironChestBlock;
|
||||
|
||||
public static ItemIronChest ironChestItemBlock;
|
||||
|
||||
@EventHandler
|
||||
|
@ -56,6 +57,7 @@ public class IronChest
|
|||
|
||||
for (IronChestType typ : IronChestType.VALUES)
|
||||
{
|
||||
if (typ.clazz != null)
|
||||
GameRegistry.registerTileEntity(typ.clazz, "IronChest." + typ.name());
|
||||
}
|
||||
|
||||
|
|
|
@ -42,15 +42,25 @@ public enum IronChestType implements IStringSerializable
|
|||
public static final IronChestType VALUES[] = values();
|
||||
|
||||
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<? extends TileEntityIronChest> clazz;
|
||||
|
||||
public final Collection<String> recipes;
|
||||
|
||||
public final Collection<String> matList;
|
||||
|
||||
public final int xSize;
|
||||
|
||||
public final int ySize;
|
||||
|
||||
//@formatter:off
|
||||
|
@ -192,7 +202,7 @@ public enum IronChestType implements IStringSerializable
|
|||
{
|
||||
if (this == DIRTCHEST9000)
|
||||
{
|
||||
return itemstack == null || itemstack.getItem() == DIRT_ITEM;
|
||||
return itemstack == ItemStack.field_190927_a || itemstack.getItem() == DIRT_ITEM;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.tileentity.TileEntityChest;
|
|||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -38,17 +39,18 @@ public class ItemChestChanger extends Item
|
|||
|
||||
@Override
|
||||
//@formatter:off
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
//public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
//@formatter:on
|
||||
{
|
||||
if (worldIn.isRemote)
|
||||
if (world.isRemote)
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
if (this.type.canUpgrade(IronChestType.WOOD))
|
||||
{
|
||||
if (!(worldIn.getBlockState(pos).getBlock() instanceof BlockChest))
|
||||
if (!(world.getBlockState(pos).getBlock() instanceof BlockChest))
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
@ -56,23 +58,23 @@ public class ItemChestChanger extends Item
|
|||
else
|
||||
{
|
||||
//@formatter:off
|
||||
if (worldIn.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||
if (world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||
//@formatter:on
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = worldIn.getTileEntity(pos);
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||
ItemStack[] chestContents = new ItemStack[27];
|
||||
NonNullList<ItemStack> chestContents = NonNullList.<ItemStack> func_191197_a(27, ItemStack.field_190927_a);
|
||||
EnumFacing chestFacing = EnumFacing.DOWN;
|
||||
|
||||
if (te != null)
|
||||
{
|
||||
if (te instanceof TileEntityIronChest)
|
||||
{
|
||||
chestContents = ((TileEntityIronChest) te).chestContents;
|
||||
chestContents = ((TileEntityIronChest) te).func_190576_q();
|
||||
chestFacing = ((TileEntityIronChest) te).getFacing();
|
||||
newchest = this.type.target.makeEntity();
|
||||
if (newchest == null)
|
||||
|
@ -82,7 +84,7 @@ public class ItemChestChanger extends Item
|
|||
}
|
||||
else if (te instanceof TileEntityChest)
|
||||
{
|
||||
IBlockState chestState = worldIn.getBlockState(pos);
|
||||
IBlockState chestState = world.getBlockState(pos);
|
||||
chestFacing = chestState.getValue(BlockChest.FACING);
|
||||
TileEntityChest chest = (TileEntityChest) te;
|
||||
|
||||
|
@ -94,10 +96,10 @@ public class ItemChestChanger extends Item
|
|||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
chestContents = new ItemStack[chest.getSizeInventory()];
|
||||
for (int i = 0; i < chestContents.length; i++)
|
||||
chestContents = NonNullList.<ItemStack> func_191197_a(chest.getSizeInventory(), ItemStack.field_190927_a);//new ItemStack[chest.getSizeInventory()];
|
||||
for (int i = 0; i < chestContents.size(); i++)
|
||||
{
|
||||
chestContents[i] = chest.getStackInSlot(i);
|
||||
chestContents.set(i, chest.getStackInSlot(i));
|
||||
}
|
||||
newchest = this.type.target.makeEntity();
|
||||
}
|
||||
|
@ -110,17 +112,17 @@ public class ItemChestChanger extends Item
|
|||
((TileEntityChest) te).checkForAdjacentChests();
|
||||
}
|
||||
|
||||
worldIn.removeTileEntity(pos);
|
||||
worldIn.setBlockToAir(pos);
|
||||
world.removeTileEntity(pos);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
IBlockState iblockstate = IronChest.ironChestBlock.getDefaultState().withProperty(BlockIronChest.VARIANT_PROP, this.type.target);
|
||||
|
||||
worldIn.setTileEntity(pos, newchest);
|
||||
worldIn.setBlockState(pos, iblockstate, 3);
|
||||
world.setTileEntity(pos, newchest);
|
||||
world.setBlockState(pos, iblockstate, 3);
|
||||
|
||||
worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
|
||||
world.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
|
||||
|
||||
TileEntity te2 = worldIn.getTileEntity(pos);
|
||||
TileEntity te2 = world.getTileEntity(pos);
|
||||
|
||||
if (te2 instanceof TileEntityIronChest)
|
||||
{
|
||||
|
@ -128,7 +130,9 @@ public class ItemChestChanger extends Item
|
|||
((TileEntityIronChest) te2).setFacing(chestFacing);
|
||||
}
|
||||
|
||||
stack.func_190920_e(playerIn.capabilities.isCreativeMode ? stack.func_190916_E() : stack.func_190916_E() - 1);
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
stack.func_190920_e(player.capabilities.isCreativeMode ? stack.func_190916_E() : stack.func_190916_E() - 1);
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ public class TileEntityDirtChest extends TileEntityIronChest
|
|||
@Override
|
||||
public void removeAdornments()
|
||||
{
|
||||
if (this.chestContents[0] != null && this.chestContents[0].isItemEqual(dirtChest9000GuideBook))
|
||||
if (this.func_190576_q().get(0) != ItemStack.field_190927_a && this.func_190576_q().get(0).isItemEqual(dirtChest9000GuideBook))
|
||||
{
|
||||
this.chestContents[0] = null;
|
||||
this.func_190576_q().set(0, ItemStack.field_190927_a);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,56 +16,68 @@ 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.inventory.ItemStackHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityLockableLoot;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TileEntityIronChest extends TileEntityLockableLoot implements ITickable, IInventory {
|
||||
public float prevLidAngle;
|
||||
public class TileEntityIronChest extends TileEntityLockableLoot implements ITickable//, IInventory
|
||||
{
|
||||
/** The current angle of the lid (between 0 and 1) */
|
||||
public float lidAngle;
|
||||
public ItemStack[] chestContents;
|
||||
|
||||
/** The angle of the lid last tick */
|
||||
public float prevLidAngle;
|
||||
|
||||
private NonNullList<ItemStack> chestContents;
|
||||
|
||||
private int ticksSinceSync = -1;
|
||||
|
||||
private int numPlayersUsing;
|
||||
private ItemStack[] topStacks;
|
||||
|
||||
//private ItemStack[] topStacks;
|
||||
|
||||
private EnumFacing facing;
|
||||
|
||||
private boolean inventoryTouched;
|
||||
|
||||
private boolean hadStuff;
|
||||
|
||||
private String customName;
|
||||
|
||||
private IronChestType chestType;
|
||||
|
||||
public TileEntityIronChest () {
|
||||
public TileEntityIronChest()
|
||||
{
|
||||
this(IronChestType.IRON);
|
||||
}
|
||||
|
||||
protected TileEntityIronChest (IronChestType type) {
|
||||
protected TileEntityIronChest(IronChestType type)
|
||||
{
|
||||
super();
|
||||
this.chestType = type;
|
||||
this.chestContents = new ItemStack[type.size];
|
||||
this.topStacks = new ItemStack[8];
|
||||
this.chestContents = NonNullList.<ItemStack> func_191197_a(type.size, ItemStack.field_190927_a);
|
||||
//this.topStacks = new ItemStack[8];
|
||||
this.facing = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
public void setContents (ItemStack[] contents) {
|
||||
this.chestContents = new ItemStack[this.getType().size];
|
||||
public void setContents(NonNullList<ItemStack> contents)
|
||||
{
|
||||
this.chestContents = NonNullList.<ItemStack> func_191197_a(this.getType().size, ItemStack.field_190927_a);
|
||||
|
||||
for (int i = 0; i < contents.length; i++) {
|
||||
if (i < this.chestContents.length) {
|
||||
this.chestContents[i] = contents[i];
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
{
|
||||
if (i < this.chestContents.size())
|
||||
{
|
||||
this.chestContents.set(i, contents.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,25 +85,31 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory () {
|
||||
return this.chestContents.length;
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.chestContents.size();
|
||||
}
|
||||
|
||||
public EnumFacing getFacing () {
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
return this.facing;
|
||||
}
|
||||
|
||||
public void setFacing (EnumFacing facing) {
|
||||
public void setFacing(EnumFacing facing)
|
||||
{
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public IronChestType getType () {
|
||||
public IronChestType getType()
|
||||
{
|
||||
IronChestType type = IronChestType.IRON;
|
||||
|
||||
if (this.hasWorldObj()) {
|
||||
if (this.hasWorldObj())
|
||||
{
|
||||
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||
|
||||
if (state.getBlock() == IronChest.ironChestBlock) {
|
||||
if (state.getBlock() == IronChest.ironChestBlock)
|
||||
{
|
||||
type = state.getValue(BlockIronChest.VARIANT_PROP);
|
||||
}
|
||||
}
|
||||
|
@ -100,23 +118,27 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int index) {
|
||||
public ItemStack getStackInSlot(int index)
|
||||
{
|
||||
this.fillWithLoot((EntityPlayer) null);
|
||||
|
||||
this.inventoryTouched = true;
|
||||
|
||||
return this.chestContents[index];
|
||||
return this.func_190576_q().get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty () {
|
||||
public void markDirty()
|
||||
{
|
||||
super.markDirty();
|
||||
|
||||
this.sortTopStacks();
|
||||
//this.sortTopStacks();
|
||||
}
|
||||
|
||||
protected void sortTopStacks () {
|
||||
if (!this.getType().isTransparent() || (this.worldObj != null && this.worldObj.isRemote)) {
|
||||
/*protected void sortTopStacks()
|
||||
{
|
||||
if (!this.getType().isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -127,10 +149,14 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
int compressedIdx = 0;
|
||||
|
||||
mainLoop:
|
||||
for (int i = 0; i < this.getSizeInventory(); i++) {
|
||||
if (this.chestContents[i] != null) {
|
||||
for (int j = 0; j < compressedIdx; j++) {
|
||||
if (tempCopy[j].isItemEqual(this.chestContents[i])) {
|
||||
for (int i = 0; i < this.getSizeInventory(); i++)
|
||||
{
|
||||
if (this.chestContents[i] != null)
|
||||
{
|
||||
for (int j = 0; j < compressedIdx; j++)
|
||||
{
|
||||
if (tempCopy[j].isItemEqual(this.chestContents[i]))
|
||||
{
|
||||
tempCopy[j].func_190920_e(tempCopy[j].func_190916_E() + this.chestContents[i].func_190916_E());
|
||||
continue mainLoop;
|
||||
}
|
||||
|
@ -140,14 +166,17 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasStuff && this.hadStuff) {
|
||||
if (!hasStuff && this.hadStuff)
|
||||
{
|
||||
this.hadStuff = false;
|
||||
|
||||
for (int i = 0; i < this.topStacks.length; i++) {
|
||||
for (int i = 0; i < this.topStacks.length; i++)
|
||||
{
|
||||
this.topStacks[i] = null;
|
||||
}
|
||||
|
||||
if (this.worldObj != null) {
|
||||
if (this.worldObj != null)
|
||||
{
|
||||
IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
|
||||
this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3);
|
||||
}
|
||||
|
@ -157,14 +186,21 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
this.hadStuff = true;
|
||||
|
||||
Arrays.sort(tempCopy, new Comparator<ItemStack>() {
|
||||
Arrays.sort(tempCopy, new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare (ItemStack o1, ItemStack o2) {
|
||||
if (o1 == null) {
|
||||
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.func_190916_E() - o1.func_190916_E();
|
||||
}
|
||||
}
|
||||
|
@ -172,122 +208,85 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
int p = 0;
|
||||
|
||||
for (ItemStack element : tempCopy) {
|
||||
if (element != ItemStack.field_190927_a && element.func_190916_E() > 0) {
|
||||
for (ItemStack element : tempCopy)
|
||||
{
|
||||
if (element != ItemStack.field_190927_a && element.func_190916_E() > 0)
|
||||
{
|
||||
this.topStacks[p++] = element;
|
||||
|
||||
if (p == this.topStacks.length) {
|
||||
if (p == this.topStacks.length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = p; i < this.topStacks.length; i++) {
|
||||
for (int i = p; i < this.topStacks.length; i++)
|
||||
{
|
||||
this.topStacks[i] = null;
|
||||
}
|
||||
|
||||
if (this.worldObj != null) {
|
||||
if (this.worldObj != null)
|
||||
{
|
||||
IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
|
||||
|
||||
this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack decrStackSize (int index, int count) {
|
||||
this.fillWithLoot((EntityPlayer) null);
|
||||
|
||||
ItemStack itemstack = ItemStackHelper.getAndSplit(this.chestContents, index, count);
|
||||
|
||||
if (itemstack != null) {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int index, @Nullable ItemStack stack) {
|
||||
this.fillWithLoot((EntityPlayer) null);
|
||||
|
||||
this.chestContents[index] = stack;
|
||||
|
||||
if (stack != null && stack.func_190916_E() > this.getInventoryStackLimit()) {
|
||||
stack.func_190920_e(this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName () {
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : this.getType().name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName () {
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName (String name) {
|
||||
public void setCustomName(String name)
|
||||
{
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound compound) {
|
||||
public void readFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readFromNBT(compound);
|
||||
|
||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
||||
this.chestContents = NonNullList.<ItemStack> func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);
|
||||
|
||||
if (compound.hasKey("CustomName", Constants.NBT.TAG_STRING)) {
|
||||
if (compound.hasKey("CustomName", Constants.NBT.TAG_STRING))
|
||||
{
|
||||
this.customName = compound.getString("CustomName");
|
||||
}
|
||||
|
||||
if (!this.checkLootAndRead(compound)) {
|
||||
NBTTagList itemList = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int itemNumber = 0; itemNumber < itemList.tagCount(); ++itemNumber) {
|
||||
NBTTagCompound item = itemList.getCompoundTagAt(itemNumber);
|
||||
|
||||
int slot = item.getByte("Slot") & 255;
|
||||
|
||||
if (slot >= 0 && slot < this.chestContents.length) {
|
||||
this.chestContents[slot] = ItemStack.loadItemStackFromNBT(item);
|
||||
}
|
||||
}
|
||||
if (!this.checkLootAndRead(compound))
|
||||
{
|
||||
ItemStackHelper.func_191283_b(compound, this.chestContents);
|
||||
}
|
||||
|
||||
this.facing = EnumFacing.VALUES[compound.getByte("facing")];
|
||||
|
||||
this.sortTopStacks();
|
||||
//this.sortTopStacks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT (NBTTagCompound compound) {
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.writeToNBT(compound);
|
||||
|
||||
if (!this.checkLootAndWrite(compound)) {
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int slot = 0; slot < this.chestContents.length; ++slot) {
|
||||
if (this.chestContents[slot] != null) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
tag.setByte("Slot", (byte) slot);
|
||||
|
||||
this.chestContents[slot].writeToNBT(tag);
|
||||
|
||||
itemList.appendTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
compound.setTag("Items", itemList);
|
||||
if (!this.checkLootAndWrite(compound))
|
||||
{
|
||||
ItemStackHelper.func_191282_a(compound, this.chestContents);
|
||||
}
|
||||
|
||||
compound.setByte("facing", (byte) this.facing.ordinal());
|
||||
|
||||
if (this.hasCustomName()) {
|
||||
if (this.hasCustomName())
|
||||
{
|
||||
compound.setString("CustomName", this.customName);
|
||||
}
|
||||
|
||||
|
@ -295,17 +294,21 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit () {
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer player) {
|
||||
if (this.worldObj == null) {
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
if (this.worldObj == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.worldObj.getTileEntity(this.pos) != this) {
|
||||
if (this.worldObj.getTileEntity(this.pos) != this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -313,7 +316,8 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
public void update()
|
||||
{
|
||||
// Resynchronizes clients with the server state
|
||||
//@formatter:off
|
||||
if (this.worldObj != null && !this.worldObj.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + this.pos.getX() + this.pos.getY() + this.pos.getZ()) % 200 == 0)
|
||||
|
@ -328,20 +332,23 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
new AxisAlignedBB(this.pos.getX() - f, this.pos.getY() - f, this.pos.getZ() - f, this.pos.getX() + 1 + f, this.pos.getY() + 1 + f, this.pos.getZ() + 1 + f)))
|
||||
//@formatter:on
|
||||
{
|
||||
if (player.openContainer instanceof ContainerIronChest) {
|
||||
if (player.openContainer instanceof ContainerIronChest)
|
||||
{
|
||||
++this.numPlayersUsing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.worldObj != null && !this.worldObj.isRemote && this.ticksSinceSync < 0) {
|
||||
if (this.worldObj != null && !this.worldObj.isRemote && this.ticksSinceSync < 0)
|
||||
{
|
||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 3, ((this.numPlayersUsing << 3) & 0xF8) | (this.facing.ordinal() & 0x7));
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote && this.inventoryTouched) {
|
||||
if (!this.worldObj.isRemote && this.inventoryTouched)
|
||||
{
|
||||
this.inventoryTouched = false;
|
||||
|
||||
this.sortTopStacks();
|
||||
//this.sortTopStacks();
|
||||
}
|
||||
|
||||
this.ticksSinceSync++;
|
||||
|
@ -350,7 +357,8 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
float angle = 0.1F;
|
||||
|
||||
if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F) {
|
||||
if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F)
|
||||
{
|
||||
double x = this.pos.getX() + 0.5D;
|
||||
double y = this.pos.getY() + 0.5D;
|
||||
double z = this.pos.getZ() + 0.5D;
|
||||
|
@ -360,22 +368,28 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
//@formatter:on
|
||||
}
|
||||
|
||||
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) {
|
||||
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F)
|
||||
{
|
||||
float currentAngle = this.lidAngle;
|
||||
|
||||
if (this.numPlayersUsing > 0) {
|
||||
if (this.numPlayersUsing > 0)
|
||||
{
|
||||
this.lidAngle += angle;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lidAngle -= angle;
|
||||
}
|
||||
|
||||
if (this.lidAngle > 1.0F) {
|
||||
if (this.lidAngle > 1.0F)
|
||||
{
|
||||
this.lidAngle = 1.0F;
|
||||
}
|
||||
|
||||
float maxAngle = 0.5F;
|
||||
|
||||
if (this.lidAngle < maxAngle && currentAngle >= maxAngle) {
|
||||
if (this.lidAngle < maxAngle && currentAngle >= maxAngle)
|
||||
{
|
||||
double x = this.pos.getX() + 0.5D;
|
||||
double y = this.pos.getY() + 0.5D;
|
||||
double z = this.pos.getZ() + 0.5D;
|
||||
|
@ -385,19 +399,26 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
//@formatter:on
|
||||
}
|
||||
|
||||
if (this.lidAngle < 0.0F) {
|
||||
if (this.lidAngle < 0.0F)
|
||||
{
|
||||
this.lidAngle = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent (int id, int type) {
|
||||
if (id == 1) {
|
||||
public boolean receiveClientEvent(int id, int type)
|
||||
{
|
||||
if (id == 1)
|
||||
{
|
||||
this.numPlayersUsing = type;
|
||||
} else if (id == 2) {
|
||||
}
|
||||
else if (id == 2)
|
||||
{
|
||||
this.facing = EnumFacing.VALUES[type];
|
||||
} else if (id == 3) {
|
||||
}
|
||||
else if (id == 3)
|
||||
{
|
||||
this.facing = EnumFacing.VALUES[type & 0x7];
|
||||
this.numPlayersUsing = (type & 0xF8) >> 3;
|
||||
}
|
||||
|
@ -406,56 +427,68 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void openInventory (EntityPlayer player) {
|
||||
if (!player.isSpectator()) {
|
||||
if (this.worldObj == null) {
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
if (!player.isSpectator())
|
||||
{
|
||||
if (this.worldObj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.numPlayersUsing < 0) {
|
||||
if (this.numPlayersUsing < 0)
|
||||
{
|
||||
this.numPlayersUsing = 0;
|
||||
}
|
||||
|
||||
++this.numPlayersUsing;
|
||||
|
||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numPlayersUsing);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, IronChest.ironChestBlock);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), IronChest.ironChestBlock);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, IronChest.ironChestBlock, false);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), IronChest.ironChestBlock, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory (EntityPlayer player) {
|
||||
if (!player.isSpectator()) {
|
||||
if (this.worldObj == null) {
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
if (!player.isSpectator())
|
||||
{
|
||||
if (this.worldObj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
--this.numPlayersUsing;
|
||||
|
||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numPlayersUsing);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, IronChest.ironChestBlock);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), IronChest.ironChestBlock);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, IronChest.ironChestBlock, false);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), IronChest.ironChestBlock, false);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack[] getTopItemStacks () {
|
||||
return this.topStacks;
|
||||
}
|
||||
//public ItemStack[] getTopItemStacks()
|
||||
//{
|
||||
// return this.topStacks;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket () {
|
||||
public SPacketUpdateTileEntity getUpdatePacket()
|
||||
{
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
compound.setByte("facing", (byte) this.facing.ordinal());
|
||||
|
||||
ItemStack[] stacks = this.buildItemStackDataList();
|
||||
/*ItemStack[] stacks = this.buildItemStackDataList();
|
||||
|
||||
if (stacks != null) {
|
||||
if (stacks != null)
|
||||
{
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int slot = 0; slot < stacks.length; slot++) {
|
||||
if (stacks[slot] != null) {
|
||||
for (int slot = 0; slot < stacks.length; slot++)
|
||||
{
|
||||
if (stacks[slot] != null)
|
||||
{
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
|
||||
item.setByte("Slot", (byte) slot);
|
||||
|
@ -467,58 +500,73 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
compound.setTag("stacks", itemList);
|
||||
}
|
||||
}*/
|
||||
|
||||
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, SPacketUpdateTileEntity pkt) {
|
||||
if (pkt.getTileEntityType() == 0) {
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
|
||||
{
|
||||
if (pkt.getTileEntityType() == 0)
|
||||
{
|
||||
NBTTagCompound compound = pkt.getNbtCompound();
|
||||
|
||||
this.facing = EnumFacing.VALUES[compound.getByte("facing")];
|
||||
|
||||
NBTTagList itemList = compound.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
|
||||
/*NBTTagList itemList = compound.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
ItemStack[] stacks = new ItemStack[this.topStacks.length];
|
||||
|
||||
for (int item = 0; item < stacks.length; item++) {
|
||||
for (int item = 0; item < stacks.length; item++)
|
||||
{
|
||||
NBTTagCompound itemStack = itemList.getCompoundTagAt(item);
|
||||
|
||||
int slot = itemStack.getByte("Slot") & 255;
|
||||
|
||||
if (slot >= 0 && slot < stacks.length) {
|
||||
if (slot >= 0 && slot < stacks.length)
|
||||
{
|
||||
stacks[slot] = ItemStack.loadItemStackFromNBT(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getType().isTransparent() && stacks != null) {
|
||||
if (this.getType().isTransparent() && stacks != null)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < this.topStacks.length; i++) {
|
||||
if (stacks[pos] != null) {
|
||||
for (int i = 0; i < this.topStacks.length; i++)
|
||||
{
|
||||
if (stacks[pos] != null)
|
||||
{
|
||||
this.topStacks[i] = stacks[pos];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.topStacks[i] = null;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack[] buildItemStackDataList () {
|
||||
if (this.getType().isTransparent()) {
|
||||
/*public ItemStack[] buildItemStackDataList()
|
||||
{
|
||||
if (this.getType().isTransparent())
|
||||
{
|
||||
ItemStack[] sortList = new ItemStack[this.topStacks.length];
|
||||
|
||||
int pos = 0;
|
||||
|
||||
for (ItemStack is : this.topStacks) {
|
||||
if (is != null) {
|
||||
for (ItemStack is : this.topStacks)
|
||||
{
|
||||
if (is != null)
|
||||
{
|
||||
sortList[pos++] = is;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sortList[pos++] = null;
|
||||
}
|
||||
}
|
||||
|
@ -527,75 +575,72 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack removeStackFromSlot (int index) {
|
||||
this.fillWithLoot((EntityPlayer) null);
|
||||
|
||||
return ItemStackHelper.getAndRemove(this.chestContents, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int index, ItemStack stack) {
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack)
|
||||
{
|
||||
return this.getType().acceptsStack(stack);
|
||||
}
|
||||
|
||||
public void rotateAround () {
|
||||
public void rotateAround()
|
||||
{
|
||||
this.setFacing(this.facing.rotateY());
|
||||
|
||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 2, this.facing.ordinal());
|
||||
}
|
||||
|
||||
public void wasPlaced (EntityLivingBase entityliving, ItemStack stack) {
|
||||
public void wasPlaced(EntityLivingBase entityliving, ItemStack stack)
|
||||
{
|
||||
}
|
||||
|
||||
public void removeAdornments () {
|
||||
public void removeAdornments()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField (int id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField (int id, int value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount () {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear () {
|
||||
this.fillWithLoot((EntityPlayer) null);
|
||||
|
||||
for (int slot = 0; slot < this.chestContents.length; ++slot) {
|
||||
this.chestContents[slot] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer (InventoryPlayer playerInventory, EntityPlayer playerIn) {
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
this.fillWithLoot((EntityPlayer) null);
|
||||
|
||||
return new ContainerIronChest(playerInventory, this, this.chestType, this.chestType.xSize, this.chestType.ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID () {
|
||||
public String getGuiID()
|
||||
{
|
||||
return "IronChest:" + this.getType().name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderBreaking () {
|
||||
public boolean canRenderBreaking()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag () {
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return this.writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NonNullList<ItemStack> func_190576_q()
|
||||
{
|
||||
return this.chestContents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_191420_l()
|
||||
{
|
||||
for (ItemStack itemstack : this.chestContents)
|
||||
{
|
||||
if (!itemstack.func_190926_b())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,31 +12,31 @@ package cpw.mods.ironchest.client;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.primitives.SignedBytes;
|
||||
|
||||
import cpw.mods.ironchest.BlockIronChest;
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
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.EnumFacing;
|
||||
|
||||
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileEntityIronChest>
|
||||
{
|
||||
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()
|
||||
|
@ -141,7 +141,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
GlStateManager.popMatrix();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
if (type.isTransparent()
|
||||
/*if (type.isTransparent()
|
||||
&& tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d)
|
||||
{
|
||||
this.random.setSeed(254L);
|
||||
|
@ -210,7 +210,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
"authorList": ["cpw"],
|
||||
"credits": "By cpw, based on an original idea by Lishid",
|
||||
"logoFile": "",
|
||||
"screenshots": [
|
||||
],
|
||||
"screenshots": [],
|
||||
"parent":"",
|
||||
"dependencies": [
|
||||
]
|
||||
"dependencies": []
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue