use of network.rs485.logisticspipes.module.AsyncQuicksortModule in project LogisticsPipes by RS485.
the class LogisticsEventListener method onPlayerLeftClickBlock.
@SubscribeEvent
public void onPlayerLeftClickBlock(final PlayerInteractEvent.RightClickBlock event) {
if (MainProxy.isServer(event.getEntityPlayer().world)) {
WorldCoordinatesWrapper worldCoordinates = new WorldCoordinatesWrapper(event.getEntityPlayer().world, event.getPos());
TileEntity tileEntity = worldCoordinates.getTileEntity();
if (tileEntity instanceof TileEntityChest || SimpleServiceLocator.ironChestProxy.isIronChest(tileEntity)) {
List<WeakReference<AsyncQuicksortModule>> list = worldCoordinates.allNeighborTileEntities().stream().filter(NeighborTileEntity::isLogisticsPipe).filter(adjacent -> ((LogisticsTileGenericPipe) adjacent.getTileEntity()).pipe instanceof PipeLogisticsChassis).filter(adjacent -> ((PipeLogisticsChassis) ((LogisticsTileGenericPipe) adjacent.getTileEntity()).pipe).getPointedOrientation() == adjacent.getOurDirection()).map(adjacent -> (PipeLogisticsChassis) ((LogisticsTileGenericPipe) adjacent.getTileEntity()).pipe).flatMap(chassis -> chassis.getModules().getModules()).filter(logisticsModule -> logisticsModule instanceof AsyncQuicksortModule).map(logisticsModule -> new WeakReference<>((AsyncQuicksortModule) logisticsModule)).collect(Collectors.toList());
if (!list.isEmpty()) {
LogisticsEventListener.chestQuickSortConnection.put(event.getEntityPlayer(), list);
}
}
}
}
use of network.rs485.logisticspipes.module.AsyncQuicksortModule in project LogisticsPipes by RS485.
the class ChestGuiOpened method processPacket.
@Override
public void processPacket(EntityPlayer player) {
List<WeakReference<AsyncQuicksortModule>> list = LogisticsEventListener.chestQuickSortConnection.get(player);
if (list == null || list.isEmpty()) {
return;
}
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(EnableQuickSortMarker.class), player);
for (WeakReference<AsyncQuicksortModule> sorter : list) {
AsyncQuicksortModule module = sorter.get();
if (module == null) {
continue;
}
module.addWatchingPlayer(player);
}
}
use of network.rs485.logisticspipes.module.AsyncQuicksortModule in project LogisticsPipes by RS485.
the class ChestGuiClosed method processPacket.
@Override
public void processPacket(EntityPlayer player) {
List<WeakReference<AsyncQuicksortModule>> list = LogisticsEventListener.chestQuickSortConnection.get(player);
if (list == null || list.isEmpty()) {
return;
}
for (WeakReference<AsyncQuicksortModule> sorter : list) {
AsyncQuicksortModule module = sorter.get();
if (module == null) {
continue;
}
module.removeWatchingPlayer(player);
}
LogisticsEventListener.chestQuickSortConnection.remove(player);
}
Aggregations