Skip to content

Commit

Permalink
Remove Unneeded Logic
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Aug 25, 2024
1 parent 7d5bd2a commit d2fc4f0
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -22,18 +21,14 @@
import com.nomiceu.nomilabs.integration.betterp2p.AccessibleGridServerCache;
import com.projecturanus.betterp2p.network.data.GridServerCache;
import com.projecturanus.betterp2p.network.data.P2PLocation;
import com.projecturanus.betterp2p.network.data.P2PLocationKt;
import com.projecturanus.betterp2p.util.p2p.TunnelInfo;

import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
import appeng.api.networking.security.ISecurityGrid;
import appeng.helpers.IInterfaceHost;
import appeng.me.GridAccessException;
import appeng.me.cache.P2PCache;
import appeng.parts.p2p.PartP2PTunnel;
import appeng.util.Platform;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import kotlin.Pair;

/**
Expand Down Expand Up @@ -85,28 +80,6 @@ private void properlyLinkP2p(P2PLocation inputIndex, P2PLocation outputIndex,
var input = listP2P.get(inputIndex);
var output = listP2P.get(outputIndex);

P2PCache cache = null;
try {
cache = input.getProxy().getP2P();
} catch (GridAccessException e) {
throw new RuntimeException(e);
}

var inputs = cache.getInputs(frequency, input.getClass());
if (!inputs.isEmpty()) {
List<Supplier<PartP2PTunnel<?>>> toPerform = new ObjectArrayList<>();
for (var origInput : inputs) {
if (origInput != input) {
// Add to a 'To Perform' Queue, so we don't modify concurrently
toPerform.add(() -> updateP2P(P2PLocationKt.toLoc(origInput), origInput, frequency, false,
origInput.hasCustomInventoryName() ? origInput.getCustomInventoryName() : ""));
}
}
for (var perform : toPerform) {
perform.get();
}
}

// Perform the link
var inputResult = updateP2P(inputIndex, input, frequency, false,
input.hasCustomInventoryName() ? input.getCustomInventoryName() : "");
Expand Down

0 comments on commit d2fc4f0

Please sign in to comment.