From a31b01aa03c2a268a9c5bd8c2a1cf777094c9653 Mon Sep 17 00:00:00 2001 From: "ansgar [Hajen]" Date: Wed, 21 Sep 2022 14:39:09 +0200 Subject: [PATCH] BUMP Minecraft version to 1.19.2 BUMP Fabric API to v2 --- build.gradle | 15 ++++++++------- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- .../eaa/commands/CheckLobbyCommand.java | 4 ++-- .../eaa/commands/CheckPlayerCommand.java | 6 +++--- .../saltymc/eaa/commands/EaaModCommand.java | 6 +++--- .../net/saltymc/eaa/commands/EchoCommand.java | 11 +++++------ .../saltymc/eaa/commands/ReloadCommand.java | 4 ++-- .../net/saltymc/eaa/commands/TagCommand.java | 8 ++++---- .../eaa/custom/ping/CustomPlayerListHud.java | 8 +++++--- .../saltymc/eaa/function/CheckFunction.java | 11 +++++------ .../saltymc/eaa/function/LobbyFunction.java | 18 ++++++++---------- .../net/saltymc/eaa/function/TagFunction.java | 2 +- 13 files changed, 52 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index a1eb4bc..4507922 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { - id 'fabric-loom' version '0.10-SNAPSHOT' + id 'fabric-loom' version '1.0-SNAPSHOT' } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name version = project.mod_version @@ -55,10 +55,11 @@ tasks.withType(JavaCompile).configureEach { // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. // We'll use that if it's available, but otherwise we'll use the older option. - def targetVersion = 8 - if (JavaVersion.current().isJava9Compatible()) { - it.options.release = targetVersion - } + //def targetVersion = 8 + //if (JavaVersion.current().isJava9Compatible()) { + // it.options.release = targetVersion + //} + it.options.release = 17 } java { diff --git a/gradle.properties b/gradle.properties index 9983820..17652f3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,17 +3,17 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/versions.html - minecraft_version=1.16.5 - yarn_mappings=1.16.5+build.10 - loader_version=0.12.11 + minecraft_version=1.19.2 + yarn_mappings=1.19.2+build.13 + loader_version=0.14.9 # Mod Properties - mod_version = 1.1.3 + mod_version = 1.1.4 maven_group = net.saltymc.eaa archives_base_name = EAA_MOD # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api (or https://fabricmc.net/versions.html) - fabric_version=0.42.0+1.16 + fabric_version=0.61.0+1.19.2 #SQL jdbc_mysql=8.0.27 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf..ffed3a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/saltymc/eaa/commands/CheckLobbyCommand.java b/src/main/java/net/saltymc/eaa/commands/CheckLobbyCommand.java index c507ae9..9ba63a3 100644 --- a/src/main/java/net/saltymc/eaa/commands/CheckLobbyCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/CheckLobbyCommand.java @@ -2,14 +2,14 @@ package net.saltymc.eaa.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.saltymc.eaa.function.LobbyFunction; import net.saltymc.eaa.util.database.DB_Tag; import java.text.SimpleDateFormat; import java.util.*; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; public class CheckLobbyCommand extends EaaModCommand{ diff --git a/src/main/java/net/saltymc/eaa/commands/CheckPlayerCommand.java b/src/main/java/net/saltymc/eaa/commands/CheckPlayerCommand.java index 8977d6f..8e133ef 100644 --- a/src/main/java/net/saltymc/eaa/commands/CheckPlayerCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/CheckPlayerCommand.java @@ -3,12 +3,12 @@ package net.saltymc.eaa.commands; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.command.argument.EntityArgumentType; import net.saltymc.eaa.function.CheckFunction; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; public class CheckPlayerCommand extends EaaModCommand{ diff --git a/src/main/java/net/saltymc/eaa/commands/EaaModCommand.java b/src/main/java/net/saltymc/eaa/commands/EaaModCommand.java index 473b9a0..f5ab281 100644 --- a/src/main/java/net/saltymc/eaa/commands/EaaModCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/EaaModCommand.java @@ -3,13 +3,13 @@ package net.saltymc.eaa.commands; import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; public abstract class EaaModCommand implements Command { public EaaModCommand() { - this(ClientCommandManager.DISPATCHER); + this(ClientCommandManager.getActiveDispatcher()); } public EaaModCommand(CommandDispatcher dispatcher) { diff --git a/src/main/java/net/saltymc/eaa/commands/EchoCommand.java b/src/main/java/net/saltymc/eaa/commands/EchoCommand.java index a3ede7a..0156d3f 100644 --- a/src/main/java/net/saltymc/eaa/commands/EchoCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/EchoCommand.java @@ -3,14 +3,13 @@ package net.saltymc.eaa.commands; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.client.toast.*; -import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; public class EchoCommand extends EaaModCommand{ @@ -22,9 +21,9 @@ public class EchoCommand extends EaaModCommand{ SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("ECHO"), Text.of(nachricht)); source.sendFeedback( - new LiteralText("You said: ") + Text.literal("You said: ") .formatted(Formatting.RED) - .append(new LiteralText(nachricht + "")) + .append(Text.literal(nachricht + "")) ); return 1; } diff --git a/src/main/java/net/saltymc/eaa/commands/ReloadCommand.java b/src/main/java/net/saltymc/eaa/commands/ReloadCommand.java index 59aac04..1d46a45 100644 --- a/src/main/java/net/saltymc/eaa/commands/ReloadCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/ReloadCommand.java @@ -2,12 +2,12 @@ package net.saltymc.eaa.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.text.Text; import net.saltymc.eaa.function.TagFunction; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; public class ReloadCommand extends EaaModCommand{ diff --git a/src/main/java/net/saltymc/eaa/commands/TagCommand.java b/src/main/java/net/saltymc/eaa/commands/TagCommand.java index fc3dfe2..5026bf3 100644 --- a/src/main/java/net/saltymc/eaa/commands/TagCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/TagCommand.java @@ -4,16 +4,16 @@ import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.command.argument.EntityArgumentType; import net.saltymc.eaa.function.TagFunction; import net.saltymc.eaa.util.database.DB_Tag; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; -public class TagCommand extends EaaModCommand{ +public class TagCommand extends EaaModCommand { @Override public int run(CommandContext context) { diff --git a/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java b/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java index 292ad3b..b599b2b 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java @@ -136,8 +136,9 @@ public final class CustomPlayerListHud { int aa = s + y * r + y * 5; int ab = t + ai * 9; DrawableHelper.fill(stack, aa, ab, aa + r, ab + 8, w); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.enableAlphaTest(); + //RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.clearColor(1.0F, 1.0F, 1.0F, 1.0F); + //RenderSystem.enableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); if (x < playerList.size()) { @@ -220,7 +221,8 @@ public final class CustomPlayerListHud { } else { // If we don't render ping bars, we need to reset the render system color so the rest // of the player list renders properly - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + // RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.clearColor(1.0F, 1.0F, 1.0F, 1.0F); } } } diff --git a/src/main/java/net/saltymc/eaa/function/CheckFunction.java b/src/main/java/net/saltymc/eaa/function/CheckFunction.java index f7a1d11..6cf6da3 100644 --- a/src/main/java/net/saltymc/eaa/function/CheckFunction.java +++ b/src/main/java/net/saltymc/eaa/function/CheckFunction.java @@ -1,9 +1,8 @@ package net.saltymc.eaa.function; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.client.MinecraftClient; import net.minecraft.client.toast.SystemToast; -import net.minecraft.text.LiteralText; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.text.TextColor; @@ -57,10 +56,10 @@ public class CheckFunction { while (it.hasPrevious()) { DB_Tag curr = it.previous(); - source.sendFeedback(new LiteralText(dateformat.format(curr.getTagDate())).formatted(Formatting.GRAY) - .append(new LiteralText(" | ")) - .append(new LiteralText(curr.getType().getTag()).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(curr.getType().getColor())))) - .append(new LiteralText(" (" + curr.getGrade() + ") ").formatted(getScaleFormat(curr.getGrade()))) + source.sendFeedback(Text.literal(dateformat.format(curr.getTagDate())).formatted(Formatting.GRAY) + .append(Text.literal(" | ")) + .append(Text.literal(curr.getType().getTag()).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(curr.getType().getColor())))) + .append(Text.literal(" (" + curr.getGrade() + ") ").formatted(getScaleFormat(curr.getGrade()))) ); } } else { diff --git a/src/main/java/net/saltymc/eaa/function/LobbyFunction.java b/src/main/java/net/saltymc/eaa/function/LobbyFunction.java index 9d026af..707f232 100644 --- a/src/main/java/net/saltymc/eaa/function/LobbyFunction.java +++ b/src/main/java/net/saltymc/eaa/function/LobbyFunction.java @@ -1,6 +1,6 @@ package net.saltymc.eaa.function; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.client.MinecraftClient; import net.minecraft.client.toast.SystemToast; import net.minecraft.text.Text; @@ -44,15 +44,13 @@ public class LobbyFunction { } } - switch (dangerLvl){ - case 0: - SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_BACKUP, Text.of("OKAY!"), Text.of("No Hackers found")); - break; - case 1: - SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("MEH!"), Text.of("There is an Idiot or Noob!")); - break; - case 2: - SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_ACCESS_FAILURE, Text.of("ALARM!"), Text.of("There is a Hacker!")); + switch (dangerLvl) { + case 0 -> + SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_BACKUP, Text.of("OKAY!"), Text.of("No Hackers found")); + case 1 -> + SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("MEH!"), Text.of("There is an Idiot or Noob!")); + case 2 -> + SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_ACCESS_FAILURE, Text.of("ALARM!"), Text.of("There is a Hacker!")); } } catch (Exception e) { diff --git a/src/main/java/net/saltymc/eaa/function/TagFunction.java b/src/main/java/net/saltymc/eaa/function/TagFunction.java index 9e09a2d..874e847 100644 --- a/src/main/java/net/saltymc/eaa/function/TagFunction.java +++ b/src/main/java/net/saltymc/eaa/function/TagFunction.java @@ -1,6 +1,6 @@ package net.saltymc.eaa.function; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.client.toast.SystemToast; import net.minecraft.text.Text; import net.saltymc.eaa.custom.ping.TagDTO;