use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class SubmitFluidRequestPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
final LogisticsTileGenericPipe pipe = MainProxy.proxy.getPipeInDimensionAt(getDimension(), getPosX(), getPosY(), getPosZ(), player);
if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe) || !(pipe.pipe instanceof IRequestFluid)) {
return;
}
RequestHandler.requestFluid(player, getStack(), (CoreRoutedPipe) pipe.pipe, (IRequestFluid) pipe.pipe);
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class FluidSupplierMode method processPacket.
@Override
public void processPacket(EntityPlayer player) {
final LogisticsTileGenericPipe pipe = this.getPipe(player.world);
if (pipe == null) {
return;
}
if (MainProxy.isClient(player.world)) {
if (pipe.pipe instanceof PipeItemsFluidSupplier) {
((PipeItemsFluidSupplier) pipe.pipe).setRequestingPartials((getInteger() % 10) == 1);
}
if (pipe.pipe instanceof PipeFluidSupplierMk2) {
((PipeFluidSupplierMk2) pipe.pipe).setRequestingPartials((getInteger() % 10) == 1);
}
} else {
if (pipe.pipe instanceof PipeItemsFluidSupplier) {
PipeItemsFluidSupplier liquid = (PipeItemsFluidSupplier) pipe.pipe;
liquid.setRequestingPartials((getInteger() % 10) == 1);
}
if (pipe.pipe instanceof PipeFluidSupplierMk2) {
PipeFluidSupplierMk2 liquid = (PipeFluidSupplierMk2) pipe.pipe;
liquid.setRequestingPartials((getInteger() % 10) == 1);
}
}
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class ChassisGuiProvider method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
LogisticsTileGenericPipe pipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
if (!(pipe.pipe instanceof PipeLogisticsChassis)) {
return null;
}
final PipeLogisticsChassis _chassiPipe = (PipeLogisticsChassis) pipe.pipe;
IInventory _moduleInventory = _chassiPipe.getModuleInventory();
DummyContainer dummy = new DummyContainer(player.inventory, _moduleInventory);
if (_chassiPipe.getChassisSize() < 5) {
dummy.addNormalSlotsForPlayerInventory(18, 97);
} else {
dummy.addNormalSlotsForPlayerInventory(18, 174);
}
for (int i = 0; i < _chassiPipe.getChassisSize(); i++) {
dummy.addModuleSlot(i, _moduleInventory, 19, 9 + 20 * i, _chassiPipe);
}
if (_chassiPipe.getUpgradeManager().hasUpgradeModuleUpgrade()) {
for (int i = 0; i < _chassiPipe.getChassisSize(); i++) {
final int fI = i;
ModuleUpgradeManager upgradeManager = _chassiPipe.getModuleUpgradeManager(i);
dummy.addUpgradeSlot(0, upgradeManager, 0, 145, 9 + i * 20, itemStack -> ChassisGuiProvider.checkStack(itemStack, _chassiPipe, fI));
dummy.addUpgradeSlot(1, upgradeManager, 1, 165, 9 + i * 20, itemStack -> ChassisGuiProvider.checkStack(itemStack, _chassiPipe, fI));
}
}
return dummy;
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe 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.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class CraftingSetType method processPacket.
@Override
public void processPacket(EntityPlayer player) {
TileEntity table = this.getTileAs(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();
}
}
Aggregations