aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximusbarcz <maxim.baranek@gmail.com>2022-10-01 22:24:40 +0200
committerMaximusbarcz <maxim.baranek@gmail.com>2022-10-01 22:24:40 +0200
commitbe13b8cd6ee13d47828751a4e92e435556153c54 (patch)
treeffb7880ecf9d516755270f6f2c56cf8a70c63fa3 /src
parentcaae62f9978b4c40e8cabcb45a76a8b92b6b2615 (diff)
downloadygasi-be13b8cd6ee13d47828751a4e92e435556153c54.tar.gz
ygasi-be13b8cd6ee13d47828751a4e92e435556153c54.tar.bz2
ygasi-be13b8cd6ee13d47828751a4e92e435556153c54.zip
Initial Commit - Implemented Skill Points
Diffstat (limited to 'src')
-rw-r--r--src/main/java/dev/mayaqq/ygasi/StatRegistry.java12
-rw-r--r--src/main/java/dev/mayaqq/ygasi/mixin/AdvancementRewardsMixin.java27
-rw-r--r--src/main/java/dev/mayaqq/ygasi/ygasi.java15
-rw-r--r--src/main/java/net/fabricmc/example/ExampleMod.java21
-rw-r--r--src/main/java/net/fabricmc/example/mixin/ExampleMixin.java16
-rw-r--r--src/main/resources/assets/modid/icon.pngbin453 -> 0 bytes
-rw-r--r--src/main/resources/assets/ygasi/icon.pngbin0 -> 26011 bytes
-rw-r--r--src/main/resources/fabric.mod.json22
-rw-r--r--src/main/resources/ygasi.mixins.json (renamed from src/main/resources/modid.mixins.json)6
9 files changed, 69 insertions, 50 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!");
+ }
+}
diff --git a/src/main/java/net/fabricmc/example/ExampleMod.java b/src/main/java/net/fabricmc/example/ExampleMod.java
deleted file mode 100644
index a964189..0000000
--- a/src/main/java/net/fabricmc/example/ExampleMod.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.fabricmc.example;
-
-import net.fabricmc.api.ModInitializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ExampleMod implements ModInitializer {
- // This logger is used to write text to the console and the log file.
- // It is considered best practice to use your mod id as the logger's name.
- // That way, it's clear which mod wrote info, warnings, and errors.
- public static final Logger LOGGER = LoggerFactory.getLogger("modid");
-
- @Override
- public void onInitialize() {
- // This code runs as soon as Minecraft is in a mod-load-ready state.
- // However, some things (like resources) may still be uninitialized.
- // Proceed with mild caution.
-
- LOGGER.info("Hello Fabric world!");
- }
-}
diff --git a/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java b/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java
deleted file mode 100644
index 356cb38..0000000
--- a/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.fabricmc.example.mixin;
-
-import net.fabricmc.example.ExampleMod;
-import net.minecraft.client.gui.screen.TitleScreen;
-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;
-
-@Mixin(TitleScreen.class)
-public class ExampleMixin {
- @Inject(at = @At("HEAD"), method = "init()V")
- private void init(CallbackInfo info) {
- ExampleMod.LOGGER.info("This line is printed by an example mod mixin!");
- }
-}
diff --git a/src/main/resources/assets/modid/icon.png b/src/main/resources/assets/modid/icon.png
deleted file mode 100644
index 047b91f..0000000
--- a/src/main/resources/assets/modid/icon.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/ygasi/icon.png b/src/main/resources/assets/ygasi/icon.png
new file mode 100644
index 0000000..dc0a055
--- /dev/null
+++ b/src/main/resources/assets/ygasi/icon.png
Binary files differ
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 3428658..1ec8757 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -1,29 +1,29 @@
{
"schemaVersion": 1,
- "id": "modid",
- "version": "${version}",
+ "id": "ygasi",
+ "version": "0.1",
- "name": "Example Mod",
- "description": "This is an example description! Tell everyone what your mod is about!",
+ "name": "You've got a Skill Issue",
+ "description": "A Server-side Fabric mod with a skill tree and leveling! ",
"authors": [
- "Me!"
+ "Mayaqq"
],
"contact": {
- "homepage": "https://fabricmc.net/",
- "sources": "https://github.com/FabricMC/fabric-example-mod"
+ "homepage": "https://github.com/Maximusbarcz",
+ "sources": "https://github.com/Maximusbarcz/youve-got-a-skill-issue"
},
- "license": "CC0-1.0",
- "icon": "assets/modid/icon.png",
+ "license": "LGPL-3",
+ "icon": "assets/ygasi/icon.png",
"environment": "*",
"entrypoints": {
"main": [
- "net.fabricmc.example.ExampleMod"
+ "dev.mayaqq.ygasi.ygasi"
]
},
"mixins": [
- "modid.mixins.json"
+ "ygasi.mixins.json"
],
"depends": {
diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/ygasi.mixins.json
index 7c42cb4..aeb9daf 100644
--- a/src/main/resources/modid.mixins.json
+++ b/src/main/resources/ygasi.mixins.json
@@ -1,12 +1,14 @@
{
"required": true,
"minVersion": "0.8",
- "package": "net.fabricmc.example.mixin",
+ "package": "dev.mayaqq.ygasi.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
+ "AdvancementRewardsMixin"
],
"client": [
- "ExampleMixin"
+ ],
+ "server": [
],
"injectors": {
"defaultRequire": 1