Skip to content

Commit

Permalink
Porting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Sep 9, 2024
1 parent c8169ff commit e6ceffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ public void serializeViewNetworkData(@NotNull final RegistryFriendlyByteBuf buf)
buf.writeInt(subInteractions.size());
for (final IInteractionResponseHandler interactionHandler : subInteractions)
{
buf.writeNbt(interactionHandler.serializeNBT(colony.getWorld().registryAccess()));
buf.writeNbt(interactionHandler.serializeNBT(buf.registryAccess()));
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import com.minecolonies.api.colony.interactionhandling.InteractionValidatorRegistry;
import com.minecolonies.api.util.NBTUtils;
import com.minecolonies.api.util.Tuple;
import com.minecolonies.api.util.Utils;
import com.minecolonies.core.client.gui.citizen.MainWindowCitizen;
import com.minecolonies.core.network.messages.server.colony.InteractionResponse;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.ComponentSerialization;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.world.entity.player.Player;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -184,12 +186,10 @@ public CompoundTag serializeNBT(@NotNull final HolderLookup.Provider provider)
final ListTag list = new ListTag();
for (final Component element : parents)
{
final CompoundTag elementTag = new CompoundTag();
elementTag.putString(TAG_PARENT, Component.Serializer.toJson(element, provider));
list.add(elementTag);
list.add(Utils.serializeCodecMess(ComponentSerialization.CODEC, provider, element));
}
compoundNBT.put(TAG_PARENTS, list);
compoundNBT.putString(TAG_VALIDATOR_ID, Component.Serializer.toJson(validatorId, provider));
compoundNBT.put(TAG_VALIDATOR_ID, Utils.serializeCodecMess(ComponentSerialization.CODEC, provider, validatorId));
return compoundNBT;
}

Expand All @@ -200,11 +200,11 @@ public void deserializeNBT(@NotNull final HolderLookup.Provider provider, @NotNu
this.displayAtWorldTick = compoundNBT.getInt(TAG_DELAY);
this.parents.clear();
final ListTag list = compoundNBT.getList(TAG_PARENTS, Tag.TAG_COMPOUND);
for (int i = 0; i < list.size(); i++)
for (Tag tag : list)
{
this.parents.add(Component.Serializer.fromJson(compoundNBT.getString(TAG_PARENT), provider));
this.parents.add(Utils.deserializeCodecMess(ComponentSerialization.CODEC, provider, tag));
}
this.validatorId = Component.Serializer.fromJson(compoundNBT.getString(TAG_VALIDATOR_ID), provider);
this.validatorId = Utils.deserializeCodecMess(ComponentSerialization.CODEC, provider, compoundNBT.get(TAG_VALIDATOR_ID));
loadValidator();
}

Expand Down

0 comments on commit e6ceffd

Please sign in to comment.