needUpdateConnections only while updating cons (#113)

This commit is contained in:
Pilzinsel64 authored and GitHub committed 2023-03-23 21:12:11 +01:00
1 parent 0a1ee81780
commit 76708883c0
1 file changed
+12 -9
@@ -92,7 +92,9 @@ public abstract class AbstractConduit implements IConduit {
*
* @see needUpdateConnections()
*/
protected boolean needUpdateConnections = false;
private boolean needUpdateConnections = false;
private boolean isUpdatingConnections = false;
protected AbstractConduit() {}
@@ -444,10 +446,13 @@ public abstract class AbstractConduit implements IConduit {
}
private void updateConnections() {
if (!connectionsDirty) {
if (!connectionsDirty && !needUpdateConnections) {
return;
}
isUpdatingConnections = true;
needUpdateConnections = false;
boolean externalConnectionsChanged = false;
List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
// remove any no longer valid connections
@@ -471,12 +476,8 @@ public abstract class AbstractConduit implements IConduit {
connectionsChanged();
}
if (needUpdateConnections) {
// Seems the update was not successfull, let's try on the next Tick.
needUpdateConnections = false;
} else {
connectionsDirty = false;
}
connectionsDirty = false;
isUpdatingConnections = false;
}
/**
@@ -488,7 +489,9 @@ public abstract class AbstractConduit implements IConduit {
* See this PR for more info: https://github.com/GTNewHorizons/EnderIO/pull/111
*/
protected void needUpdateConnections() {
needUpdateConnections = true;
if (isUpdatingConnections) {
needUpdateConnections = true;
}
}
@Override