Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static Tag serializeField(HolderLookup.Provider registries, ISyncManaged
boolean writeClientFields, boolean fullSync) {
Object currentValue = field.handle.get(holder);

if (!field.isSyncManaged && currentValue == null) {
if (currentValue == null) {
var nullCompound = new CompoundTag();
nullCompound.putBoolean("null", true);
return nullCompound;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ public Tag serializeNBT(@Nullable CoverBehavior value,
if (value != null) {
return serialize(value, context.isClientSync(), context.lookup());
}
return new CompoundTag();
var nullTag = new CompoundTag();
nullTag.putBoolean("null", true);
return nullTag;
}

@Override
public @Nullable CoverBehavior deserializeNBT(Tag tag,
CoverBehaviorTransformer.TransformerContext<CoverBehavior> context) {
var compoundTag = ValueTransformer.assertTagType(CompoundTag.class, tag, context);
if (compoundTag.getBoolean("null")) {
return null;
}
if (context.holder() instanceof ICoverable coverable) {
return deserialize(compoundTag, coverable, context.currentValue(), context.isClientSync(),
context.lookup());
Expand Down
Loading