Search in sources :

Example 1 with InventoryLargeChest

use of net.minecraft.inventory.InventoryLargeChest in project Bookshelf by Darkhax-Minecraft.

the class BlockBasicChest method getContainer.

@Override
public ILockableContainer getContainer(World world, BlockPos pos, boolean locked) {
    final TileEntity tile = world.getTileEntity(pos);
    if (!(tile instanceof TileEntityBasicChest)) {
        return null;
    } else {
        ILockableContainer myChest = (TileEntityBasicChest) tile;
        final IChestType myType = ((TileEntityBasicChest) tile).getType();
        if (!locked && this.isBlocked(world, pos)) {
            return null;
        } else {
            for (final EnumFacing facing : EnumFacing.Plane.HORIZONTAL) {
                final BlockPos adjPos = pos.offset(facing);
                final TileEntity adjTile = world.getTileEntity(adjPos);
                if (world.getBlockState(adjPos).getBlock() == this && adjTile instanceof TileEntityBasicChest && ((TileEntityBasicChest) adjTile).getType() == myType) {
                    if (this.isBlocked(world, adjPos)) {
                        return null;
                    }
                    if (facing != EnumFacing.WEST && facing != EnumFacing.NORTH) {
                        myChest = new InventoryLargeChest("container.chestDouble", myChest, (TileEntityBasicChest) adjTile);
                    } else {
                        myChest = new InventoryLargeChest("container.chestDouble", (TileEntityBasicChest) adjTile, myChest);
                    }
                }
            }
            return myChest;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ILockableContainer(net.minecraft.world.ILockableContainer) IChestType(net.darkhax.bookshelf.builder.ChestBuilder.IChestType) InventoryLargeChest(net.minecraft.inventory.InventoryLargeChest) EnumFacing(net.minecraft.util.EnumFacing) TileEntityBasicChest(net.darkhax.bookshelf.block.tileentity.TileEntityBasicChest) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with InventoryLargeChest

use of net.minecraft.inventory.InventoryLargeChest 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)

Example 3 with InventoryLargeChest

use of net.minecraft.inventory.InventoryLargeChest in project MorePlanets by SteveKunG.

the class BlockCheeseSporeChest method getLockableContainer.

@Override
public ILockableContainer getLockableContainer(World world, BlockPos pos) {
    TileEntity tileentity = world.getTileEntity(pos);
    if (!(tileentity instanceof TileEntityCheeseSporeChest)) {
        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 TileEntityCheeseSporeChest) {
                        if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.chestDouble"), (ILockableContainer) object, (TileEntityCheeseSporeChest) tileentity1);
                        } else {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.chestDouble"), (TileEntityCheeseSporeChest) tileentity1, (ILockableContainer) object);
                        }
                    }
                }
            }
            return (ILockableContainer) object;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ILockableContainer(net.minecraft.world.ILockableContainer) TileEntityCheeseSporeChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityCheeseSporeChest) 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)

Example 4 with InventoryLargeChest

use of net.minecraft.inventory.InventoryLargeChest in project MorePlanets by SteveKunG.

the class BlockChalosAncientChest method getLockableContainer.

public ILockableContainer getLockableContainer(World world, BlockPos pos) {
    TileEntity tileentity = world.getTileEntity(pos);
    if (!(tileentity instanceof TileEntityChalosAncientChest)) {
        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 TileEntityChalosAncientChest) {
                        if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.chalos.ancientchest.name"), (ILockableContainer) object, (TileEntityChalosAncientChest) tileentity1);
                        } else {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.chalos.ancientchest.name"), (TileEntityChalosAncientChest) tileentity1, (ILockableContainer) object);
                        }
                    }
                }
            }
            return (ILockableContainer) object;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ILockableContainer(net.minecraft.world.ILockableContainer) TileEntityChalosAncientChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosAncientChest) 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)

Example 5 with InventoryLargeChest

use of net.minecraft.inventory.InventoryLargeChest in project MorePlanets by SteveKunG.

the class BlockNibiruAncientChest method getLockableContainer.

public ILockableContainer getLockableContainer(World world, BlockPos pos) {
    TileEntity tileentity = world.getTileEntity(pos);
    if (!(tileentity instanceof TileEntityNibiruAncientChest)) {
        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 TileEntityNibiruAncientChest) {
                        if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.nibiru.ancientchest.name"), (ILockableContainer) object, (TileEntityNibiruAncientChest) tileentity1);
                        } else {
                            object = new InventoryLargeChest(GCCoreUtil.translate("container.nibiru.ancientchest.name"), (TileEntityNibiruAncientChest) tileentity1, (ILockableContainer) object);
                        }
                    }
                }
            }
            return (ILockableContainer) object;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ILockableContainer(net.minecraft.world.ILockableContainer) TileEntityNibiruAncientChest(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNibiruAncientChest) 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

InventoryLargeChest (net.minecraft.inventory.InventoryLargeChest)7 TileEntity (net.minecraft.tileentity.TileEntity)7 EnumFacing (net.minecraft.util.EnumFacing)7 BlockPos (net.minecraft.util.math.BlockPos)7 ILockableContainer (net.minecraft.world.ILockableContainer)7 Iterator (java.util.Iterator)6 Block (net.minecraft.block.Block)6 TileEntityBasicChest (net.darkhax.bookshelf.block.tileentity.TileEntityBasicChest)1 IChestType (net.darkhax.bookshelf.builder.ChestBuilder.IChestType)1 TileEntityChalosAncientChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosAncientChest)1 TileEntityCheeseSporeChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityCheeseSporeChest)1 TileEntityDionaAncientChest (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaAncientChest)1 TileEntityAlienBerryChest (stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityAlienBerryChest)1 TileEntityInfectedChest (stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityInfectedChest)1 TileEntityNibiruAncientChest (stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNibiruAncientChest)1