|
6 | 6 |
|
7 | 7 | import com.innygr.icreateordernetworking.registry.ModBlockEntities; |
8 | 8 | import com.innygr.icreateordernetworking.delivery.TrainShipmentMarker; |
| 9 | +import com.innygr.icreateordernetworking.delivery.DeliveryRoute; |
| 10 | +import com.innygr.icreateordernetworking.delivery.ShipmentJournalData; |
9 | 11 | import com.innygr.icreateordernetworking.delivery.AutomatedDeliveryService; |
10 | 12 | import com.innygr.icreateordernetworking.compat.FTBTeamsCompat; |
11 | 13 | import com.innygr.icreateordernetworking.logistics.TerminalLoggerConnection; |
@@ -94,11 +96,25 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { |
94 | 96 | // Cargo reserved for a durable shipment is locked to its route |
95 | 97 | // adapter. A belt, funnel, or other capability consumer must not |
96 | 98 | // be able to steal it from the logger while dispatch is pending. |
97 | | - if (TrainShipmentMarker.transactionId(inventory.getStackInSlot(slot)) != null) { |
98 | | - // A Packager directly attached to the configured output face |
99 | | - // is the one permitted consumer for Frogport-bound reserved |
100 | | - // cargo. Other pipes, belts, and automation still cannot steal it. |
101 | | - BlockEntity adjacent = level == null ? null : level.getBlockEntity(worldPosition.relative(side)); |
| 99 | + ItemStack existing = inventory.getStackInSlot(slot); |
| 100 | + UUID transactionId = TrainShipmentMarker.transactionId(existing); |
| 101 | + if (transactionId != null) { |
| 102 | + // Only the source Packager for a live Frogport reservation may |
| 103 | + // consume marked cargo. A nearby Packager must never steal a |
| 104 | + // train/airship shipment or a marker from another logger. |
| 105 | + if (!(level instanceof net.minecraft.server.level.ServerLevel serverLevel)) { |
| 106 | + return ItemStack.EMPTY; |
| 107 | + } |
| 108 | + ShipmentJournalData.Shipment shipment = |
| 109 | + ShipmentJournalData.get(serverLevel).find(transactionId); |
| 110 | + String source = worldPosition.getX() + "," + worldPosition.getY() + "," + worldPosition.getZ(); |
| 111 | + if (shipment == null || shipment.route() != DeliveryRoute.FROGPORT |
| 112 | + || shipment.stage() != ShipmentJournalData.Stage.RESERVED |
| 113 | + || !shipment.sourceReference().startsWith(source + ">") |
| 114 | + || !TrainShipmentMarker.matches(existing, shipment)) { |
| 115 | + return ItemStack.EMPTY; |
| 116 | + } |
| 117 | + BlockEntity adjacent = level.getBlockEntity(worldPosition.relative(side)); |
102 | 118 | if (!(adjacent instanceof com.simibubi.create.content.logistics.packager.PackagerBlockEntity packager) |
103 | 119 | || packager.getBlockState().getValue( |
104 | 120 | com.simibubi.create.content.logistics.packager.PackagerBlock.FACING) != side |
|
0 commit comments