Added equals for Networks and ConnectionPairs

Just in case that was screwing something up at some point
This commit is contained in:
Ellpeck 2016-06-05 12:51:13 +02:00
parent 32446f3921
commit 505c88f031

View file

@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import sun.nio.ch.Net;
public class LaserRelayConnectionHandler{ public class LaserRelayConnectionHandler{
@ -183,6 +184,19 @@ public class LaserRelayConnectionHandler{
} }
return compound; 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{ public static class Network{
@ -193,5 +207,15 @@ public class LaserRelayConnectionHandler{
public String toString(){ public String toString(){
return this.connections.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);
}
} }
} }