net.minecraft.entity.player.InventoryPlayer Java Examples

The following examples show how to use net.minecraft.entity.player.InventoryPlayer. 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
Source File: ContainerBase.java    From Signals with 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 #2
Source File: ContainerElectricCompressor.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
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 #3
Source File: ContainerBarrel.java    From Sakura_mod with 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 File: ContainerAutoChisel.java    From Chisel-2 with 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 #5
Source File: ContainerVacuumPump.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
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 #6
Source File: ModularUIGui.java    From GregTech with 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 #7
Source File: ContainerCompostBin.java    From GardenCollection with 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 #8
Source File: ContainerSentryTurret.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
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 #9
Source File: ContainerPotteryTable.java    From GardenCollection with 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 #10
Source File: TileEntityAerialInterface.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@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 #11
Source File: ContainerUVLightBox.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
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 #12
Source File: ContainerSpecialCrafting.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
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 #13
Source File: GTContainerDisassembler.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #14
Source File: ModularUI.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Builder bindPlayerHotbar(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) {
    for (int slot = 0; slot < 9; slot++) {
        this.widget(new SlotWidget(new PlayerMainInvWrapper(inventoryPlayer), slot, x + slot * 18, y)
            .setBackgroundTexture(imageLocation)
            .setLocationInfo(true, true));
    }
    return this;
}
 
Example #15
Source File: TileEntityProgrammableController.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
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 #16
Source File: GTContainerMagicEnergyAbsorber.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 #17
Source File: GuiEnderItemStorage.java    From EnderStorage with MIT License 5 votes vote down vote up
public GuiEnderItemStorage(InventoryPlayer invplayer, EnderItemStorage chestInv, String name)
{
    super(new ContainerEnderItemStorage(invplayer, chestInv, true));
    playerInv = invplayer;
    this.chestInv = chestInv;
    allowUserInput = false;
    this.name = StatCollector.translateToLocal(name);
    
    if(chestInv.getSize() == 2)
        ySize = 222;
}
 
Example #18
Source File: TileEntityReactorPart.java    From BigReactors with 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 #19
Source File: ContainerMinecart.java    From Signals with 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 #20
Source File: GTContainerDigitalChest.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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
Source File: ContainerHardMEDrive.java    From ExtraCells1 with 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 #22
Source File: InjectorGui.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public InjectorGui(InventoryPlayer player, InjectorTileEntity tileEntity) {
	super(new InjectorContainer(player, tileEntity));
	this.player = player;
	this.tileEntity = tileEntity;
	this.xSize = XSIZE;
	this.ySize = YSIZE;
}
 
Example #23
Source File: ScaffolderGui.java    From EmergingTechnology with 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 #24
Source File: ECPrivatePatternInventory.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public boolean doesRecipeExist(ICraftingPatternMAC pattern)
{
	InventoryCrafting inv = new InventoryCrafting(new ContainerWorkbench(new InventoryPlayer(null), gridTE.getWorld(), 0, 0, 0)
	{
		public void onCraftMatrixChanged(IInventory par1IInventory)
		{
		}
	}, 3, 3);
	for (int i = 0; i < pattern.getCraftingMatrix().length; i++)
	{
		inv.setInventorySlotContents(i, pattern.getCraftingMatrix()[i]);
	}
	ItemStack thing = CraftingManager.getInstance().findMatchingRecipe(inv, gridTE.getWorld());
	return ItemStack.areItemStacksEqual(thing, pattern.getOutput());
}
 
Example #25
Source File: ContainerShip.java    From archimedes-ships with 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, 84 + i * 18));
		}
	}
	
	for (int i = 0; i < 9; i++)
	{
		addSlotToContainer(new Slot(inventoryplayer, i, 8 + i * 18, 142));
	}
}
 
Example #26
Source File: BioreactorGui.java    From EmergingTechnology with 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 File: ContainerAnvil.java    From TFC2 with 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 File: InfiniteStackSizeHandler.java    From NotEnoughItems with 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 File: DiffuserGui.java    From EmergingTechnology with 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
Source File: ContainerPlasticMixer.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
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));
    }
}