use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.
the class PipeController method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
LogisticsTileGenericPipe tile = getTileAs(player.world, LogisticsTileGenericPipe.class);
if (!(tile.pipe instanceof CoreRoutedPipe)) {
return null;
}
final CoreRoutedPipe pipe = (CoreRoutedPipe) tile.pipe;
DummyContainer dummy = new DummyContainer(player, null, pipe.getOriginalUpgradeManager().getGuiController(), new IGuiOpenControler() {
// Network Statistics
@Override
public void guiOpenedByPlayer(EntityPlayer player) {
pipe.playerStartWatching(player, 0);
}
@Override
public void guiClosedByPlayer(EntityPlayer player) {
pipe.playerStopWatching(player, 0);
}
});
dummy.addNormalSlotsForPlayerInventory(0, 0);
// TAB_1 SLOTS
for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
dummy.addUpgradeSlot(pipeSlot, pipe.getOriginalUpgradeManager(), pipeSlot, 8 + pipeSlot * 18, 18, itemStack -> !itemStack.isEmpty() && itemStack.getItem() instanceof ItemUpgrade && ((ItemUpgrade) itemStack.getItem()).getUpgradeForItem(itemStack, null).isAllowedForPipe(pipe));
}
for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
dummy.addSneakyUpgradeSlot(pipeSlot, pipe.getOriginalUpgradeManager(), pipeSlot + 9, 8 + pipeSlot * 18, 48, itemStack -> {
if (itemStack.isEmpty()) {
return false;
}
if (itemStack.getItem() instanceof ItemUpgrade) {
IPipeUpgrade upgrade = ((ItemUpgrade) itemStack.getItem()).getUpgradeForItem(itemStack, null);
return upgrade instanceof SneakyUpgradeConfig && upgrade.isAllowedForPipe(pipe);
} else {
return false;
}
});
}
// TAB_2 SLOTS
dummy.addStaticRestrictedSlot(0, pipe.getOriginalUpgradeManager().secInv, 8 + 8 * 18, 18, itemStack -> {
if (itemStack.isEmpty()) {
return false;
}
if (itemStack.getItem() != LPItems.itemCard) {
return false;
}
if (itemStack.getItemDamage() != LogisticsItemCard.SEC_CARD) {
return false;
}
final NBTTagCompound tag = Objects.requireNonNull(itemStack.getTagCompound());
return SimpleServiceLocator.securityStationManager.isAuthorized(UUID.fromString(tag.getString("UUID")));
}, 1);
dummy.addRestrictedSlot(0, tile.logicController.diskInv, 14, 36, LPItems.disk);
return dummy;
}
use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.
the class PowerJunctionGui method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
DummyContainer dummy = new DummyContainer(player, null, getTileAs(player.world, LogisticsPowerJunctionTileEntity.class));
dummy.addNormalSlotsForPlayerInventory(8, 80);
return dummy;
}
use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.
the class ProgramCompilerGui method getContainer.
@Override
public Container getContainer(EntityPlayer player) {
LogisticsProgramCompilerTileEntity compilerBlock = getTileAs(player.world, LogisticsProgramCompilerTileEntity.class);
DummyContainer dummy = new DummyContainer(player, null, compilerBlock);
dummy.addRestrictedSlot(0, compilerBlock.getInventory(), 10, 10, LPItems.disk);
dummy.addRestrictedSlot(1, compilerBlock.getInventory(), 154, 10, LPItems.logisticsProgrammer);
dummy.addNormalSlotsForPlayerInventory(10, 45);
return dummy;
}
use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.
the class ItemAmountSignGui method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
LogisticsTileGenericPipe pipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
if (!(pipe.pipe instanceof CoreRoutedPipe)) {
return null;
}
ItemAmountPipeSign sign = ((ItemAmountPipeSign) ((CoreRoutedPipe) pipe.pipe).getPipeSign(dir));
Objects.requireNonNull(sign);
DummyContainer dummy = new DummyContainer(player.inventory, sign.itemTypeInv);
dummy.addDummySlot(0, 0, 0);
dummy.addNormalSlotsForPlayerInventory(0, 0);
return dummy;
}
use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.
the class LogicControllerGuiProvider method getContainer.
@Override
public Container getContainer(EntityPlayer player) {
TileEntity pipe = getTileAs(player.world, TileEntity.class);
if (pipe instanceof ILogicControllerTile) {
DummyContainer dummy = new DummyContainer(player.inventory, null);
dummy.addNormalSlotsForPlayerInventory(50, 190);
return dummy;
}
return null;
}
Aggregations