blob: a2c133040b0406ec1fb655433d3cd14aa7b6ad7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
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;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS;
@Mixin(AdvancementRewards.class)
public class AdvancementRewardsMixin {
@Shadow @Final private Identifier[] recipes;
@Inject(method = "apply", at = @At("HEAD"))
private void inject(ServerPlayerEntity player, CallbackInfo ci) {
if (recipes.length == 0) {
player.increaseStat(SKILL_POINTS, ConfigRegistry.CONFIG.pointsRewarded);
}
}
}
|