use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class RequestFluidOrdererRefreshPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
int dimension = getInteger();
final LogisticsTileGenericPipe pipe = MainProxy.proxy.getPipeInDimensionAt(dimension, getPosX(), getPosY(), getPosZ(), player);
if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
return;
}
RequestHandler.refreshFluid(player, (CoreRoutedPipe) pipe.pipe);
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class RequestSubmitPacket 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)) {
return;
}
RequestHandler.request(player, getStack(), (CoreRoutedPipe) pipe.pipe);
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class FindMostLikelyRecipeComponents method processPacket.
@Override
public void processPacket(EntityPlayer player) {
TileEntity tile = this.getTile(player.getEntityWorld(), TileEntity.class);
CoreRoutedPipe pipe = null;
if (tile instanceof LogisticsCraftingTableTileEntity) {
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity conn = CoordinateUtils.add(((LogisticsCraftingTableTileEntity) tile).getLPPosition(), dir).getTileEntity(player.getEntityWorld());
if (conn instanceof LogisticsTileGenericPipe) {
if (((LogisticsTileGenericPipe) conn).pipe instanceof PipeItemsCraftingLogistics) {
pipe = (CoreRoutedPipe) ((LogisticsTileGenericPipe) conn).pipe;
break;
}
}
}
} else if (tile instanceof LogisticsTileGenericPipe) {
if (((LogisticsTileGenericPipe) tile).pipe instanceof PipeBlockRequestTable) {
pipe = (CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe;
}
}
List<Integer> list = new ArrayList<Integer>(content.size());
while (list.size() < content.size()) {
list.add(-1);
}
if (pipe == null)
return;
LinkedList<ItemIdentifier> craftable = null;
for (int j = 0; j < content.size(); j++) {
GuiRecipeImport.Canidates canidates = content.get(j);
int maxItemPos = -1;
int max = 0;
for (int i = 0; i < canidates.order.size(); i++) {
ItemIdentifier ident = canidates.order.get(i).getItem();
int newAmount = SimpleServiceLocator.logisticsManager.getAmountFor(ident, pipe.getRouter().getIRoutersByCost());
if (newAmount > max) {
max = newAmount;
maxItemPos = i;
}
}
if (max < 64) {
if (craftable == null) {
craftable = SimpleServiceLocator.logisticsManager.getCraftableItems(pipe.getRouter().getIRoutersByCost());
}
for (ItemIdentifier craft : craftable) {
for (int i = 0; i < canidates.order.size(); i++) {
ItemIdentifier ident = canidates.order.get(i).getItem();
if (craft == ident) {
maxItemPos = i;
break;
}
}
}
}
list.set(j, maxItemPos);
}
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(MostLikelyRecipeComponentsResponse.class).setResponse(list), player);
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class RequestComponentPacket 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)) {
return;
}
RequestHandler.simulate(player, getStack(), (CoreRoutedPipe) pipe.pipe);
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class ItemAmountSignUpdatePacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
if (pipe == null || !pipe.isInitialized()) {
return;
}
IPipeSign sign = ((CoreRoutedPipe) pipe.pipe).getPipeSign(ForgeDirection.getOrientation(getInteger()));
if (sign == null) {
return;
}
((ItemAmountPipeSign) sign).amount = getInteger2();
((ItemAmountPipeSign) sign).itemTypeInv.setInventorySlotContents(0, stack);
}
Aggregations