use of logisticspipes.pipes.upgrades.SneakyUpgrade in project LogisticsPipes by RS485.
the class PipeController method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
LogisticsTileGenericPipe tile = getPipe(player.getEntityWorld());
if (tile == null || !(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 -> {
if (itemStack == null) {
return false;
}
if (itemStack.getItem() == LogisticsPipes.UpgradeItem) {
if (!LogisticsPipes.UpgradeItem.getUpgradeForItem(itemStack, null).isAllowedForPipe(pipe)) {
return false;
}
} else {
return false;
}
return true;
});
}
for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
dummy.addSneakyUpgradeSlot(pipeSlot, pipe.getOriginalUpgradeManager(), pipeSlot + 9, 8 + pipeSlot * 18, 48, itemStack -> {
if (itemStack == null) {
return false;
}
if (itemStack.getItem() == LogisticsPipes.UpgradeItem) {
IPipeUpgrade upgrade = LogisticsPipes.UpgradeItem.getUpgradeForItem(itemStack, null);
if (!(upgrade instanceof SneakyUpgrade) && !(upgrade instanceof SneakyUpgradeConfig)) {
return false;
}
if (!upgrade.isAllowedForPipe(pipe)) {
return false;
}
} else {
return false;
}
return true;
});
}
// TAB_2 SLOTS
dummy.addStaticRestrictedSlot(0, pipe.getOriginalUpgradeManager().getSecInv(), 8 + 8 * 18, 18, itemStack -> {
if (itemStack == null) {
return false;
}
if (itemStack.getItem() != LogisticsPipes.LogisticsItemCard) {
return false;
}
if (itemStack.getItemDamage() != LogisticsItemCard.SEC_CARD) {
return false;
}
return SimpleServiceLocator.securityStationManager.isAuthorized(UUID.fromString(itemStack.getTagCompound().getString("UUID")));
}, 1);
dummy.addRestrictedSlot(0, tile.logicController.diskInv, 14, 36, LogisticsPipes.LogisticsItemDisk);
return dummy;
}
Aggregations