From b1d919ad2ebf0b176953d57edef8e75835c633e3 Mon Sep 17 00:00:00 2001 From: Maximusbarcz Date: Sat, 24 Dec 2022 14:00:57 +0100 Subject: Last christmas I gave you my commit But the very next day you pushed it This year, to save me from conflicts I'll give it to github directly --- .../java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/dev/mayaqq/ygasi/mixin') diff --git a/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java b/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java index a2c1330..58e8353 100644 --- a/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java +++ b/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java @@ -1,11 +1,7 @@ package dev.mayaqq.ygasi.mixin; import dev.mayaqq.ygasi.registry.ConfigRegistry; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementDisplay; -import net.minecraft.advancement.AdvancementFrame; import net.minecraft.advancement.AdvancementRewards; -import net.minecraft.server.ServerAdvancementLoader; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Final; @@ -20,12 +16,16 @@ import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS; @Mixin(AdvancementRewards.class) public class AdvancementRewardsMixin { + @Shadow @Final private Identifier[] recipes; + @Shadow @Final private int experience; @Inject(method = "apply", at = @At("HEAD")) - private void inject(ServerPlayerEntity player, CallbackInfo ci) { - if (recipes.length == 0) { + private void apply(ServerPlayerEntity player, CallbackInfo ci) { + if (recipes.length == 0 && experience != 1) { player.increaseStat(SKILL_POINTS, ConfigRegistry.CONFIG.pointsRewarded); + } else if (experience == 1) { + player.addExperience(-1); } } } -- cgit