Java Code Examples for net.minecraft.entity.player.InventoryPlayer

The following examples show how to use net.minecraft.entity.player.InventoryPlayer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public GTContainerDisassembler(InventoryPlayer player, GTTileDisassembler tile) {
	super(tile);
	this.addSlotToContainer(new SlotCustom(tile, 0, 53, 25, tile.filter));
	for (int y = 0; y < 3; ++y) {
		for (int x = 0; x < 3; ++x) {
			this.addSlotToContainer(new SlotOutput(player.player, tile, 1 + x + y * 3, 107 + x * 18, 7 + y * 18));
		}
	}
	this.addSlotToContainer(new SlotDischarge(tile, Integer.MAX_VALUE, 10, 8, 62));
	for (int i = 0; i < 4; ++i) {
		this.addSlotToContainer(new GTSlotUpgrade(tile, 11 + i, 62 + (i * 18), 62));
	}
	this.addComponent(new GTGuiCompBasicString("Disassembler", 28, 5));
	this.addComponent(new MachineProgressComp(tile, machineProgressBox, machineProgressPos));
	this.addComponent(new GTGuiCompMachinePower(tile));
	this.addPlayerInventory(player);
}
 
Example 2
@Override
public ItemStack decrStackSize(int slot, int amount){
    if(slot < 4) {
        ItemStack itemStack = getStackInSlot(slot);
        if(itemStack != null) {
            if(itemStack.stackSize <= amount) {
                setInventorySlotContents(slot, null);
            } else {
                itemStack = itemStack.splitStack(amount);
                if(itemStack.stackSize == 0) {
                    setInventorySlotContents(slot, null);
                }
            }
        }

        return itemStack;
    } else {
        InventoryPlayer inventoryPlayer = getPlayerInventory();
        return inventoryPlayer != null ? inventoryPlayer.decrStackSize(slot - 4, amount) : null;
    }
}
 
Example 3
Source Project: Sakura_mod   Source File: ContainerBarrel.java    License: MIT License 6 votes vote down vote up
public ContainerBarrel(InventoryPlayer inventory, TileEntityBarrel tile) {
    tileBarrel = tile;
    int i, j, k;
    for (k = 0; k < 3; ++k)
        addSlotToContainer(new Slot(tile, k, 42, 36 + (k - 1) * 18));
    addSlotToContainer(new Slot(tile, 3, 131, 12));
    addSlotToContainer(new Slot(tile, 4, 130, 56) {
        @Override
        public boolean isItemValid(ItemStack stack) {
            return false;
        }
    });


    for (i = 0; i < 3; ++i)
        for (j = 0; j < 9; ++j)
            addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));

    for (i = 0; i < 9; ++i)
        addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
}
 
Example 4
Source Project: Signals   Source File: ContainerBase.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected void addPlayerSlots(InventoryPlayer inventoryPlayer, int xOffset, int yOffset){

        playerSlotsStart = inventorySlots.size();

        // Add the player's inventory slots to the container
        for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
            for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
                addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, xOffset + inventoryColumnIndex * 18, yOffset + inventoryRowIndex * 18));
            }
        }

        // Add the player's action bar slots to the container
        for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, xOffset + actionBarSlotIndex * 18, yOffset + 58));
        }
    }
 
Example 5
Source Project: Chisel-2   Source File: ContainerAutoChisel.java    License: GNU General Public License v2.0 6 votes vote down vote up
public ContainerAutoChisel(InventoryPlayer player, TileEntityAutoChisel tileEntityAutoChisel) {

		this.player = player.player;
		autoChisel = tileEntityAutoChisel;

		addSlot(tileEntityAutoChisel, 0, 53, 15);
		addSlot(tileEntityAutoChisel, 1, 78, 52);
		addSlot(tileEntityAutoChisel, 2, 103, 15);
		addSlot(tileEntityAutoChisel, 3, 8, 62);
		addSlot(tileEntityAutoChisel, 4, 152, 5);
		addSlot(tileEntityAutoChisel, 5, 152, 25);
		addSlot(tileEntityAutoChisel, 6, 152, 45);
		addSlot(tileEntityAutoChisel, 7, 152, 65);

		bindPlayerInventory(player);
	}
 
Example 6
public ContainerVacuumPump(InventoryPlayer inventoryPlayer, TileEntityVacuumPump te){
    super(te);

    // add the upgrade slots
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            addSlotToContainer(new SlotUpgrade(te, i * 2 + j, 71 + j * 18, 29 + i * 18));
        }
    }

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 142));
    }
}
 
Example 7
public ContainerSentryTurret(InventoryPlayer inventoryPlayer, TileEntitySentryTurret te){
    super(te);

    // Add the hopper slots.
    for(int i = 0; i < 4; i++)
        addSlotToContainer(new SlotInventoryLimiting(te, i + 4, 80 + i * 18, 29));

    // add the upgrade slots
    addSlotToContainer(new SlotUpgrade(te, 0, 23, 29));
    addSlotToContainer(new SlotUpgrade(te, 1, 41, 29));
    addSlotToContainer(new SlotUpgrade(te, 2, 23, 47));
    addSlotToContainer(new SlotUpgrade(te, 3, 41, 47));

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 142));
    }
}
 
Example 8
public ContainerUVLightBox(InventoryPlayer inventoryPlayer, TileEntityUVLightBox te){
    super(te);
    // Add the burn slot.
    addSlotToContainer(new SlotItemSpecific(te, Itemss.emptyPCB, 0, 71, 36));

    // add the upgrade slots
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            addSlotToContainer(new SlotUpgrade(te, i * 2 + j + 1, 21 + j * 18, 29 + i * 18));
        }
    }

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 142));
    }
}
 
Example 9
public ContainerElectricCompressor(InventoryPlayer inventoryPlayer, TileEntityElectricCompressor te){
    super(te);

    // add the upgrade slots
    addSlotToContainer(new SlotUpgradeAndIC2(te, 0, 48, 29));
    addSlotToContainer(new SlotUpgradeAndIC2(te, 1, 66, 29));
    addSlotToContainer(new SlotUpgradeAndIC2(te, 2, 48, 47));
    addSlotToContainer(new SlotUpgradeAndIC2(te, 3, 66, 47));

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 142));
    }
}
 
Example 10
Source Project: GardenCollection   Source File: ContainerPotteryTable.java    License: MIT License 6 votes vote down vote up
public ContainerPotteryTable (InventoryPlayer inventory, TileEntityPotteryTable tileEntity) {
    tableInventory = new InventoryPottery(tileEntity, this);

    inputSlot1 = addSlotToContainer(new Slot(tableInventory, 0, 50, 44));
    inputSlot2 = addSlotToContainer(new Slot(tableInventory, 1, 50, 80));
    outputSlot = addSlotToContainer(new SlotPottery(inventory.player, tableInventory, craftResult, 2, 110, 62));

    storageSlots = new ArrayList<Slot>();
    for (int i = 0; i < 6; i++)
        storageSlots.add(addSlotToContainer(new Slot(tableInventory, 3 + i, StorageX1, StorageY1 + i * 18)));

    for (int i = 0; i < 6; i++)
        storageSlots.add(addSlotToContainer(new Slot(tableInventory, 9 + i, StorageX2, StorageY2 + i * 18)));

    playerSlots = new ArrayList<Slot>();
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 9; j++)
            playerSlots.add(addSlotToContainer(new Slot(inventory, j + i * 9 + 9, InventoryX + j * 18, InventoryY + i * 18)));
    }

    hotbarSlots = new ArrayList<Slot>();
    for (int i = 0; i < 9; i++)
        hotbarSlots.add(addSlotToContainer(new Slot(inventory, i, InventoryX + i * 18, HotbarY)));
}
 
Example 11
public ContainerSpecialCrafting(InventoryPlayer inventoryplayer, ItemStack is, World world, int x, int y, int z)
{
	invPlayer = inventoryplayer;
	this.worldObj = world; // Must be set before inventorySlotContents to prevent NPE
	decreasedStack = false;
	isConstructing = true;
	bagsSlotNum = inventoryplayer.currentItem;
	for (int j1 = 0; j1 < 81; j1++)
	{
		if(is != null)
			craftMatrix.setInventorySlotContents(j1, is.copy());
	}

	outputSlot = new SlotSpecialCraftingOutput(this, inventoryplayer.player, craftMatrix, craftResult, 0, 128, 44);
	addSlotToContainer(outputSlot);

	PlayerInventory.buildInventoryLayout(this, inventoryplayer, 8, 114, true, true);

	this.onCraftMatrixChanged(this.craftMatrix);
	isConstructing = false;
}
 
Example 12
Source Project: GregTech   Source File: ModularUIGui.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderItemStackOnMouse(int mouseX, int mouseY) {
    InventoryPlayer inventory = this.mc.player.inventory;
    ItemStack itemStack = this.draggedStack.isEmpty() ? inventory.getItemStack() : this.draggedStack;

    if (!itemStack.isEmpty()) {
        int dragOffset = this.draggedStack.isEmpty() ? 8 : 16;
        if (!this.draggedStack.isEmpty() && this.isRightMouseClick) {
            itemStack = itemStack.copy();
            itemStack.setCount(MathHelper.ceil((float) itemStack.getCount() / 2.0F));

        } else if (this.dragSplitting && this.dragSplittingSlots.size() > 1) {
            itemStack = itemStack.copy();
            itemStack.setCount(this.dragSplittingRemnant);
        }
        this.drawItemStack(itemStack, mouseX - guiLeft - 8, mouseY - guiTop - dragOffset, null);
    }
}
 
Example 13
Source Project: GardenCollection   Source File: ContainerCompostBin.java    License: MIT License 6 votes vote down vote up
public ContainerCompostBin (InventoryPlayer inventory, TileEntityCompostBin tileEntity) {
    tileCompost = tileEntity;

    compostSlots = new ArrayList<Slot>();
    for (int y = 0; y < 3; y++) {
        for (int x = 0; x < 3; x++)
            compostSlots.add(addSlotToContainer(new SlotCompost(tileEntity, x + y * 3, 30 + x * 18, 17 + y * 18)));
    }

    outputSlot = addSlotToContainer(new SlotCompostOutput(inventory.player, tileEntity, 9, 123, 34));

    playerSlots = new ArrayList<Slot>();
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 9; j++)
            playerSlots.add(addSlotToContainer(new Slot(inventory, j + i * 9 + 9, InventoryX + j * 18, InventoryY + i * 18)));
    }

    hotbarSlots = new ArrayList<Slot>();
    for (int i = 0; i < 9; i++)
        hotbarSlots.add(addSlotToContainer(new Slot(inventory, i, InventoryX + i * 18, HotbarY)));
}
 
Example 14
Source Project: AdvancedRocketry   Source File: ContainerOreMappingSatallite.java    License: MIT License 5 votes vote down vote up
ContainerOreMappingSatallite(SatelliteOreMapping inv, InventoryPlayer inventoryPlayer) {
	super();
	this.inv = inv;
	inv.setSelectedSlot(-1);
	// Player hotbar
	for (int j1 = 0; j1 < 9; j1++) {
		addSlotToContainer(new Slot(inventoryPlayer, j1, 13 + j1 * 18, 155));
	}
}
 
Example 15
Source Project: ExtraCells1   Source File: ContainerTerminalFluid.java    License: MIT License 5 votes vote down vote up
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer)
{
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 9; j++)
		{
			addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, i * 18 + 104));
		}
	}

	for (int i = 0; i < 9; i++)
	{
		addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 162));
	}
}
 
Example 16
Source Project: Signals   Source File: ContainerMinecart.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ContainerMinecart(InventoryPlayer playerInv, EntityMinecart cart, boolean isMotorized){
    super(null);
    this.cart = cart;
    this.isMotorized = isMotorized;
    CapabilityMinecartDestination cap = cart.getCapability(CapabilityMinecartDestination.INSTANCE, null);
    addSyncedFields(cap);
    
    if(isMotorized){
    	IInventory inv = cap.getFuelInv();
    	for(int i = 0; i < inv.getSizeInventory(); i++){
    		addSlotToContainer(new SlotInventoryLimiting(inv, i, 18 * i + 164, 70));
    	}
    	addPlayerSlots(playerInv, 128, 120);
    }
}
 
Example 17
Source Project: TFC2   Source File: Core.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static InventoryPlayer getNewInventory(EntityPlayer player)
{
	InventoryPlayer ip = player.inventory;
	NBTTagList nbt = new NBTTagList();
	nbt = player.inventory.writeToNBT(nbt);
	ip = new InventoryPlayerTFC(player);
	ip.readFromNBT(nbt);
	return ip;
}
 
Example 18
public GTContainerTranslocator(InventoryPlayer player, GTTileTranslocator tile) {
	super(tile);
	block = tile;
	for (int y = 0; y < 3; ++y) {
		for (int x = 0; x < 3; ++x) {
			this.addSlotToContainer(new SlotDisplay(tile, x + y * 3, 62 + x * 18, 5 + y * 18));
		}
	}
	this.addComponent(new GTGuiCompBuffer(tile, player));
	this.addPlayerInventory(player);
}
 
Example 19
public ContainerSecurityStationInventory(InventoryPlayer inventoryPlayer, TileEntitySecurityStation te){
    super(te);

    //add the network slots
    for(int i = 0; i < 7; i++) {
        for(int j = 0; j < 5; j++) {
            addSlotToContainer(new SlotItemSpecific(te, Itemss.networkComponent, j + i * 5, 17 + j * 18, 22 + i * 18));
        }
    }

    // add the upgrade slots
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            addSlotToContainer(new SlotUpgrade(te, i * 2 + j + TileEntitySecurityStation.UPGRADE_SLOT_START, 128 + j * 18, 62 + i * 18));
        }
    }

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 157 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 215));
    }
}
 
Example 20
public GTContainerDigitalChest(InventoryPlayer player, GTTileDigitalChest tile) {
	super(tile);
	for (int y = 0; y < 6; ++y) {
		for (int x = 0; x < 9; ++x) {
			this.addSlotToContainer(new SlotCustom(tile, x + y * 9, 8 + x * 18, 8
					+ y * 18, new GTIFilters.DigitalChestFilter()));
		}
	}
	this.addSlotToContainer(new SlotBase(tile, 54, 80, 119));
	this.addComponent(new GTGuiCompDigitalChest(tile));
	this.addPlayerInventory(player, 0, 56);
}
 
Example 21
private void initializeFakePlayer(){
    String playerUUID = null;
    String playerName = "Drone";
    fakePlayer = new DroneFakePlayer((WorldServer)worldObj, new GameProfile(playerUUID != null ? UUID.fromString(playerUUID) : null, playerName), new FakePlayerItemInWorldManager(worldObj, fakePlayer, this), this);
    fakePlayer.playerNetServerHandler = new NetHandlerPlayServer(MinecraftServer.getServer(), new NetworkManager(false), fakePlayer);
    fakePlayer.inventory = new InventoryPlayer(fakePlayer){
        private ItemStack oldStack;

        @Override
        public int getSizeInventory(){
            return getDroneSlots();
        }

        @Override
        public void setInventorySlotContents(int slot, ItemStack stack){
            super.setInventorySlotContents(slot, stack);
            if(slot == 0) {
                if(oldStack != null) {
                    getFakePlayer().getAttributeMap().removeAttributeModifiers(oldStack.getAttributeModifiers());
                }

                if(stack != null) {
                    getFakePlayer().getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers());
                }
                oldStack = stack;
            }
        }
    };
}
 
Example 22
public GTContainerMagicEnergyAbsorber(InventoryPlayer player, GTTileMagicEnergyAbsorber tile) {
	super(tile);
	this.addSlotToContainer(new SlotBase(tile, 0, 80, 17));
	this.addSlotToContainer(new SlotOutput(player.player, tile, 1, 80, 53));
	this.addComponent(new GTGuiCompMagicEnergyAbsorber(tile));
	this.addPlayerInventory(player, 0, 0);
}
 
Example 23
Source Project: BigReactors   Source File: TileEntityReactorPart.java    License: MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public Object getGuiElement(InventoryPlayer inventoryPlayer) {
	if(!this.isConnected()) {
		return null;
	}
	
	int metadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
	if(BlockReactorPart.isController(metadata)) {
		return new GuiReactorStatus(new ContainerReactorController(this, inventoryPlayer.player), this);
	}
	return null;
}
 
Example 24
Source Project: ExtraCells1   Source File: ContainerHardMEDrive.java    License: MIT License 5 votes vote down vote up
public ContainerHardMEDrive(InventoryPlayer inventory, TileEntityHardMEDrive tileentity)
{
	this.tileentity = tileentity;
	for (int i = 0; i < 3; i++)
	{
		addSlotToContainer(new SlotRespective(tileentity, i, 80, 17 + i * 18)
		{
			public boolean isItemValid(ItemStack item)
			{
				return appeng.api.Util.getCellRegistry().isCellHandled(item);
			}
		});
	}
	bindPlayerInventory(inventory);
}
 
Example 25
Source Project: EmergingTechnology   Source File: ScaffolderGui.java    License: MIT License 5 votes vote down vote up
public ScaffolderGui(InventoryPlayer player, ScaffolderTileEntity tileEntity) {
	super(new ScaffolderContainer(player, tileEntity));
	this.player = player;
	this.tileEntity = tileEntity;
	this.xSize = XSIZE;
	this.ySize = YSIZE;
}
 
Example 26
Source Project: EmergingTechnology   Source File: BioreactorGui.java    License: MIT License 5 votes vote down vote up
public BioreactorGui(InventoryPlayer player, BioreactorTileEntity tileEntity) {
	super(new BioreactorContainer(player, tileEntity));
	this.player = player;
	this.tileEntity = tileEntity;
	this.xSize = XSIZE;
	this.ySize = YSIZE;
}
 
Example 27
Source Project: TFC2   Source File: ContainerAnvil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ContainerAnvil(InventoryPlayer playerinv, TileAnvil anvil, World world, int x, int y, int z)
{
	this.player = playerinv.player;

	this.world = world;
	this.anvil = anvil;
	anvil.openInventory(player);
	PlayerInventory.buildInventoryLayout(this, playerinv, 8, 95, false, true);
	layoutContainer(playerinv, anvil, 0, 0);
}
 
Example 28
Source Project: NotEnoughItems   Source File: InfiniteStackSizeHandler.java    License: MIT License 5 votes vote down vote up
@Override
public void replenishInfiniteStack(InventoryPlayer inv, int slotNo) {
    ItemStack stack = inv.getStackInSlot(slotNo);
    stack.setCount(111);

    for (int i = 0; i < inv.getSizeInventory(); i++) {
        if (i == slotNo) {
            continue;
        }

        if (NEIServerUtils.areStacksSameType(stack, inv.getStackInSlot(i))) {
            inv.setInventorySlotContents(i, null);
        }
    }
}
 
Example 29
Source Project: EmergingTechnology   Source File: DiffuserGui.java    License: MIT License 5 votes vote down vote up
public DiffuserGui(InventoryPlayer player, DiffuserTileEntity tileEntity) {
	super(new DiffuserContainer(player, tileEntity));
	this.player = player;
	this.tileEntity = tileEntity;
	this.xSize = XSIZE;
	this.ySize = YSIZE;
}
 
Example 30
public ContainerPlasticMixer(InventoryPlayer inventoryPlayer, TileEntityPlasticMixer te){
    super(te);

    // add the upgrade slots
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            addSlotToContainer(new SlotUpgrade(te, i * 2 + j, 11 + j * 18, 29 + i * 18));
        }
    }

    addSlotToContainer(new SlotInventoryLimiting(te, TileEntityPlasticMixer.INV_INPUT, 98, 26));
    addSlotToContainer(new SlotInventoryLimiting(te, TileEntityPlasticMixer.INV_OUTPUT, 98, 58));
    for(int i = 0; i < 3; i++) {
        addSlotToContainer(new SlotInventoryLimiting(te, TileEntityPlasticMixer.INV_DYE_RED + i, 127, 22 + i * 18));
    }

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 142));
    }
}