Search in sources :

Example 1 with TileEntityInfectedChest

use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityInfectedChest in project MorePlanets by SteveKunG.

the class BlockInfectedChest method getLockableContainer.

@Override
public ILockableContainer getLockableContainer(World world, BlockPos pos) {
    TileEntity tileentity = world.getTileEntity(pos);
    if (!(tileentity instanceof TileEntityInfectedChest)) {
        return null;
    } else {
        Object object = tileentity;
        if (this.isBlocked(world, pos)) {
            return null;
        } else {
            Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator();
            while (iterator.hasNext()) {
                EnumFacing enumfacing = (EnumFacing) iterator.next();
                BlockPos blockpos1 = pos.offset(enumfacing);
                Block block = world.getBlockState(blockpos1).getBlock();
                if (block == this) {
                    if (this.isBlocked(world, blockpos1)) {
                        return null;
                    }
                    TileEntity tileentity1 = world.getTileEntity(blockpos1);
                    if (tileentity1 instanceof TileEntityInfectedChest) {
                        if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.chestDouble"), (ILockableContainer) object, (TileEntityInfectedChest) tileentity1);
                        } else {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.chestDouble"), (TileEntityInfectedChest) tileentity1, (ILockableContainer) object);
                        }
                    }
                }
            }
            return (ILockableContainer) object;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ILockableContainer(net.minecraft.world.ILockableContainer) TileEntityInfectedChest(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityInfectedChest) InventoryLargeChest(net.minecraft.inventory.InventoryLargeChest) EnumFacing(net.minecraft.util.EnumFacing) Iterator(java.util.Iterator) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Iterator (java.util.Iterator)1 Block (net.minecraft.block.Block)1 InventoryLargeChest (net.minecraft.inventory.InventoryLargeChest)1 TileEntity (net.minecraft.tileentity.TileEntity)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 ILockableContainer (net.minecraft.world.ILockableContainer)1 TileEntityInfectedChest (stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityInfectedChest)1