diff options
5 files changed, 39 insertions, 17 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java index c88d2de..87a0c85 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java @@ -6,6 +6,7 @@ import dev.mayaqq.ygasi.gui.common.SkillGui; import dev.mayaqq.ygasi.registry.ConfigRegistry; import dev.mayaqq.ygasi.util.AdvUtils; import eu.pb4.sgui.api.elements.GuiElementBuilder; +import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.server.network.ServerPlayerEntity; @@ -13,6 +14,7 @@ import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.stat.Stats; import net.minecraft.text.Text; +import net.minecraft.util.Formatting; import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS; @@ -38,9 +40,9 @@ public class MercenaryGui { gui.setSlot(49, new GuiElementBuilder() .setItem(Items.DIAMOND_BLOCK) - .setName(Text.of("§c§lMercenary Unlocked!")) - .addLoreLine(Text.of("§3Skill Points: " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)))) - ); + .setName(Text.translatable("gui.ygasi.branch.mercenary.title")) + .addLoreLine(Text.translatable("gui.ygasi.branch.title", Text.of((String.valueOf(player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)))).formatted(Formatting.DARK_GRAY))) + )); int[] positions = {38, 19, 1, 40, 22, 4, 42, 25, 7}; String[] advancementNames = {"offence1", "offence2", "offence3", "ninja1", "ninja2", "ninja3", "defence1", "defence2", "defence3"}; @@ -53,6 +55,11 @@ public class MercenaryGui { "gui.ygasi.mercenary.ninja1", "gui.ygasi.mercenary.ninja2", "gui.ygasi.mercenary.ninja3", "gui.ygasi.mercenary.defence1", "gui.ygasi.mercenary.defence2", "gui.ygasi.mercenary.defence3" }; + Item[] items = { + Items.IRON_SWORD, Items.DIAMOND_SWORD, Items.NETHERITE_SWORD, + Items.STICK, Items.BAMBOO, Items.BLAZE_ROD, + Items.IRON_CHESTPLATE, Items.DIAMOND_CHESTPLATE, Items.NETHERITE_CHESTPLATE + }; Class<?>[] classes = {Offence1.class, Offence2.class, Offence3.class, Ninja1.class, Ninja2.class, Ninja3.class, Defence1.class, Defence2.class, Defence3.class}; for (int i = 0; i < positions.length; i++) { int position = positions[i]; @@ -61,18 +68,22 @@ public class MercenaryGui { if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/" + advancementName)) { if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence1") && (advancementName.startsWith("ninja") || advancementName.startsWith("defence"))) { GuiCommon.setDoneItem(gui, position, Items.BARRIER, nameKey, false); + GuiCommon.filler(gui, 50, false); } else if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja1") && (advancementName.startsWith("defence") || advancementName.startsWith("offence"))) { GuiCommon.setDoneItem(gui, position, Items.BARRIER, nameKey, false); + GuiCommon.filler(gui, 50, false); + GuiCommon.filler(gui, 48, false); } else if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence1") && (advancementName.startsWith("offence") || advancementName.startsWith("ninja"))) { GuiCommon.setDoneItem(gui, position, Items.BARRIER, nameKey, false); + GuiCommon.filler(gui, 48, false); } else { - GuiCommon.setSkillSlot(gui, player, position, Items.IRON_SWORD, nameKey, costs[i], classes[i], MercenaryGui.class); + GuiCommon.setSkillSlot(gui, player, position, items[i], nameKey, costs[i], classes[i], MercenaryGui.class); } if (position - 9 >= 0) { GuiCommon.filler(gui, position - 9, false); } } else { - GuiCommon.setDoneItem(gui, position, Items.IRON_SWORD, nameKey, true); + GuiCommon.setDoneItem(gui, position, items[i], nameKey, true); try { if (position - 9 >= 0) { GuiCommon.filler(gui, position - 9, true); diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java index e7fb2ef..6d8e538 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java @@ -35,16 +35,16 @@ public class ResetGui { .setName(Text.translatable("gui.ygasi.reset.confirm.title")) .addLoreLine(Text.translatable("gui.ygasi.reset.confirm.lore")) .setCallback((index, clickType, actionType) -> { - reset(player); - BranchGui.gui(player); if (player.experienceLevel >= ConfigRegistry.CONFIG.resetCost) { + reset(player); player.closeHandledScreen(); player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 1.0F, 1.0F); player.experienceLevel -= ConfigRegistry.CONFIG.resetCost; - + BranchGui.gui(player); } else { player.sendMessage(Text.translatable("gui.ygasi.reset.fail"), true); - player.closeHandledScreen(); + gui.close(); + BranchGui.gui(player); } }) ); diff --git a/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java b/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java index 6c486a5..c6946b4 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java @@ -44,7 +44,7 @@ public class GuiCommon { .hideFlag(ItemStack.TooltipSection.MODIFIERS) .setName(Text.translatable(nameKey)) .addLoreLine(Text.translatable(nameKey + ".lore")) - .addLoreLine(Text.translatable("gui.ygasi.branches.lore.cost", Text.of("§8"+ cost))) + .addLoreLine(Text.translatable("gui.ygasi.branch.cost", Text.of("§8" + cost))) .setCallback((index, clickType, actionType) -> { if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= cost) { try { diff --git a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java index 2b29a3c..f46de64 100644 --- a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java +++ b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java @@ -1,22 +1,15 @@ 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.*; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; -import net.fabricmc.loader.api.FabricLoader; import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.stat.Stats; import net.minecraft.text.Text; 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; diff --git a/src/main/resources/data/ygasi/lang/en_us.json b/src/main/resources/data/ygasi/lang/en_us.json index fc68778..5e9e48b 100644 --- a/src/main/resources/data/ygasi/lang/en_us.json +++ b/src/main/resources/data/ygasi/lang/en_us.json @@ -35,6 +35,24 @@ "gui.ygasi.branches.fail": "§cYou have not unlocked this branch yet!", "gui.ygasi.branches.no.skill": "§cYou don't have enough skill points to unlock this skill!", + "gui.ygasi.mercenary.offence1": "§cOffence I", + "gui.ygasi.mercenary.offence1.lore": "§8Lore", + "gui.ygasi.mercenary.offence2": "§cOffence II", + "gui.ygasi.mercenary.offence2.lore": "§8Lore", + "gui.ygasi.mercenary.offence3": "§cOffence III", + "gui.ygasi.mercenary.offence3.lore": "§8Lore", + "gui.ygasi.mercenary.ninja1": "§cNinja I", + "gui.ygasi.mercenary.ninja1.lore": "§8Lore", + "gui.ygasi.mercenary.ninja2": "§cNinja II", + "gui.ygasi.mercenary.ninja2.lore": "§8Lore", + "gui.ygasi.mercenary.ninja3": "§cNinja III", + "gui.ygasi.mercenary.ninja3.lore": "§8Lore", + "gui.ygasi.mercenary.defence1": "§cDefence I", + "gui.ygasi.mercenary.defence1.lore": "§8Lore", + "gui.ygasi.mercenary.defence2": "§cDefence II", + "gui.ygasi.mercenary.defence2.lore": "§8Lore", + "gui.ygasi.mercenary.defence3": "§cDefence III", + "gui.ygasi.mercenary.defence3.lore": "§8Lore", "config.ygasi.title": "§5§lYgasi Config", "config.ygasi.pointsRewarded.title": "Points rewarded per advancement", |