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);
}
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;
}
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();
}
}
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;
}
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);
}
Aggregations