diff options
author | Maximusbarcz <maxim.baranek@gmail.com> | 2023-01-11 19:50:29 +0100 |
---|---|---|
committer | Maximusbarcz <maxim.baranek@gmail.com> | 2023-01-11 19:50:29 +0100 |
commit | 5bcb1830298caad87a63f44c4e7f1553074cf4c8 (patch) | |
tree | c0c193496f96a201ecd8b3ce44c24fd0ac0d6214 /src/main/java/dev/mayaqq/ygasi/gui | |
parent | 5e48daa137cda5043ebce80b7e3e975da2d7c069 (diff) | |
download | ygasi-5bcb1830298caad87a63f44c4e7f1553074cf4c8.tar.gz ygasi-5bcb1830298caad87a63f44c4e7f1553074cf4c8.tar.bz2 ygasi-5bcb1830298caad87a63f44c4e7f1553074cf4c8.zip |
Made everything work on 1.19.3, wasnt that bad after all!
Diffstat (limited to 'src/main/java/dev/mayaqq/ygasi/gui')
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java | 6 | ||||
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java | 22 |
2 files changed, 13 insertions, 15 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java b/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java index d293f47..eca0226 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java @@ -146,9 +146,9 @@ public class BranchGui { } //this happens when you try to unlock a branch public static void save(ServerPlayerEntity player, String branch, String branchName) { - Boolean hasMercenary = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary"); - Boolean hasWizadry = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry"); - Boolean hasDrudiry = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/druidry"); + boolean hasMercenary = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary"); + boolean hasWizadry = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry"); + boolean hasDrudiry = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/druidry"); //special category for extra branch because it's half the price if (branch.equals("extra")) { if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= ConfigRegistry.CONFIG.branchCost / 2) { diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java index c9f0383..74c1c5e 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java @@ -8,9 +8,11 @@ import net.minecraft.item.Items; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; +import net.minecraft.sound.SoundEvent; import net.minecraft.text.Text; +import static dev.mayaqq.ygasi.Ygasi.click; + public class ConfigGui { public static void gui(ServerPlayerEntity player) { @@ -30,7 +32,6 @@ public class ConfigGui { .addLoreLine(Text.translatable("config.ygasi.current").append(Text.of(String.valueOf(ConfigRegistry.CONFIG.pointsRewarded)))) .setCallback((index, clickType, actionType) -> { textInput(player, "pointsRewarded"); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1.0F, 1.0F); }) ); @@ -40,7 +41,6 @@ public class ConfigGui { .addLoreLine(Text.translatable("config.ygasi.current").append(Text.of(String.valueOf(ConfigRegistry.CONFIG.branchCost)))) .setCallback((index, clickType, actionType) -> { textInput(player, "branchCost"); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1.0F, 1.0F); }) ); @@ -50,9 +50,9 @@ public class ConfigGui { .addLoreLine(Text.translatable("config.ygasi.current").append(Text.of(String.valueOf(ConfigRegistry.CONFIG.enableSkillBook)))) .setCallback((index, clickType, actionType) -> { ConfigRegistry.CONFIG.enableSkillBook = !ConfigRegistry.CONFIG.enableSkillBook; + player.playSound(SoundEvent.of(click), SoundCategory.PLAYERS, 1.0F, 1.0F); gui.close(); gui(player); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1.0F, 1.0F); }) ); @@ -62,7 +62,6 @@ public class ConfigGui { .addLoreLine(Text.translatable("config.ygasi.current").append(Text.of(String.valueOf(ConfigRegistry.CONFIG.T1Cost)))) .setCallback((index, clickType, actionType) -> { textInput(player, "T1Cost"); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1.0F, 1.0F); }) ); @@ -73,7 +72,6 @@ public class ConfigGui { .addLoreLine(Text.translatable("config.ygasi.current").append(Text.of(String.valueOf(ConfigRegistry.CONFIG.T2Cost)))) .setCallback((index, clickType, actionType) -> { textInput(player, "T2Cost"); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1.0F, 1.0F); }) ); @@ -84,7 +82,6 @@ public class ConfigGui { .addLoreLine(Text.translatable("config.ygasi.current").append(Text.of(String.valueOf(ConfigRegistry.CONFIG.T3Cost)))) .setCallback((index, clickType, actionType) -> { textInput(player, "T3Cost"); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1.0F, 1.0F); }) ); @@ -92,6 +89,7 @@ public class ConfigGui { } private static void textInput(ServerPlayerEntity player, String option) { + player.playSound(SoundEvent.of(click), SoundCategory.PLAYERS, 1.0F, 1.0F); try { SignGui gui = new SignGui(player) { @Override @@ -101,35 +99,35 @@ public class ConfigGui { try { ConfigRegistry.CONFIG.pointsRewarded = Integer.parseInt(this.getLine(0).getString()); } catch (NumberFormatException e) { - player.sendMessage(Text.translatable("config.ygasi.invalid.number"), false); + player.sendMessage(Text.translatable("config.ygasi.invalid.number"), true); } } case "branchCost" -> { try { ConfigRegistry.CONFIG.branchCost = Integer.parseInt(this.getLine(0).getString()); } catch (NumberFormatException e) { - player.sendMessage(Text.translatable("config.ygasi.invalid.number"), false); + player.sendMessage(Text.translatable("config.ygasi.invalid.number"), true); } } case "T1Cost" -> { try { ConfigRegistry.CONFIG.T1Cost = Integer.parseInt(this.getLine(0).getString()); } catch (NumberFormatException e) { - player.sendMessage(Text.translatable("config.ygasi.invalid.number"), false); + player.sendMessage(Text.translatable("config.ygasi.invalid.number"), true); } } case "T2Cost" -> { try { ConfigRegistry.CONFIG.T2Cost = Integer.parseInt(this.getLine(0).getString()); } catch (NumberFormatException e) { - player.sendMessage(Text.translatable("config.ygasi.invalid.number"), false); + player.sendMessage(Text.translatable("config.ygasi.invalid.number"), true); } } case "T3Cost" -> { try { ConfigRegistry.CONFIG.T3Cost = Integer.parseInt(this.getLine(0).getString()); } catch (NumberFormatException e) { - player.sendMessage(Text.translatable("config.ygasi.invalid.number"), false); + player.sendMessage(Text.translatable("config.ygasi.invalid.number"), true); } } } |