Skip to content

Commit 8c413ad

Browse files
committed
Simplify NBTCodecImpl.withEdition() and add toString()
1 parent 95829b4 commit 8c413ad

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/main/java/org/glavo/nbt/internal/NBTCodecImpl.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public MinecraftEdition getEdition() {
9090
@Override
9191
public NBTCodec withEdition(MinecraftEdition edition) {
9292
Objects.requireNonNull(edition, "edition");
93-
return edition == this.edition ? this : new NBTCodecImpl(edition);
93+
return NBTCodec.of(edition);
9494
}
9595

9696
private Tag check(@Nullable Tag tag) throws IOException {
@@ -142,4 +142,8 @@ public void writeTag(Tag tag, OutputStream outputStream) throws IOException {
142142
}
143143
}
144144

145+
@Override
146+
public String toString() {
147+
return "NBTCodecImpl[edition=%s]".formatted(edition);
148+
}
145149
}

0 commit comments

Comments
 (0)