mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
Don't create node / remove node in SimpleComponents when getComponentName returns null or an empty string.
Merry Christmas, Vic.
This commit is contained in:
parent
c83434c533
commit
b96411c40b
@ -1,5 +1,6 @@
|
|||||||
package li.cil.oc.common.asm.template;
|
package li.cil.oc.common.asm.template;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import li.cil.oc.api.Network;
|
import li.cil.oc.api.Network;
|
||||||
import li.cil.oc.api.network.Environment;
|
import li.cil.oc.api.network.Environment;
|
||||||
import li.cil.oc.api.network.Node;
|
import li.cil.oc.api.network.Node;
|
||||||
@ -29,8 +30,15 @@ public final class StaticSimpleEnvironment {
|
|||||||
if (SideTracker.isClient()) {
|
if (SideTracker.isClient()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!nodes.containsKey(self)) {
|
|
||||||
final String name = self.getComponentName();
|
final String name = self.getComponentName();
|
||||||
|
// If the name is null (or empty) this indicates we don't have a valid
|
||||||
|
// component right now, so if we have a node we kill it.
|
||||||
|
if (Strings.isNullOrEmpty(name)) {
|
||||||
|
final Node node = nodes.remove(self);
|
||||||
|
if (node != null) {
|
||||||
|
node.remove();
|
||||||
|
}
|
||||||
|
} else if (!nodes.containsKey(self)) {
|
||||||
nodes.put(self, Network.
|
nodes.put(self, Network.
|
||||||
newNode(self, Visibility.Network).
|
newNode(self, Visibility.Network).
|
||||||
withComponent(name).
|
withComponent(name).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user