aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/mayaqq/ygasi/registry
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/mayaqq/ygasi/registry')
-rw-r--r--src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java23
-rw-r--r--src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java4
-rw-r--r--src/main/java/dev/mayaqq/ygasi/registry/ItemRegistry.java7
3 files changed, 23 insertions, 11 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java
index 781ef4d..2b29a3c 100644
--- a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java
+++ b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java
@@ -1,5 +1,6 @@
package dev.mayaqq.ygasi.registry;
+import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.context.CommandContext;
import dev.mayaqq.ygasi.gui.*;
@@ -15,6 +16,7 @@ import net.minecraft.util.Formatting;
import java.io.File;
+import static dev.mayaqq.ygasi.Ygasi.LOGGER;
import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS;
import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS_TOTAL;
import static net.minecraft.server.command.CommandManager.literal;
@@ -53,12 +55,19 @@ public class CommandRegistry {
.requires(source -> source.hasPermissionLevel(4))
.then(literal("skillpoints")
.then(literal("reset")
- .then(CommandManager.argument("target", EntityArgumentType.player())
+ .then(CommandManager.argument("targets", EntityArgumentType.players())
.executes(context -> {
- ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
- player.resetStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS));
- player.resetStat(Stats.CUSTOM.getOrCreateStat(StatRegistry.SKILL_POINTS_TOTAL));
- player.sendMessage(Text.translatable("commands.ygasi.skillpoints.reset", player.getEntityName()).formatted(Formatting.GREEN));
+ for (int i = 0; i <= EntityArgumentType.getPlayers(context, "targets").size(); i++) {
+ ServerPlayerEntity[] players = EntityArgumentType.getPlayers(context, "targets").toArray(new ServerPlayerEntity[0]);
+ ResetGui.reset(players[i]);
+ }
+ String players;
+ if (EntityArgumentType.getPlayers(context, "targets").size() == 1) {
+ players = EntityArgumentType.getPlayers(context, "targets").toArray()[0].toString();
+ } else {
+ players = EntityArgumentType.getPlayers(context, "targets").size() + " players";
+ }
+ context.getSource().sendMessage(Text.translatable("commands.ygasi.skillpoints.reset", players).formatted(Formatting.GREEN));
return 1;
})))
.then(literal("add")
@@ -69,14 +78,14 @@ public class CommandRegistry {
ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
player.increaseStat(SKILL_POINTS, amount);
player.increaseStat(SKILL_POINTS_TOTAL, amount);
- player.sendMessage(Text.translatable("commands.ygasi.skillpoints.add", amount, player.getName()).formatted(Formatting.GREEN));
+ context.getSource().sendMessage(Text.translatable("commands.ygasi.skillpoints.add", amount, player.getName()).formatted(Formatting.GREEN));
return 1;
}))))
.then(literal("get")
.then(CommandManager.argument("target", EntityArgumentType.player())
.executes(context -> {
ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
- player.sendMessage(Text.translatable("commands.ygasi.skillpoints.get", player.getEntityName(), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS_TOTAL))).formatted(Formatting.GREEN));
+ context.getSource().sendMessage(Text.translatable("commands.ygasi.skillpoints.get", player.getEntityName(), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS_TOTAL))).formatted(Formatting.GREEN));
return 1;
}))))
.then(literal("config")
diff --git a/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java
index 2c939b3..c48cd6e 100644
--- a/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java
+++ b/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java
@@ -11,7 +11,7 @@ public class ConfigRegistry {
public static Config CONFIG = new Config();
static File modConfFolder = new File(FabricLoader.getInstance().getConfigDir().toFile(),"ygasi");
- private static File configFile = new File(modConfFolder,"config.json");
+ private static final File configFile = new File(modConfFolder,"config.json");
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
public static void load() {
@@ -50,9 +50,11 @@ public class ConfigRegistry {
public int pointsRewarded = 1;
public int branchCost = 16;
public Boolean enableSkillBook = true;
+ public int resetCost = 10;
public int T1Cost = 5;
public int T2Cost = 10;
public int T3Cost = 15;
+ public int offence1DefIncrease = 3;
public Config() {}
}
diff --git a/src/main/java/dev/mayaqq/ygasi/registry/ItemRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/ItemRegistry.java
index 06f3196..145a063 100644
--- a/src/main/java/dev/mayaqq/ygasi/registry/ItemRegistry.java
+++ b/src/main/java/dev/mayaqq/ygasi/registry/ItemRegistry.java
@@ -13,8 +13,10 @@ import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
public class ItemRegistry {
- public static final SkillBookItem SKILL_BOOK = new SkillBookItem(new Item.Settings().maxCount(1), Items.BOOK);
+ public static final SkillBookItem SKILL_BOOK = Registry.register(Registries.ITEM, new Identifier("ygasi", "skill_book"), new SkillBookItem(new Item.Settings().maxCount(1), Items.BOOK));
+
public static void register() {
+ //Register item group
PolymerItemGroupUtils.builder(new Identifier("ygasi", "ygasi"))
.displayName(Text.translatable("creative.ygasi.group"))
.icon(() -> new ItemStack(Items.BOOK))
@@ -22,9 +24,8 @@ public class ItemRegistry {
entries.add(SKILL_BOOK);
})
.build();
+ //Register item model
PolymerResourcePackUtils.addModAssets("ygasi");
PolymerModelData skillBookModelData = PolymerResourcePackUtils.requestModel(Items.BOOK, new Identifier("ygasi", "item/skill_book"));
-
- Registry.register(Registries.ITEM, new Identifier("ygasi", "skill_book"), SKILL_BOOK);
}
}