Search in sources :

Example 6 with WindowInventory

use of binnie.core.gui.minecraft.WindowInventory in project Binnie by ForestryMC.

the class WindowFieldKit method receiveGuiNBTOnServer.

@Override
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
    super.receiveGuiNBTOnServer(player, name, nbt);
    if (name.equals("analyse")) {
        WindowInventory inventory = getWindowInventory();
        ItemStack individualStack = inventory.getStackInSlot(INDIVIDUAL_SLOT);
        inventory.setInventorySlotContents(INDIVIDUAL_SLOT, ManagerGenetics.analyse(individualStack, this.getWorld(), this.getUsername()));
        inventory.decrStackSize(PAPER_SLOT, 1);
    }
}
Also used : WindowInventory(binnie.core.gui.minecraft.WindowInventory) ItemStack(net.minecraft.item.ItemStack)

Example 7 with WindowInventory

use of binnie.core.gui.minecraft.WindowInventory in project Binnie by ForestryMC.

the class WindowAnalyst method onWindowInventoryChanged.

@Override
public void onWindowInventoryChanged() {
    super.onWindowInventoryChanged();
    WindowInventory inv = getWindowInventory();
    ItemStack stack = inv.getStackInSlot(0);
    if (!stack.isEmpty() && !ManagerGenetics.isAnalysed(stack)) {
        inv.setInventorySlotContents(0, ManagerGenetics.analyse(stack, getWorld(), getUsername()));
        inv.decrStackSize(1, 1);
    }
    if (isClient()) {
        // noinspection MethodCallSideOnly
        setStack(stack);
    }
}
Also used : WindowInventory(binnie.core.gui.minecraft.WindowInventory) ItemStack(net.minecraft.item.ItemStack)

Aggregations

WindowInventory (binnie.core.gui.minecraft.WindowInventory)7 ItemStack (net.minecraft.item.ItemStack)4 Point (binnie.core.gui.geometry.Point)3 ControlText (binnie.core.gui.controls.ControlText)1 Area (binnie.core.gui.geometry.Area)1 ControlImage (binnie.core.gui.minecraft.control.ControlImage)1 ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)1 ControlSlot (binnie.core.gui.minecraft.control.ControlSlot)1 StandardTexture (binnie.core.gui.resource.textures.StandardTexture)1 InventorySlot (binnie.core.machines.inventory.InventorySlot)1 SlotValidator (binnie.core.machines.inventory.SlotValidator)1 IChromosomeType (forestry.api.genetics.IChromosomeType)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 InventoryPlayer (net.minecraft.entity.player.InventoryPlayer)1 EnumFacing (net.minecraft.util.EnumFacing)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1