aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/mayaqq/ygasi/mixin
diff options
context:
space:
mode:
authorMaximusbarcz <maxim.baranek@gmail.com>2022-12-24 14:00:57 +0100
committerMaximusbarcz <maxim.baranek@gmail.com>2022-12-24 14:00:57 +0100
commitb1d919ad2ebf0b176953d57edef8e75835c633e3 (patch)
treef3f754a46d475493711bab31310cd36344b312bd /src/main/java/dev/mayaqq/ygasi/mixin
parentf7ca47ba8132addd94928aa8615448c47a6b3d7b (diff)
downloadygasi-b1d919ad2ebf0b176953d57edef8e75835c633e3.tar.gz
ygasi-b1d919ad2ebf0b176953d57edef8e75835c633e3.tar.bz2
ygasi-b1d919ad2ebf0b176953d57edef8e75835c633e3.zip
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
Diffstat (limited to 'src/main/java/dev/mayaqq/ygasi/mixin')
-rw-r--r--src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java12
1 files changed, 6 insertions, 6 deletions
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);
}
}
}