ScriptItemStack, ScriptEntity, ScriptBlock, & ScriptBlockPos:

-Implemented equals() functions for comparing objects of these types
This commit is contained in:
Luis C.M committed 2023-06-03 00:34:07 -05:00
1 parent 826a90bd6d
commit 29fb8d1dcf
5 files changed
+19 -6

No files matched your search

@@ -19,7 +19,6 @@ import noppes.npcs.util.LRUHashMap;
import java.util.Map;
public class ScriptBlock implements IBlock {
private static final Map<String, IBlock> blockCache = new LRUHashMap(400);
protected IWorld world;
protected Block block;
protected BlockPos pos;
@@ -147,10 +146,6 @@ public class ScriptBlock implements IBlock {
return this.block;
}
public static void clearCache() {
blockCache.clear();
}
public boolean hasTileEntity() {
return this.tile != null;
}
@@ -226,4 +221,10 @@ public class ScriptBlock implements IBlock {
public String toString() {
return this.getName() + " @" + this.getPos() + (world == null ? "" : " in DIM" + world.getDimensionID());
}
public boolean equals(Object obj) {
return obj instanceof IBlock && ((ScriptBlock)obj).getName().equals(this.getName()) &&
((ScriptBlock)obj).getWorld() == this.getWorld() &&
((ScriptBlock)obj).getPos().equals(this.getPos());
}
}