From 7a3e2809f4f8f9f130ca6eb3efe986b0f4f418f7 Mon Sep 17 00:00:00 2001 From: Luck Date: Sun, 16 May 2021 12:36:07 +0100 Subject: Update to ForgeGradle 4 --- spark-forge/build.gradle | 7 ++++--- .../src/main/java/me/lucko/spark/forge/ForgeCommandSender.java | 6 +++--- .../src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java | 2 +- .../java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java | 4 ++-- .../java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) (limited to 'spark-forge') diff --git a/spark-forge/build.gradle b/spark-forge/build.gradle index 06e674b..29782d8 100644 --- a/spark-forge/build.gradle +++ b/spark-forge/build.gradle @@ -1,9 +1,10 @@ buildscript { repositories { maven { url = "http://files.minecraftforge.net/maven" } + mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true } } @@ -14,7 +15,7 @@ plugins { apply plugin: 'net.minecraftforge.gradle' minecraft { - mappings channel: 'snapshot', version: '20200916-1.16.2' + mappings channel: 'official', version: '1.16.5' accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') } @@ -24,7 +25,7 @@ configurations { } dependencies { - minecraft 'net.minecraftforge:forge:1.16.4-35.0.3' + minecraft 'net.minecraftforge:forge:1.16.5-36.1.0' shade project(':spark-common') } diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java index 9470e65..574ca3a 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java @@ -59,15 +59,15 @@ public class ForgeCommandSender extends AbstractCommandSender { @Override public UUID getUniqueId() { if (super.delegate instanceof PlayerEntity) { - return ((PlayerEntity) super.delegate).getUniqueID(); + return ((PlayerEntity) super.delegate).getUUID(); } return null; } @Override public void sendMessage(Component message) { - IFormattableTextComponent component = ITextComponent.Serializer.getComponentFromJson(GsonComponentSerializer.gson().serialize(message)); - super.delegate.sendMessage(component, Util.DUMMY_UUID); + IFormattableTextComponent component = ITextComponent.Serializer.fromJson(GsonComponentSerializer.gson().serialize(message)); + super.delegate.sendMessage(component, Util.NIL_UUID); } @Override diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java index fbe99ce..60294be 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java @@ -34,7 +34,7 @@ public class ForgePlatformInfo extends AbstractPlatformInfo { @Override public Type getType() { - return type; + return this.type; } @Override diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java index a97a0bf..90d35ee 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java @@ -77,7 +77,7 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Suggesti private CommandDispatcher getPlayerCommandDispatcher() { return Optional.ofNullable(this.minecraft.player) .map(player -> player.connection) - .map(ClientPlayNetHandler::getCommandDispatcher) + .map(ClientPlayNetHandler::getCommands) .orElse(null); } @@ -106,7 +106,7 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Suggesti this.threadDumper.ensureSetup(); this.platform.executeCommand(new ForgeCommandSender(this.minecraft.player, this), args); - this.minecraft.ingameGUI.getChatGUI().addToSentMessages(event.getMessage()); + this.minecraft.gui.getChat().addRecentChat(event.getMessage()); event.setCanceled(true); } diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java index f6ea346..3a077d6 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java @@ -102,7 +102,7 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command< return Suggestions.empty(); } - ServerPlayerEntity player = context.getSource().asPlayer(); + ServerPlayerEntity player = context.getSource().getPlayerOrException(); return CompletableFuture.supplyAsync(() -> { for (String suggestion : this.platform.tabCompleteCommand(new ForgeCommandSender(player, this), args)) { builder.suggest(suggestion); -- cgit