Skip to content

Commit

Permalink
Merge branch 'Stat-Fixes' into 1.7.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
UselessBullets committed Oct 22, 2023
2 parents ddf1de2 + 4b9356d commit 9ea6774
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -17,4 +18,7 @@ public class BlockMixin {
private static void captureHighest(CallbackInfo ci) {
BlockHelper.highestVanilla = highestBlockId;
}
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/achievement/stat/StatList;onBlockInit()V"))
private static void delayInit() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit 9ea6774

Please sign in to comment.