diff options
author | Maximusbarcz <maxim.baranek@gmail.com> | 2022-10-01 22:24:40 +0200 |
---|---|---|
committer | Maximusbarcz <maxim.baranek@gmail.com> | 2022-10-01 22:24:40 +0200 |
commit | be13b8cd6ee13d47828751a4e92e435556153c54 (patch) | |
tree | ffb7880ecf9d516755270f6f2c56cf8a70c63fa3 /src/main/java/dev/mayaqq | |
parent | caae62f9978b4c40e8cabcb45a76a8b92b6b2615 (diff) | |
download | ygasi-be13b8cd6ee13d47828751a4e92e435556153c54.tar.gz ygasi-be13b8cd6ee13d47828751a4e92e435556153c54.tar.bz2 ygasi-be13b8cd6ee13d47828751a4e92e435556153c54.zip |
Initial Commit - Implemented Skill Points
Diffstat (limited to 'src/main/java/dev/mayaqq')
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/StatRegistry.java | 12 | ||||
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java | 27 | ||||
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/ygasi.java | 15 |
3 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/StatRegistry.java b/src/main/java/dev/mayaqq/ygasi/StatRegistry.java new file mode 100644 index 0000000..0b1c986 --- /dev/null +++ b/src/main/java/dev/mayaqq/ygasi/StatRegistry.java @@ -0,0 +1,12 @@ +package dev.mayaqq.ygasi; + +import eu.pb4.polymer.api.other.PolymerStat; +import net.minecraft.stat.StatFormatter; +import net.minecraft.util.Identifier; + + +public class StatRegistry { + public static Identifier SKILL_POINTS = PolymerStat.registerStat("skill_points", StatFormatter.DEFAULT); + + public static void skillRegister() {} +} diff --git a/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java b/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java new file mode 100644 index 0000000..8848d28 --- /dev/null +++ b/src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java @@ -0,0 +1,27 @@ +package dev.mayaqq.ygasi.mixin; + +import net.minecraft.advancement.AdvancementRewards; +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.StatRegistry.SKILL_POINTS; +import static dev.mayaqq.ygasi.ygasi.LOGGER; + +@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) { + LOGGER.info("Skill point unlocked"); + player.increaseStat(SKILL_POINTS, 1); + } + } +} diff --git a/src/main/java/dev/mayaqq/ygasi/ygasi.java b/src/main/java/dev/mayaqq/ygasi/ygasi.java new file mode 100644 index 0000000..185ae6e --- /dev/null +++ b/src/main/java/dev/mayaqq/ygasi/ygasi.java @@ -0,0 +1,15 @@ +package dev.mayaqq.ygasi; + +import net.fabricmc.api.ModInitializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ygasi implements ModInitializer { + public static final Logger LOGGER = LoggerFactory.getLogger("ygasi"); + + @Override + public void onInitialize() { + StatRegistry.skillRegister(); + LOGGER.info("You've got a skill issue!"); + } +} |