Skip to content

Commit f00a9cb

Browse files
committed
more fixes for optionals in nbt... i am exploding
1 parent fe36c3e commit f00a9cb

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ minecraft_version=1.21
77
yarn_mappings=1.21+build.2
88
loader_version=0.15.11
99
# Mod Properties
10-
mod_version=0.12.15.1
10+
mod_version=0.12.15.4
1111
maven_group=io.wispforest
1212
archives_base_name=owo-lib
1313
# Dependencies

src/main/java/io/wispforest/owo/serialization/format/nbt/NbtDeserializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ public boolean hasNext() {
185185

186186
@Override
187187
public V next() {
188+
var element = this.elements.next();
188189
return NbtDeserializer.this.frame(
189-
this.elements::next,
190+
() -> element,
190191
() -> this.valueEndec.decode(this.ctx, NbtDeserializer.this),
191192
false
192193
);

src/main/java/io/wispforest/owo/serialization/format/nbt/NbtSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public <V> void writeOptional(SerializationContext ctx, Endec<V> endec, Optional
106106
this.frame(encoded -> {
107107
try (var struct = this.struct()) {
108108
struct.field("present", ctx, Endec.BOOLEAN, optional.isPresent());
109-
optional.ifPresent(value -> struct.field("value", ctx, endec, value));
109+
optional.ifPresent(value -> struct.field("value", ctx.withoutAttributes(OptionalFieldFlag.INSTANCE), endec, value));
110110
}
111111

112112
var compound = encoded.require("optional representation");

0 commit comments

Comments
 (0)