-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues with incorrectly reading optional fields for NBT
- Loading branch information
1 parent
478c7f7
commit 278ca4c
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/main/java/io/wispforest/owo/serialization/format/nbt/IdentityHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.wispforest.owo.serialization.format.nbt; | ||
|
||
record IdentityHolder<T>(T t) { | ||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null || obj.getClass() != this.getClass()) return false; | ||
return this.t == ((IdentityHolder<?>) obj).t; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return System.identityHashCode(this.t); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "IdentityHolder[t=" + t + ']'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters