From b06bd86af557bca69ceba79ff3ea68bad24f7b9f Mon Sep 17 00:00:00 2001 From: Cat Core Date: Sun, 28 Jul 2024 12:51:17 +0200 Subject: [PATCH] Fix crash on server --- .../fabric/impl/item/versioned/EarlyInitializer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/legacy-fabric-item-api-v1/1.12.2/src/main/java/net/legacyfabric/fabric/impl/item/versioned/EarlyInitializer.java b/legacy-fabric-item-api-v1/1.12.2/src/main/java/net/legacyfabric/fabric/impl/item/versioned/EarlyInitializer.java index 17d33b408..0f6105ee8 100644 --- a/legacy-fabric-item-api-v1/1.12.2/src/main/java/net/legacyfabric/fabric/impl/item/versioned/EarlyInitializer.java +++ b/legacy-fabric-item-api-v1/1.12.2/src/main/java/net/legacyfabric/fabric/impl/item/versioned/EarlyInitializer.java @@ -17,6 +17,9 @@ package net.legacyfabric.fabric.impl.item.versioned; +import net.fabricmc.api.EnvType; +import net.fabricmc.loader.api.FabricLoader; + import net.minecraft.item.Item; import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; @@ -35,6 +38,6 @@ public void onPreLaunch() { private static void itemRegistryInit(Registry holder) { SyncedRegistry registry = (SyncedRegistry) holder; - registry.fabric$getRegistryRemapCallback().register(new ItemModelsRemapper()); + if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) registry.fabric$getRegistryRemapCallback().register(new ItemModelsRemapper()); } }