diff --git a/src/main/java/org/cyclops/integrateddynamics/api/part/write/IPartStateWriter.java b/src/main/java/org/cyclops/integrateddynamics/api/part/write/IPartStateWriter.java index 8fdf8d74045..ca09dbeb0a0 100644 --- a/src/main/java/org/cyclops/integrateddynamics/api/part/write/IPartStateWriter.java +++ b/src/main/java/org/cyclops/integrateddynamics/api/part/write/IPartStateWriter.java @@ -45,11 +45,13 @@ public interface IPartStateWriter
extends IPartState<
/**
* Indicate that this state should eventually recheck its aspect info because something might have changed what can
* cause the active variable to be referring to something else.
- * @param partType The part type.
- * @param target The target.
- * @param newAspect The new active aspect, can be null.
+ *
+ * @param partType The part type.
+ * @param target The target.
+ * @param newAspect The new active aspect, can be null.
+ * @param isNetworkInitializing If this method is being invoked during network (de)initializing.
*/
- public void triggerAspectInfoUpdate(P partType, PartTarget target, IAspectWrite newAspect);
+ public void triggerAspectInfoUpdate(P partType, PartTarget target, IAspectWrite newAspect, boolean isNetworkInitializing);
/**
* Called when this part should refresh its state.
diff --git a/src/main/java/org/cyclops/integrateddynamics/core/network/Network.java b/src/main/java/org/cyclops/integrateddynamics/core/network/Network.java
index 0cb4d09a729..cd9f22e2253 100644
--- a/src/main/java/org/cyclops/integrateddynamics/core/network/Network.java
+++ b/src/main/java/org/cyclops/integrateddynamics/core/network/Network.java
@@ -34,6 +34,7 @@
import org.cyclops.integrateddynamics.core.network.event.NetworkElementAddEvent;
import org.cyclops.integrateddynamics.core.network.event.NetworkElementRemoveEvent;
import org.cyclops.integrateddynamics.core.network.event.NetworkEventBus;
+import org.cyclops.integrateddynamics.core.network.event.VariableContentsUpdatedEvent;
import org.cyclops.integrateddynamics.core.path.Cluster;
import org.cyclops.integrateddynamics.core.path.PathFinder;
import org.cyclops.integrateddynamics.core.persist.world.NetworkWorldStorage;
@@ -325,6 +326,9 @@ protected void initialize(boolean silent) {
}
element.afterNetworkReAlive(this);
}
+
+ // Once all elements are alive, send a single variable contents updated event.
+ this.getEventBus().post(new VariableContentsUpdatedEvent(this));
}
@Override
diff --git a/src/main/java/org/cyclops/integrateddynamics/core/part/panel/PartTypePanelVariableDriven.java b/src/main/java/org/cyclops/integrateddynamics/core/part/panel/PartTypePanelVariableDriven.java
index 36787e710ab..6971e69ab14 100644
--- a/src/main/java/org/cyclops/integrateddynamics/core/part/panel/PartTypePanelVariableDriven.java
+++ b/src/main/java/org/cyclops/integrateddynamics/core/part/panel/PartTypePanelVariableDriven.java
@@ -50,7 +50,6 @@
import org.cyclops.integrateddynamics.core.helper.NetworkHelpers;
import org.cyclops.integrateddynamics.core.helper.PartHelpers;
import org.cyclops.integrateddynamics.core.helper.WrenchHelpers;
-import org.cyclops.integrateddynamics.core.network.event.NetworkElementAddEvent;
import org.cyclops.integrateddynamics.core.network.event.VariableContentsUpdatedEvent;
import org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase;
import org.cyclops.integrateddynamics.core.part.PartTypeBase;
@@ -82,7 +81,6 @@ protected Map updateEventListener = (network, target, state, event) -> NetworkHelpers
.getPartNetwork(network).ifPresent(partNetwork -> onVariableContentsUpdated(partNetwork, target, state));
actions.put(VariableContentsUpdatedEvent.class, updateEventListener);
- actions.put(NetworkElementAddEvent.Post.class, updateEventListener);
return actions;
}
@@ -99,18 +97,6 @@ public void addDrops(PartTarget target, S state, List updateEventListener = (network, target, state, event) -> NetworkHelpers
.getPartNetwork(network).ifPresent(partNetwork -> onVariableContentsUpdated(partNetwork, target, state));
actions.put(VariableContentsUpdatedEvent.class, updateEventListener);
- actions.put(NetworkElementAddEvent.Post.class, updateEventListener);
return actions;
}
@@ -113,14 +111,14 @@ public void addDrops(PartTarget target, S state, List