Search in sources :

Example 1 with LogisticsCraftingTableTileEntity

use of logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity in project LogisticsPipes by RS485.

the class AutoCraftingGui method getClientGui.

@Override
public Object getClientGui(EntityPlayer player) {
    LogisticsCraftingTableTileEntity tile = this.getTile(player.getEntityWorld(), LogisticsCraftingTableTileEntity.class);
    if (tile == null) {
        return null;
    }
    if (tile.isFuzzy()) {
        for (int i = 0; i < 9; i++) {
            tile.fuzzyFlags[i].ignore_dmg = ignore_dmg[i];
            tile.fuzzyFlags[i].ignore_nbt = ignore_nbt[i];
            tile.fuzzyFlags[i].use_od = use_od[i];
            tile.fuzzyFlags[i].use_category = use_category[i];
        }
    }
    tile.targetType = targetType;
    return new GuiLogisticsCraftingTable(player, tile);
}
Also used : GuiLogisticsCraftingTable(logisticspipes.gui.GuiLogisticsCraftingTable) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Example 2 with LogisticsCraftingTableTileEntity

use of logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity in project LogisticsPipes by RS485.

the class AutoCraftingGui method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsCraftingTableTileEntity tile = this.getTile(player.getEntityWorld(), LogisticsCraftingTableTileEntity.class);
    if (tile == null) {
        return null;
    }
    DummyContainer dummy = new DummyContainer(player, tile.matrix, tile);
    for (int X = 0; X < 3; X++) {
        for (int Y = 0; Y < 3; Y++) {
            dummy.addFuzzyDummySlot(Y * 3 + X, 35 + X * 18, 10 + Y * 18, tile.fuzzyFlags[Y * 3 + X]);
        }
    }
    dummy.addFuzzyUnmodifiableSlot(0, tile.resultInv, 125, 28, tile.outputFuzzyFlags);
    for (int Y = 0; Y < 2; Y++) {
        for (int X = 0; X < 9; X++) {
            dummy.addNormalSlot(Y * 9 + X, tile.inv, 8 + X * 18, 80 + Y * 18);
        }
    }
    dummy.addNormalSlotsForPlayerInventory(8, 135);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Example 3 with LogisticsCraftingTableTileEntity

use of logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity in project LogisticsPipes by RS485.

the class CraftingSetType method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    TileEntity table = this.getTile(player.getEntityWorld(), TileEntity.class);
    if (table instanceof LogisticsCraftingTableTileEntity) {
        ((LogisticsCraftingTableTileEntity) table).targetType = targetType;
        ((LogisticsCraftingTableTileEntity) table).cacheRecipe();
    } else if (table instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) table).pipe instanceof PipeBlockRequestTable) {
        ((PipeBlockRequestTable) ((LogisticsTileGenericPipe) table).pipe).targetType = targetType;
        ((PipeBlockRequestTable) ((LogisticsTileGenericPipe) table).pipe).cacheRecipe();
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Example 4 with LogisticsCraftingTableTileEntity

use of logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity in project LogisticsPipes by RS485.

the class LogisticsCraftingTable method importFuzzyFlags.

@Override
public void importFuzzyFlags(TileEntity tile, ItemIdentifierInventory inventory, DictResource[] flags, DictResource output) {
    if (!(tile instanceof LogisticsCraftingTableTileEntity)) {
        return;
    }
    LogisticsCraftingTableTileEntity bench = (LogisticsCraftingTableTileEntity) tile;
    if (!bench.isFuzzy()) {
        return;
    }
    for (int i = 0; i < bench.fuzzyFlags.length; i++) {
        if (i >= flags.length) {
            break;
        }
        flags[i].loadFromBitSet(bench.fuzzyFlags[i].getBitSet());
    }
    output.loadFromBitSet(bench.outputFuzzyFlags.getBitSet());
    for (int i = 0; i < 9; i++) {
        final ItemIdentifierStack stackInSlot = inventory.getIDStackInSlot(i);
        if (stackInSlot == null) {
            continue;
        }
        final ItemIdentifier itemInSlot = stackInSlot.getItem();
        for (int j = i + 1; j < 9; j++) {
            final ItemIdentifierStack stackInOtherSlot = inventory.getIDStackInSlot(j);
            if (stackInOtherSlot == null) {
                continue;
            }
            if (itemInSlot.equals(stackInOtherSlot.getItem()) && flags[i].getBitSet().equals(flags[j].getBitSet())) {
                stackInSlot.setStackSize(stackInSlot.getStackSize() + stackInOtherSlot.getStackSize());
                inventory.clearInventorySlotContents(j);
                // clear
                flags[j].loadFromBitSet(new BitSet());
            }
        }
        inventory.setInventorySlotContents(i, stackInSlot);
    }
    for (int i = 0; i < 9; i++) {
        if (inventory.getStackInSlot(i) != null) {
            continue;
        }
        for (int j = i + 1; j < 9; j++) {
            if (inventory.getStackInSlot(j) == null) {
                continue;
            }
            inventory.setInventorySlotContents(i, inventory.getStackInSlot(j));
            flags[i].loadFromBitSet(flags[j].getBitSet());
            inventory.clearInventorySlotContents(j);
            // clear
            flags[j].loadFromBitSet(new BitSet());
            break;
        }
    }
    return;
}
Also used : ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) BitSet(java.util.BitSet) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Example 5 with LogisticsCraftingTableTileEntity

use of logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity in project LogisticsPipes by RS485.

the class LogisticsSolidBlock method breakBlock.

@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
    TileEntity tile = par1World.getTileEntity(par2, par3, par4);
    if (tile instanceof LogisticsSolderingTileEntity) {
        ((LogisticsSolderingTileEntity) tile).onBlockBreak();
    }
    if (tile instanceof LogisticsCraftingTableTileEntity) {
        ((LogisticsCraftingTableTileEntity) tile).onBlockBreak();
    }
    super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
Also used : LogisticsRFPowerProviderTileEntity(logisticspipes.blocks.powertile.LogisticsRFPowerProviderTileEntity) LogisticsPowerJunctionTileEntity(logisticspipes.blocks.powertile.LogisticsPowerJunctionTileEntity) IGuiTileEntity(logisticspipes.interfaces.IGuiTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity) LogisticsIC2PowerProviderTileEntity(logisticspipes.blocks.powertile.LogisticsIC2PowerProviderTileEntity) LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Aggregations

LogisticsCraftingTableTileEntity (logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)8 TileEntity (net.minecraft.tileentity.TileEntity)4 LogisticsIC2PowerProviderTileEntity (logisticspipes.blocks.powertile.LogisticsIC2PowerProviderTileEntity)2 LogisticsPowerJunctionTileEntity (logisticspipes.blocks.powertile.LogisticsPowerJunctionTileEntity)2 LogisticsRFPowerProviderTileEntity (logisticspipes.blocks.powertile.LogisticsRFPowerProviderTileEntity)2 LogisticsStatisticsTileEntity (logisticspipes.blocks.stats.LogisticsStatisticsTileEntity)2 IGuiTileEntity (logisticspipes.interfaces.IGuiTileEntity)2 PipeBlockRequestTable (logisticspipes.pipes.PipeBlockRequestTable)2 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)2 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)2 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)2 ArrayList (java.util.ArrayList)1 BitSet (java.util.BitSet)1 GuiLogisticsCraftingTable (logisticspipes.gui.GuiLogisticsCraftingTable)1 GuiRecipeImport (logisticspipes.gui.popup.GuiRecipeImport)1 IRotationProvider (logisticspipes.interfaces.IRotationProvider)1 PipeItemsCraftingLogistics (logisticspipes.pipes.PipeItemsCraftingLogistics)1 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)1 DummyContainer (logisticspipes.utils.gui.DummyContainer)1 ItemStack (net.minecraft.item.ItemStack)1