diff --git a/implementations/fabric-1.20.5/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java b/implementations/fabric-1.20.5/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java index 85b0f2e6..2636fe1b 100644 --- a/implementations/fabric-1.20.5/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java +++ b/implementations/fabric-1.20.5/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java @@ -31,8 +31,6 @@ import de.bluecolored.bluemap.common.serverinterface.ServerWorld; import de.bluecolored.bluemap.core.world.World; import me.lucko.fabric.api.permissions.v0.Permissions; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryWrapper; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.util.math.Vec3d; @@ -40,8 +38,6 @@ public class FabricCommandSource implements CommandSource { - private static final RegistryWrapper.WrapperLookup lookup = BuiltinRegistries.createWrapperLookup(); - private final FabricMod mod; private final Plugin plugin; private final ServerCommandSource delegate; @@ -56,7 +52,7 @@ public FabricCommandSource(FabricMod mod, Plugin plugin, ServerCommandSource del public void sendMessage(Text text) { delegate.sendFeedback( () -> net.minecraft.text.Text.Serialization - .fromJson(text.toJSONString(), lookup), + .fromJson(text.toJSONString(), delegate.getRegistryManager()), false ); } diff --git a/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java b/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java index 85b0f2e6..2636fe1b 100644 --- a/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java +++ b/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java @@ -31,8 +31,6 @@ import de.bluecolored.bluemap.common.serverinterface.ServerWorld; import de.bluecolored.bluemap.core.world.World; import me.lucko.fabric.api.permissions.v0.Permissions; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryWrapper; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.util.math.Vec3d; @@ -40,8 +38,6 @@ public class FabricCommandSource implements CommandSource { - private static final RegistryWrapper.WrapperLookup lookup = BuiltinRegistries.createWrapperLookup(); - private final FabricMod mod; private final Plugin plugin; private final ServerCommandSource delegate; @@ -56,7 +52,7 @@ public FabricCommandSource(FabricMod mod, Plugin plugin, ServerCommandSource del public void sendMessage(Text text) { delegate.sendFeedback( () -> net.minecraft.text.Text.Serialization - .fromJson(text.toJSONString(), lookup), + .fromJson(text.toJSONString(), delegate.getRegistryManager()), false ); } diff --git a/implementations/forge-1.20.6/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java b/implementations/forge-1.20.6/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java index 564b7b25..6c4cce31 100644 --- a/implementations/forge-1.20.6/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java +++ b/implementations/forge-1.20.6/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java @@ -31,16 +31,12 @@ import de.bluecolored.bluemap.common.serverinterface.ServerWorld; import de.bluecolored.bluemap.core.world.World; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.core.HolderLookup; -import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.network.chat.Component; import java.util.Optional; public class ForgeCommandSource implements CommandSource { - private static final HolderLookup.Provider lookup = VanillaRegistries.createLookup(); - private final ForgeMod mod; private final Plugin plugin; private final CommandSourceStack delegate; @@ -53,7 +49,7 @@ public ForgeCommandSource(ForgeMod mod, Plugin plugin, CommandSourceStack delega @Override public void sendMessage(Text text) { - var component = Component.Serializer.fromJsonLenient(text.toJSONString(), lookup); + var component = Component.Serializer.fromJsonLenient(text.toJSONString(), delegate.registryAccess()); if (component != null) delegate.sendSuccess(() -> component, false); } diff --git a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java index 564b7b25..6c4cce31 100644 --- a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java +++ b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java @@ -31,16 +31,12 @@ import de.bluecolored.bluemap.common.serverinterface.ServerWorld; import de.bluecolored.bluemap.core.world.World; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.core.HolderLookup; -import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.network.chat.Component; import java.util.Optional; public class ForgeCommandSource implements CommandSource { - private static final HolderLookup.Provider lookup = VanillaRegistries.createLookup(); - private final ForgeMod mod; private final Plugin plugin; private final CommandSourceStack delegate; @@ -53,7 +49,7 @@ public ForgeCommandSource(ForgeMod mod, Plugin plugin, CommandSourceStack delega @Override public void sendMessage(Text text) { - var component = Component.Serializer.fromJsonLenient(text.toJSONString(), lookup); + var component = Component.Serializer.fromJsonLenient(text.toJSONString(), delegate.registryAccess()); if (component != null) delegate.sendSuccess(() -> component, false); } diff --git a/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java b/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java index 564b7b25..6c4cce31 100644 --- a/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java +++ b/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java @@ -31,16 +31,12 @@ import de.bluecolored.bluemap.common.serverinterface.ServerWorld; import de.bluecolored.bluemap.core.world.World; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.core.HolderLookup; -import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.network.chat.Component; import java.util.Optional; public class ForgeCommandSource implements CommandSource { - private static final HolderLookup.Provider lookup = VanillaRegistries.createLookup(); - private final ForgeMod mod; private final Plugin plugin; private final CommandSourceStack delegate; @@ -53,7 +49,7 @@ public ForgeCommandSource(ForgeMod mod, Plugin plugin, CommandSourceStack delega @Override public void sendMessage(Text text) { - var component = Component.Serializer.fromJsonLenient(text.toJSONString(), lookup); + var component = Component.Serializer.fromJsonLenient(text.toJSONString(), delegate.registryAccess()); if (component != null) delegate.sendSuccess(() -> component, false); }