Update Iron Chests to 1.11.2!
This commit is contained in:
parent
e5e601a1b8
commit
9515e682ef
|
@ -33,7 +33,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "mezz.jei:jei_1.11:4.0.1.193"
|
||||
deobfCompile "mezz.jei:jei_1.11.2:4.2.7.241"
|
||||
}
|
||||
|
||||
// This is our group. I'm cpw.mods
|
||||
|
@ -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.2153"
|
||||
version = "1.11.2-13.20.0.2252"
|
||||
mappings = "snapshot_20161118"
|
||||
runDir = "run"
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ public class ContainerIronChest extends Container
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
public boolean canInteractWith(EntityPlayer playerIn)
|
||||
{
|
||||
return this.chest.isUsableByPlayer(player);
|
||||
return this.chest.isUsableByPlayer(playerIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,10 +83,11 @@ public class ContainerIronChest extends Container
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
public void onContainerClosed(EntityPlayer playerIn)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
this.chest.closeInventory(entityplayer);
|
||||
super.onContainerClosed(playerIn);
|
||||
|
||||
this.chest.closeInventory(playerIn);
|
||||
}
|
||||
|
||||
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
||||
|
@ -111,8 +112,7 @@ public class ContainerIronChest extends Container
|
|||
{
|
||||
for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++)
|
||||
{
|
||||
this.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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class IronChest
|
|||
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
@EventHandler
|
||||
public void onMissingMappings(FMLMissingMappingsEvent event)
|
||||
{
|
||||
for (MissingMapping mapping : event.get())
|
||||
|
|
|
@ -37,35 +37,37 @@ public class ItemChestChanger extends Item
|
|||
this.setCreativeTab(CreativeTabs.MISC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
*/
|
||||
@Override
|
||||
//@formatter:off
|
||||
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
//@formatter:on
|
||||
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
ItemStack itemstack = playerIn.getHeldItem(hand);
|
||||
|
||||
if (worldIn.isRemote)
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
if (this.type.canUpgrade(IronChestType.WOOD))
|
||||
{
|
||||
if (!(world.getBlockState(pos).getBlock() instanceof BlockChest))
|
||||
if (!(worldIn.getBlockState(pos).getBlock() instanceof BlockChest))
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//@formatter:off
|
||||
if (world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||
//@formatter:on
|
||||
if (worldIn.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = worldIn.getTileEntity(pos);
|
||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||
|
||||
NonNullList<ItemStack> chestContents = NonNullList.<ItemStack> withSize(27, ItemStack.EMPTY);
|
||||
EnumFacing chestFacing = EnumFacing.DOWN;
|
||||
|
||||
|
@ -76,6 +78,7 @@ public class ItemChestChanger extends Item
|
|||
chestContents = ((TileEntityIronChest) te).getItems();
|
||||
chestFacing = ((TileEntityIronChest) te).getFacing();
|
||||
newchest = this.type.target.makeEntity();
|
||||
|
||||
if (newchest == null)
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
|
@ -83,7 +86,7 @@ public class ItemChestChanger extends Item
|
|||
}
|
||||
else if (te instanceof TileEntityChest)
|
||||
{
|
||||
IBlockState chestState = world.getBlockState(pos);
|
||||
IBlockState chestState = worldIn.getBlockState(pos);
|
||||
chestFacing = chestState.getValue(BlockChest.FACING);
|
||||
TileEntityChest chest = (TileEntityChest) te;
|
||||
|
||||
|
@ -95,11 +98,14 @@ public class ItemChestChanger extends Item
|
|||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
chestContents = NonNullList.<ItemStack> withSize(chest.getSizeInventory(), ItemStack.EMPTY);
|
||||
|
||||
for (int i = 0; i < chestContents.size(); i++)
|
||||
{
|
||||
chestContents.set(i, chest.getStackInSlot(i));
|
||||
}
|
||||
|
||||
newchest = this.type.target.makeEntity();
|
||||
}
|
||||
}
|
||||
|
@ -111,17 +117,17 @@ public class ItemChestChanger extends Item
|
|||
((TileEntityChest) te).checkForAdjacentChests();
|
||||
}
|
||||
|
||||
world.removeTileEntity(pos);
|
||||
world.setBlockToAir(pos);
|
||||
worldIn.removeTileEntity(pos);
|
||||
worldIn.setBlockToAir(pos);
|
||||
|
||||
IBlockState iblockstate = IronChest.ironChestBlock.getDefaultState().withProperty(BlockIronChest.VARIANT_PROP, this.type.target);
|
||||
|
||||
world.setTileEntity(pos, newchest);
|
||||
world.setBlockState(pos, iblockstate, 3);
|
||||
worldIn.setTileEntity(pos, newchest);
|
||||
worldIn.setBlockState(pos, iblockstate, 3);
|
||||
|
||||
world.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
|
||||
worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
|
||||
|
||||
TileEntity te2 = world.getTileEntity(pos);
|
||||
TileEntity te2 = worldIn.getTileEntity(pos);
|
||||
|
||||
if (te2 instanceof TileEntityIronChest)
|
||||
{
|
||||
|
@ -129,9 +135,10 @@ public class ItemChestChanger extends Item
|
|||
((TileEntityIronChest) te2).setFacing(chestFacing);
|
||||
}
|
||||
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
stack.setCount(player.capabilities.isCreativeMode ? stack.getCount() : stack.getCount() - 1);
|
||||
if (!playerIn.capabilities.isCreativeMode)
|
||||
{
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.inventory.Container;
|
|||
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;
|
||||
|
@ -35,24 +34,31 @@ import net.minecraftforge.common.util.Constants;
|
|||
|
||||
public class TileEntityIronChest extends TileEntityLockableLoot implements ITickable
|
||||
{
|
||||
/** Chest Contents */
|
||||
public NonNullList<ItemStack> chestContents;
|
||||
|
||||
/** Crystal chest top stacks */
|
||||
private NonNullList<ItemStack> topStacks;
|
||||
|
||||
/** The current angle of the lid (between 0 and 1) */
|
||||
public float lidAngle;
|
||||
|
||||
/** The angle of the lid last tick */
|
||||
public float prevLidAngle;
|
||||
|
||||
private NonNullList<ItemStack> chestContents;
|
||||
|
||||
private int ticksSinceSync = -1;
|
||||
|
||||
/** The number of players currently using this chest */
|
||||
public int numPlayersUsing;
|
||||
|
||||
private NonNullList<ItemStack> topStacks;
|
||||
/** Server sync counter (once per 20 ticks) */
|
||||
private int ticksSinceSync;
|
||||
|
||||
/** Direction chest is facing */
|
||||
private EnumFacing facing;
|
||||
|
||||
/** If the inventory got touched */
|
||||
private boolean inventoryTouched;
|
||||
|
||||
/** If the inventory had items */
|
||||
private boolean hadStuff;
|
||||
|
||||
private String customName;
|
||||
|
@ -81,7 +87,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
{
|
||||
if (i < this.chestContents.size())
|
||||
{
|
||||
this.chestContents.set(i, contents.get(i));
|
||||
this.getItems().set(i, contents.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +97,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.chestContents.size();
|
||||
return this.getItems().size();
|
||||
}
|
||||
|
||||
public EnumFacing getFacing()
|
||||
|
@ -99,11 +105,6 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
return this.facing;
|
||||
}
|
||||
|
||||
public void setFacing(EnumFacing facing)
|
||||
{
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public IronChestType getType()
|
||||
{
|
||||
IronChestType type = IronChestType.IRON;
|
||||
|
@ -152,19 +153,22 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
int compressedIdx = 0;
|
||||
|
||||
mainLoop: for (int i = 0; i < this.getSizeInventory(); i++)
|
||||
mainLoop:
|
||||
for (int i = 0; i < this.getSizeInventory(); i++)
|
||||
{
|
||||
if (this.chestContents.get(i) != ItemStack.EMPTY)
|
||||
if (this.getItems().get(i) != ItemStack.EMPTY)
|
||||
{
|
||||
for (int j = 0; j < compressedIdx; j++)
|
||||
{
|
||||
if (tempCopy.get(j).isItemEqual(this.chestContents.get(i)))
|
||||
if (tempCopy.get(j).isItemEqual(this.getItems().get(i)))
|
||||
{
|
||||
tempCopy.get(j).setCount(tempCopy.get(j).getCount() + this.chestContents.get(i).getCount());
|
||||
tempCopy.get(j).grow(this.getItems().get(i).getCount());
|
||||
|
||||
continue mainLoop;
|
||||
}
|
||||
}
|
||||
tempCopy.set(compressedIdx++, this.chestContents.get(i).copy());
|
||||
|
||||
tempCopy.set(compressedIdx++, this.getItems().get(i).copy());
|
||||
hasStuff = true;
|
||||
}
|
||||
}
|
||||
|
@ -173,9 +177,9 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
{
|
||||
this.hadStuff = false;
|
||||
|
||||
for (int i = 0; i < this.topStacks.size(); i++)
|
||||
for (int i = 0; i < this.getTopItems().size(); i++)
|
||||
{
|
||||
this.topStacks.set(i, ItemStack.EMPTY);
|
||||
this.getTopItems().set(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
if (this.world != null)
|
||||
|
@ -189,15 +193,16 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
this.hadStuff = true;
|
||||
|
||||
Collections.sort(tempCopy, new Comparator<ItemStack>() {
|
||||
Collections.sort(tempCopy, new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
if (stack1 == null)
|
||||
if (stack1 == ItemStack.EMPTY)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (stack2 == null)
|
||||
else if (stack2 == ItemStack.EMPTY)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -210,23 +215,22 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
int p = 0;
|
||||
|
||||
for (int i = 0; i < tempCopy.size(); i++)
|
||||
for (ItemStack element : tempCopy)
|
||||
{
|
||||
ItemStack element = tempCopy.get(i);
|
||||
if (element != ItemStack.EMPTY && element.getCount() > 0)
|
||||
{
|
||||
this.topStacks.set(p++, element);
|
||||
this.getTopItems().set(p++, element);
|
||||
|
||||
if (p == this.topStacks.size())
|
||||
if (p == this.getTopItems().size())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = p; i < this.topStacks.size(); i++)
|
||||
for (int i = p; i < this.getTopItems().size(); i++)
|
||||
{
|
||||
this.topStacks.set(i, ItemStack.EMPTY);
|
||||
this.getTopItems().set(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
if (this.world != null)
|
||||
|
@ -323,18 +327,13 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
public void update()
|
||||
{
|
||||
// Resynchronizes clients with the server state
|
||||
//@formatter:off
|
||||
if (this.world != null && !this.world.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + this.pos.getX() + this.pos.getY() + this.pos.getZ()) % 200 == 0)
|
||||
//@formatter:on
|
||||
{
|
||||
this.numPlayersUsing = 0;
|
||||
|
||||
float f = 5.0F;
|
||||
|
||||
//@formatter:off
|
||||
for (EntityPlayer player : this.world.getEntitiesWithinAABB(EntityPlayer.class,
|
||||
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
|
||||
for (EntityPlayer player : this.world.getEntitiesWithinAABB(EntityPlayer.class, 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)))
|
||||
{
|
||||
if (player.openContainer instanceof ContainerIronChest)
|
||||
{
|
||||
|
@ -367,9 +366,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
double y = this.pos.getY() + 0.5D;
|
||||
double z = this.pos.getZ() + 0.5D;
|
||||
|
||||
//@formatter:off
|
||||
this.world.playSound(null, x, y, z, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F)
|
||||
|
@ -398,9 +395,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
double y = this.pos.getY() + 0.5D;
|
||||
double z = this.pos.getZ() + 0.5D;
|
||||
|
||||
//@formatter:off
|
||||
this.world.playSound(null, x, y, z, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
if (this.lidAngle < 0.0F)
|
||||
|
@ -471,9 +466,9 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
}
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> getTopItemStacks()
|
||||
public void setFacing(EnumFacing facing)
|
||||
{
|
||||
return this.topStacks;
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -485,26 +480,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
NonNullList<ItemStack> stacks = this.buildItemStackDataList();
|
||||
|
||||
if (stacks != null)
|
||||
{
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int slot = 0; slot < stacks.size(); slot++)
|
||||
{
|
||||
if (stacks.get(slot) != ItemStack.EMPTY)
|
||||
{
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
|
||||
item.setByte("Slot", (byte) slot);
|
||||
|
||||
stacks.get(slot).writeToNBT(item);
|
||||
|
||||
itemList.appendTag(item);
|
||||
}
|
||||
}
|
||||
|
||||
compound.setTag("stacks", itemList);
|
||||
}
|
||||
ItemStackHelper.saveAllItems(compound, stacks);
|
||||
|
||||
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
||||
}
|
||||
|
@ -518,35 +494,23 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
this.facing = EnumFacing.VALUES[compound.getByte("facing")];
|
||||
|
||||
NBTTagList itemList = compound.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
|
||||
NonNullList<ItemStack> stacks = NonNullList.<ItemStack> withSize(this.getTopItems().size(), ItemStack.EMPTY);
|
||||
|
||||
ItemStack[] stacks = new ItemStack[this.topStacks.size()];
|
||||
ItemStackHelper.loadAllItems(compound, stacks);
|
||||
|
||||
for (int item = 0; item < stacks.length; item++)
|
||||
{
|
||||
NBTTagCompound itemNBT = itemList.getCompoundTagAt(item);
|
||||
|
||||
int slot = itemNBT.getByte("Slot") & 255;
|
||||
|
||||
if (slot >= 0 && slot < stacks.length)
|
||||
{
|
||||
stacks[slot] = new ItemStack(itemNBT);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getType().isTransparent() && stacks != null)
|
||||
if (this.getType().isTransparent())
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < this.topStacks.size(); i++)
|
||||
for (int i = 0; i < this.getTopItems().size(); i++)
|
||||
{
|
||||
if (stacks[pos] != null)
|
||||
if (stacks.get(pos) != ItemStack.EMPTY)
|
||||
{
|
||||
this.topStacks.set(i, stacks[pos]);
|
||||
this.getTopItems().set(i, stacks.get(pos));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.topStacks.set(i, ItemStack.EMPTY);
|
||||
this.getTopItems().set(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
@ -559,13 +523,12 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
{
|
||||
if (this.getType().isTransparent())
|
||||
{
|
||||
NonNullList<ItemStack> sortList = NonNullList.<ItemStack> withSize(this.topStacks.size(), ItemStack.EMPTY);
|
||||
NonNullList<ItemStack> sortList = NonNullList.<ItemStack> withSize(this.getTopItems().size(), ItemStack.EMPTY);
|
||||
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < this.topStacks.size(); i++)
|
||||
for (ItemStack is : this.topStacks)
|
||||
{
|
||||
ItemStack is = this.topStacks.get(i);
|
||||
if (is != null)
|
||||
{
|
||||
sortList.set(pos++, is);
|
||||
|
@ -579,7 +542,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
return sortList;
|
||||
}
|
||||
|
||||
return null;
|
||||
return NonNullList.<ItemStack> withSize(this.getTopItems().size(), ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -635,6 +598,11 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
return this.chestContents;
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> getTopItems()
|
||||
{
|
||||
return this.topStacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileEntityIronChest>
|
||||
{
|
||||
|
@ -81,11 +80,14 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
{
|
||||
this.bindTexture(type.modelTexture);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (type == IronChestType.CRYSTAL)
|
||||
{
|
||||
GlStateManager.disableCull();
|
||||
}
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.translate((float) x, (float) y + 1F, (float) z + 1F);
|
||||
GlStateManager.scale(1F, -1F, -1F);
|
||||
|
@ -121,7 +123,9 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
}
|
||||
|
||||
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
float lidangle = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks;
|
||||
|
||||
lidangle = 1F - lidangle;
|
||||
lidangle = 1F - lidangle * lidangle * lidangle;
|
||||
|
||||
|
@ -133,22 +137,26 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
this.model.chestLid.rotateAngleX = -lidangle * halfPI;
|
||||
// Render the chest itself
|
||||
this.model.renderAll();
|
||||
|
||||
if (destroyStage >= 0)
|
||||
{
|
||||
GlStateManager.matrixMode(5890);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(5888);
|
||||
}
|
||||
|
||||
if (type == IronChestType.CRYSTAL)
|
||||
{
|
||||
GlStateManager.enableCull();
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
if (type.isTransparent() && te.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d)
|
||||
{
|
||||
this.random.setSeed(254L);
|
||||
|
||||
float shiftX;
|
||||
float shiftY;
|
||||
float shiftZ;
|
||||
|
@ -156,7 +164,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
float blockScale = 0.70F;
|
||||
float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTicks;
|
||||
|
||||
if (te.getTopItemStacks().get(1) == ItemStack.EMPTY)
|
||||
if (te.getTopItems().get(1).isEmpty())
|
||||
{
|
||||
shift = 8;
|
||||
blockScale = 0.85F;
|
||||
|
@ -168,32 +176,35 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
customitem.setWorld(this.getWorld());
|
||||
customitem.hoverStart = 0F;
|
||||
|
||||
NonNullList<ItemStack> stacks = te.getTopItemStacks();
|
||||
for (int i = 0; i < stacks.size(); i++)
|
||||
for (ItemStack item : te.getTopItems())
|
||||
{
|
||||
ItemStack item = stacks.get(i);
|
||||
if (shift > shifts.length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (item == ItemStack.EMPTY)
|
||||
{
|
||||
shift++;
|
||||
continue;
|
||||
}
|
||||
|
||||
shiftX = shifts[shift][0];
|
||||
shiftY = shifts[shift][1];
|
||||
shiftZ = shifts[shift][2];
|
||||
shift++;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(shiftX, shiftY, shiftZ);
|
||||
GlStateManager.rotate(timeD, 0F, 1F, 0F);
|
||||
GlStateManager.scale(blockScale, blockScale, blockScale);
|
||||
|
||||
customitem.setEntityItemStack(item);
|
||||
|
||||
if (this.itemRenderer == null)
|
||||
{
|
||||
this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) {
|
||||
this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem())
|
||||
{
|
||||
@Override
|
||||
public int getModelCount(ItemStack stack)
|
||||
{
|
||||
|
@ -215,6 +226,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
}
|
||||
|
||||
this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTicks);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue