From 505c88f031ee5803e01b064c03bfa13795fe38d9 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 5 Jun 2016 12:51:13 +0200 Subject: [PATCH] Added equals for Networks and ConnectionPairs Just in case that was screwing something up at some point --- .../mod/misc/LaserRelayConnectionHandler.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java index 1c6bb47b1..5eb0ad9a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java @@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import sun.nio.ch.Net; public class LaserRelayConnectionHandler{ @@ -183,6 +184,19 @@ public class LaserRelayConnectionHandler{ } return compound; } + + @Override + public boolean equals(Object obj){ + if(obj instanceof ConnectionPair){ + ConnectionPair pair = (ConnectionPair)obj; + if(this.firstRelay != null && this.firstRelay.equals(pair.firstRelay)){ + if(this.secondRelay != null && this.secondRelay.equals(pair.secondRelay)){ + return true; + } + } + } + return super.equals(obj); + } } public static class Network{ @@ -193,5 +207,15 @@ public class LaserRelayConnectionHandler{ public String toString(){ return this.connections.toString(); } + + @Override + public boolean equals(Object obj){ + if(obj instanceof Network){ + if(this.connections.equals(((Network)obj).connections)){ + return true; + } + } + return super.equals(obj); + } } } \ No newline at end of file