Search in sources :

Example 1 with TileEntityWoodenCrate

use of blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate in project ImmersiveEngineering by BluSunrize.

the class VillageEngineersHouse method placeCrate.

protected boolean placeCrate(World world, StructureBoundingBox box, Random rand, int x, int y, int z) {
    int i1 = this.getXWithOffset(x, z);
    int j1 = this.getYWithOffset(y);
    int k1 = this.getZWithOffset(x, z);
    BlockPos pos = new BlockPos(i1, j1, k1);
    if (box.isVecInside(pos) && (world.getBlockState(pos) != IEContent.blockWoodenDevice0.getStateFromMeta(0))) {
        world.setBlockState(pos, IEContent.blockWoodenDevice0.getStateFromMeta(0), 2);
        TileEntity tile = world.getTileEntity(pos);
        if (tile instanceof TileEntityWoodenCrate)
            ((TileEntityWoodenCrate) tile).lootTable = woodenCrateLoot;
        return true;
    } else
        return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) BlockPos(net.minecraft.util.math.BlockPos) TileEntityWoodenCrate(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate)

Example 2 with TileEntityWoodenCrate

use of blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate in project ImmersiveEngineering by BluSunrize.

the class CommonProxy method getServerGuiElement.

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    if (ID >= Lib.GUIID_Base_Item) {
        EntityEquipmentSlot slot = EntityEquipmentSlot.values()[ID / 100];
        //Slot determined, get actual ID
        ID %= 100;
        ItemStack item = player.getItemStackFromSlot(slot);
        if (item != null && item.getItem() instanceof IGuiItem && ((IGuiItem) item.getItem()).getGuiID(item) == ID) {
            if (ID == Lib.GUIID_Revolver && item.getItem() instanceof ItemRevolver)
                return new ContainerRevolver(player.inventory, world, slot, item);
            if (ID == Lib.GUIID_Toolbox && item.getItem() instanceof ItemToolbox)
                return new ContainerToolbox(player.inventory, world, slot, item);
        }
    } else {
        TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
        if (te instanceof IGuiTile) {
            Object gui = null;
            if (ID == Lib.GUIID_CokeOven && te instanceof TileEntityCokeOven)
                gui = new ContainerCokeOven(player.inventory, (TileEntityCokeOven) te);
            if (ID == Lib.GUIID_BlastFurnace && te instanceof TileEntityBlastFurnace)
                gui = new ContainerBlastFurnace(player.inventory, (TileEntityBlastFurnace) te);
            if (ID == Lib.GUIID_WoodenCrate && te instanceof TileEntityWoodenCrate)
                gui = new ContainerCrate(player.inventory, (TileEntityWoodenCrate) te);
            if (ID == Lib.GUIID_Workbench && te instanceof TileEntityModWorkbench)
                gui = new ContainerModWorkbench(player.inventory, (TileEntityModWorkbench) te);
            if (ID == Lib.GUIID_Sorter && te instanceof TileEntitySorter)
                gui = new ContainerSorter(player.inventory, (TileEntitySorter) te);
            if (ID == Lib.GUIID_Squeezer && te instanceof TileEntitySqueezer)
                gui = new ContainerSqueezer(player.inventory, (TileEntitySqueezer) te);
            if (ID == Lib.GUIID_Fermenter && te instanceof TileEntityFermenter)
                gui = new ContainerFermenter(player.inventory, (TileEntityFermenter) te);
            if (ID == Lib.GUIID_Refinery && te instanceof TileEntityRefinery)
                gui = new ContainerRefinery(player.inventory, (TileEntityRefinery) te);
            if (ID == Lib.GUIID_ArcFurnace && te instanceof TileEntityArcFurnace)
                gui = new ContainerArcFurnace(player.inventory, (TileEntityArcFurnace) te);
            if (ID == Lib.GUIID_Assembler && te instanceof TileEntityAssembler)
                gui = new ContainerAssembler(player.inventory, (TileEntityAssembler) te);
            if (ID == Lib.GUIID_AutoWorkbench && te instanceof TileEntityAutoWorkbench)
                gui = new ContainerAutoWorkbench(player.inventory, (TileEntityAutoWorkbench) te);
            if (ID == Lib.GUIID_Mixer && te instanceof TileEntityMixer)
                gui = new ContainerMixer(player.inventory, (TileEntityMixer) te);
            if (ID == Lib.GUIID_Turret && te instanceof TileEntityTurret)
                gui = new ContainerTurret(player.inventory, (TileEntityTurret) te);
            if (ID == Lib.GUIID_FluidSorter && te instanceof TileEntityFluidSorter)
                gui = new ContainerFluidSorter(player.inventory, (TileEntityFluidSorter) te);
            if (ID == Lib.GUIID_Belljar && te instanceof TileEntityBelljar)
                gui = new ContainerBelljar(player.inventory, (TileEntityBelljar) te);
            if (ID == Lib.GUIID_ToolboxBlock && te instanceof TileEntityToolbox)
                gui = new ContainerToolboxBlock(player.inventory, (TileEntityToolbox) te);
            if (gui != null)
                ((IGuiTile) te).onGuiOpened(player, false);
            return gui;
        }
    }
    return null;
}
Also used : TileEntityModWorkbench(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityModWorkbench) EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) IGuiItem(blusunrize.immersiveengineering.common.items.IEItemInterfaces.IGuiItem) TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCokeOven(blusunrize.immersiveengineering.common.blocks.stone.TileEntityCokeOven) TileEntitySorter(blusunrize.immersiveengineering.common.blocks.wooden.TileEntitySorter) TileEntityBlastFurnace(blusunrize.immersiveengineering.common.blocks.stone.TileEntityBlastFurnace) BlockPos(net.minecraft.util.math.BlockPos) TileEntityFluidSorter(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityFluidSorter) ItemToolbox(blusunrize.immersiveengineering.common.items.ItemToolbox) IGuiTile(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGuiTile) TileEntityWoodenCrate(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate) ItemRevolver(blusunrize.immersiveengineering.common.items.ItemRevolver) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TileEntityWoodenCrate (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate)2 TileEntity (net.minecraft.tileentity.TileEntity)2 BlockPos (net.minecraft.util.math.BlockPos)2 IGuiTile (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGuiTile)1 TileEntityBlastFurnace (blusunrize.immersiveengineering.common.blocks.stone.TileEntityBlastFurnace)1 TileEntityCokeOven (blusunrize.immersiveengineering.common.blocks.stone.TileEntityCokeOven)1 TileEntityFluidSorter (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityFluidSorter)1 TileEntityModWorkbench (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityModWorkbench)1 TileEntitySorter (blusunrize.immersiveengineering.common.blocks.wooden.TileEntitySorter)1 IGuiItem (blusunrize.immersiveengineering.common.items.IEItemInterfaces.IGuiItem)1 ItemRevolver (blusunrize.immersiveengineering.common.items.ItemRevolver)1 ItemToolbox (blusunrize.immersiveengineering.common.items.ItemToolbox)1 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)1 ItemStack (net.minecraft.item.ItemStack)1