use empty registryaccess where context is not needed, closes #1676

This commit is contained in:
granny
2025-06-13 19:21:39 -07:00
parent b1d412fb40
commit 293e28a048

View File

@@ -2,6 +2,7 @@ package org.purpurmc.purpur.entity;
import io.papermc.paper.adventure.PaperAdventure; import io.papermc.paper.adventure.PaperAdventure;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
@@ -31,7 +32,7 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
this.blockStorage = blockStorage; this.blockStorage = blockStorage;
CompoundTag customData = handle.occupant.entityData().copyTag(); CompoundTag customData = handle.occupant.entityData().copyTag();
net.minecraft.network.chat.Component customNameMinecraft = BlockEntity.parseCustomNameSafe(customData.get("CustomName"), ((CraftWorld) blockStorage.getWorld()).getHandle().registryAccess()); net.minecraft.network.chat.Component customNameMinecraft = BlockEntity.parseCustomNameSafe(customData.get("CustomName"), RegistryAccess.EMPTY);
this.customName = customNameMinecraft == null ? null : PaperAdventure.asAdventure(customNameMinecraft); this.customName = customNameMinecraft == null ? null : PaperAdventure.asAdventure(customNameMinecraft);
if (customData.get("BukkitValues") instanceof CompoundTag compoundTag) { if (customData.get("BukkitValues") instanceof CompoundTag compoundTag) {
@@ -98,7 +99,7 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
if(customName == null) { if(customName == null) {
handle.occupant.entityData().copyTag().remove("CustomName"); handle.occupant.entityData().copyTag().remove("CustomName");
} else { } else {
handle.occupant.entityData().copyTag().putString("CustomName", net.minecraft.network.chat.Component.Serializer.toJson(PaperAdventure.asVanilla(customName), ((CraftWorld) blockStorage.getWorld()).getHandle().registryAccess())); handle.occupant.entityData().copyTag().putString("CustomName", net.minecraft.network.chat.Component.Serializer.toJson(PaperAdventure.asVanilla(customName), RegistryAccess.EMPTY));
} }
} }
} }