Search in sources :

Example 1 with LogisticsSolderingTileEntity

use of logisticspipes.blocks.LogisticsSolderingTileEntity in project LogisticsPipes by RS485.

the class SolderingStationGui method getClientGui.

@Override
public Object getClientGui(EntityPlayer player) {
    final LogisticsSolderingTileEntity tile = this.getTile(player.worldObj, LogisticsSolderingTileEntity.class);
    if (tile == null) {
        return null;
    }
    GuiSolderingStation gui = new GuiSolderingStation(player, tile);
    gui.inventorySlots = getContainer(player);
    return gui;
}
Also used : GuiSolderingStation(logisticspipes.gui.GuiSolderingStation) LogisticsSolderingTileEntity(logisticspipes.blocks.LogisticsSolderingTileEntity)

Example 2 with LogisticsSolderingTileEntity

use of logisticspipes.blocks.LogisticsSolderingTileEntity in project LogisticsPipes by RS485.

the class SolderingStationHeat method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    final LogisticsSolderingTileEntity tile = this.getTile(player.worldObj, LogisticsSolderingTileEntity.class);
    if (tile != null) {
        int old = tile.heat;
        tile.heat = getInteger();
        if ((tile.heat == 0 && old != 0) || (tile.heat != 0 && old == 0)) {
            player.worldObj.markBlockForUpdate(getPosX(), getPosY(), getPosZ());
        }
    }
}
Also used : LogisticsSolderingTileEntity(logisticspipes.blocks.LogisticsSolderingTileEntity)

Example 3 with LogisticsSolderingTileEntity

use of logisticspipes.blocks.LogisticsSolderingTileEntity in project LogisticsPipes by RS485.

the class SolderingStation method importRecipe.

@Override
public boolean importRecipe(TileEntity tile, ItemIdentifierInventory inventory) {
    if (!(tile instanceof LogisticsSolderingTileEntity)) {
        return false;
    }
    LogisticsSolderingTileEntity station = (LogisticsSolderingTileEntity) tile;
    ItemStack result = station.getTargetForTaget();
    if (result == null) {
        return false;
    }
    inventory.setInventorySlotContents(9, result);
    // Import
    for (int i = 0; i < station.getRecipeForTaget().length; i++) {
        if (i >= inventory.getSizeInventory() - 2) {
            break;
        }
        final ItemStack newStack = station.getRecipeForTaget()[i] == null ? null : station.getRecipeForTaget()[i].copy();
        inventory.setInventorySlotContents(i, newStack);
    }
    inventory.compact_first(9);
    for (int i = 0; i < inventory.getSizeInventory() - 2; i++) {
        if (inventory.getStackInSlot(i) != null) {
            continue;
        }
        inventory.setInventorySlotContents(i, new ItemStack(Items.iron_ingot, 1));
        break;
    }
    return true;
}
Also used : LogisticsSolderingTileEntity(logisticspipes.blocks.LogisticsSolderingTileEntity) ItemStack(net.minecraft.item.ItemStack)

Example 4 with LogisticsSolderingTileEntity

use of logisticspipes.blocks.LogisticsSolderingTileEntity in project LogisticsPipes by RS485.

the class SolderingStationGui method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    final LogisticsSolderingTileEntity tile = this.getTile(player.worldObj, LogisticsSolderingTileEntity.class);
    if (tile == null) {
        return null;
    }
    DummyContainer dummy = new DummyContainer(player, tile, tile);
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            final int slotNumber = i * 3 + j;
            dummy.addRestrictedSlot(slotNumber, tile, 44 + (j * 18), 17 + (i * 18), itemStack -> {
                return tile.checkSlot(itemStack, slotNumber);
            });
        }
    }
    dummy.addRestrictedSlot(9, tile, 107, 17, Items.iron_ingot);
    dummy.addRestrictedSlot(10, tile, 141, 47, (Item) null);
    dummy.addRestrictedSlot(11, tile, 9, 9, itemStack -> tile.getRecipeForTaget(itemStack) != null && tile.areStacksEmpty());
    dummy.addNormalSlotsForPlayerInventory(8, 84);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsSolderingTileEntity(logisticspipes.blocks.LogisticsSolderingTileEntity)

Example 5 with LogisticsSolderingTileEntity

use of logisticspipes.blocks.LogisticsSolderingTileEntity in project LogisticsPipes by RS485.

the class SolderingStationInventory method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    final LogisticsSolderingTileEntity tile = this.getTile(player.worldObj, LogisticsSolderingTileEntity.class);
    if (tile != null) {
        for (int i = 0; i < tile.getSizeInventory(); i++) {
            if (i >= getStackList().size()) {
                break;
            }
            ItemStack stack = getStackList().get(i);
            tile.setInventorySlotContents(i, stack);
        }
    }
}
Also used : LogisticsSolderingTileEntity(logisticspipes.blocks.LogisticsSolderingTileEntity) ItemStack(net.minecraft.item.ItemStack)

Aggregations

LogisticsSolderingTileEntity (logisticspipes.blocks.LogisticsSolderingTileEntity)5 ItemStack (net.minecraft.item.ItemStack)2 GuiSolderingStation (logisticspipes.gui.GuiSolderingStation)1 DummyContainer (logisticspipes.utils.gui.DummyContainer)1