diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/BlockMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/BlockMixin.java index 8c8f986..6ea3aaa 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/BlockMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/BlockMixin.java @@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import turniplabs.halplibe.helper.BlockHelper; @@ -17,4 +18,7 @@ public class BlockMixin { private static void captureHighest(CallbackInfo ci) { BlockHelper.highestVanilla = highestBlockId; } + @Redirect(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/achievement/stat/StatList;onBlockInit()V")) + private static void delayInit() { + } } diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java index 1d1c578..d6e10fd 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java @@ -19,6 +19,8 @@ public void postInit(CallbackInfo ci) { m.setAccessible(true); m.invoke(null); m.setAccessible(false); + StatList.init(); + StatList.onBlockInit(); StatList.onItemInit(); } catch (Throwable err) { throw new RuntimeException(err); diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftServerMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftServerMixin.java index 181899f..641a0de 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftServerMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftServerMixin.java @@ -1,15 +1,11 @@ package turniplabs.halplibe.mixin.mixins.registry; -import net.minecraft.client.Minecraft; -import net.minecraft.core.achievement.stat.StatBase; import net.minecraft.core.achievement.stat.StatList; -import net.minecraft.core.item.Item; import net.minecraft.server.MinecraftServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import turniplabs.halplibe.helper.BlockHelper; import turniplabs.halplibe.helper.RegistryHelper; import java.lang.reflect.Method; @@ -23,8 +19,9 @@ public void postInit(CallbackInfo ci) { m.setAccessible(true); m.invoke(null); m.setAccessible(false); - StatList.craftedItemStats = new StatBase[Item.itemsList.length]; - StatList.pickUpItemStats = new StatBase[Item.itemsList.length]; + StatList.init(); + StatList.onBlockInit(); + StatList.onItemInit(); } catch (Throwable err) { throw new RuntimeException(err); }