Skip to content

Commit 7f3b5fd

Browse files
committed
fix: isolate factory sourcing across shared Create frequencies
1 parent 7982164 commit 7f3b5fd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/main/java/com/innygr/icreateordernetworking/logistics/FactorySourcingPlan.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ public static FactorySourcingPlan createForAuthorizedStockLink(ServerLevel level
8383
for (FactoryEndpointRegistry.StockOffer offer :
8484
FactoryEndpointRegistry.findStock(level, networkId, requester, item)) {
8585
if (remaining == 0) break;
86-
if (bindings.authorizedBinding(level, offer.position(), actorId) == null) continue;
86+
StockLinkBindingData.Binding sourceBinding =
87+
bindings.authorizedBinding(level, offer.position(), actorId);
88+
if (!StockLinkBindingData.belongsToSameFactory(binding, sourceBinding)) continue;
8789
int amount = Math.min(remaining, offer.availableCount());
8890
if (amount <= 0) continue;
8991
allocations.add(new Allocation(offer, amount));
@@ -150,9 +152,11 @@ public boolean revalidateForAuthorizedStockLink(ServerLevel level, BlockPos stoc
150152
for (Allocation allocation : allocations) {
151153
FactoryEndpointRegistry.StockOffer offer = allocation.source();
152154
BlockPos position = offer.position();
155+
StockLinkBindingData.Binding sourceBinding = position == null ? null
156+
: bindings.authorizedBinding(level, position, actorId);
153157
if (position == null || !level.hasChunkAt(position)
154158
|| !expectedItem.equals(offer.itemId())
155-
|| bindings.authorizedBinding(level, position, actorId) == null) {
159+
|| !StockLinkBindingData.belongsToSameFactory(root, sourceBinding)) {
156160
return false;
157161
}
158162
FactoryEndpointRegistry.FactoryEndpoint endpoint = offer.endpoint();

0 commit comments

Comments
 (0)