Remove amount from FluidStack hashCode to fix the equal/hashCode java contract (#9602)

This commit is contained in:
Sara Freimer authored and GitHub committed 2023-06-27 13:57:34 +02:00
1 parent a8dce04c1b
commit 81f123fcab
2 files changed
+2 -3

No files matched your search

@@ -315,7 +315,6 @@ public class FluidStack
{
int code = 1;
code = 31*code + getFluid().hashCode();
code = 31*code + amount;
if (tag != null)
code = 31*code + tag.hashCode();
return code;
@@ -61,9 +61,9 @@ public class CodecsTest
LOGGER.error("Error decoding withTag: {}", error);
}).getFirst();
if (!noTag.equals(noTag_decode))
if (!noTag.isFluidStackIdentical(noTag_decode))
throw new IllegalStateException("Decoded noTag does not match");
if (!withTag.equals(withTag_decode))
if (!withTag.isFluidStackIdentical(withTag_decode))
throw new IllegalStateException("Decoded withTag does not match");
}
}