Skip to content

Commit f02ed13

Browse files
Merge pull request #57 from RecursivePineapple/iface-p2p-lag-spike
Prevent interface p2p lag spikes
2 parents ad7b918 + b0c6f12 commit f02ed13

File tree

1 file changed

+10
-8
lines changed
  • src/main/java/com/recursive_pineapple/matter_manipulator/common/building

1 file changed

+10
-8
lines changed

src/main/java/com/recursive_pineapple/matter_manipulator/common/building/AEPartData.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,16 @@ public boolean updatePart(IBlockApplyContext context, IPartHost partHost, ForgeD
153153
if (part instanceof PartP2PTunnel<?> tunnel) {
154154
tunnel.output = mP2POutput;
155155

156-
try {
157-
final P2PCache p2p = tunnel.getProxy().getP2P();
158-
159-
// calls setFrequency
160-
p2p.updateFreq(tunnel, mP2PFreq);
161-
} catch (final GridAccessException e) {
162-
// not on a grid yet, so we just set the frequency directly
163-
tunnel.setFrequency(mP2PFreq);
156+
if (tunnel.getFrequency() != mP2PFreq) {
157+
try {
158+
final P2PCache p2p = tunnel.getProxy().getP2P();
159+
160+
// calls setFrequency
161+
p2p.updateFreq(tunnel, mP2PFreq);
162+
} catch (final GridAccessException e) {
163+
// not on a grid yet, so we just set the frequency directly
164+
tunnel.setFrequency(mP2PFreq);
165+
}
164166
}
165167

166168
tunnel.onTunnelConfigChange();

0 commit comments

Comments
 (0)