aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2021-07-23 10:19:13 +0100
committerLuck <git@lucko.me>2021-07-23 10:19:13 +0100
commit53373795aa808bd9af227e34d7493fc0f549eb25 (patch)
tree223a21eaf940c7e3d05aaac7b86158145aecd16e
parent8204f693071ed7411300231cba8225b7846cc500 (diff)
downloadspark-53373795aa808bd9af227e34d7493fc0f549eb25.tar.gz
spark-53373795aa808bd9af227e34d7493fc0f549eb25.tar.bz2
spark-53373795aa808bd9af227e34d7493fc0f549eb25.zip
Forge 1.17.1
-rw-r--r--spark-forge/build.gradle12
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java28
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java8
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java22
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java30
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java4
-rw-r--r--spark-forge/src/main/resources/META-INF/accesstransformer.cfg2
-rw-r--r--spark-forge1122/build.gradle2
8 files changed, 56 insertions, 52 deletions
diff --git a/spark-forge/build.gradle b/spark-forge/build.gradle
index 55de92d..98b70d4 100644
--- a/spark-forge/build.gradle
+++ b/spark-forge/build.gradle
@@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true // TODO: replace version with '5.+' once issues with latest are resolved
+ classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
@@ -14,8 +14,14 @@ plugins {
apply plugin: 'net.minecraftforge.gradle'
+compileJava {
+ // override, compile targeting J16
+ options.compilerArgs.removeAll(['--release', '8'])
+ options.compilerArgs.addAll(['--release', '16'])
+}
+
minecraft {
- mappings channel: 'official', version: '1.16.5'
+ mappings channel: 'official', version: '1.17.1'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}
@@ -25,7 +31,7 @@ configurations {
}
dependencies {
- minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'
+ minecraft 'net.minecraftforge:forge:1.17.1-37.0.1'
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 574ca3a..9ca6f03 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
@@ -25,31 +25,31 @@ import me.lucko.spark.forge.plugin.ForgeSparkPlugin;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
-import net.minecraft.command.ICommandSource;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.network.rcon.RConConsoleSource;
+import net.minecraft.Util;
+import net.minecraft.commands.CommandSource;
+import net.minecraft.network.chat.MutableComponent;
+import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.Util;
-import net.minecraft.util.text.IFormattableTextComponent;
-import net.minecraft.util.text.ITextComponent;
+import net.minecraft.server.rcon.RconConsoleSource;
+import net.minecraft.world.entity.player.Player;
import java.util.UUID;
-public class ForgeCommandSender extends AbstractCommandSender<ICommandSource> {
+public class ForgeCommandSender extends AbstractCommandSender<CommandSource> {
private final ForgeSparkPlugin plugin;
- public ForgeCommandSender(ICommandSource source, ForgeSparkPlugin plugin) {
+ public ForgeCommandSender(CommandSource source, ForgeSparkPlugin plugin) {
super(source);
this.plugin = plugin;
}
@Override
public String getName() {
- if (super.delegate instanceof PlayerEntity) {
- return ((PlayerEntity) super.delegate).getGameProfile().getName();
+ if (super.delegate instanceof Player) {
+ return ((Player) super.delegate).getGameProfile().getName();
} else if (super.delegate instanceof MinecraftServer) {
return "Console";
- } else if (super.delegate instanceof RConConsoleSource) {
+ } else if (super.delegate instanceof RconConsoleSource) {
return "RCON Console";
} else {
return "unknown:" + super.delegate.getClass().getSimpleName();
@@ -58,15 +58,15 @@ public class ForgeCommandSender extends AbstractCommandSender<ICommandSource> {
@Override
public UUID getUniqueId() {
- if (super.delegate instanceof PlayerEntity) {
- return ((PlayerEntity) super.delegate).getUUID();
+ if (super.delegate instanceof Player) {
+ return ((Player) super.delegate).getUUID();
}
return null;
}
@Override
public void sendMessage(Component message) {
- IFormattableTextComponent component = ITextComponent.Serializer.fromJson(GsonComponentSerializer.gson().serialize(message));
+ MutableComponent component = TextComponent.Serializer.fromJson(GsonComponentSerializer.gson().serialize(message));
super.delegate.sendMessage(component, Util.NIL_UUID);
}
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java
index 3d6b071..1f21391 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java
@@ -26,7 +26,7 @@ import me.lucko.spark.forge.plugin.ForgeServerSparkPlugin;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
-import net.minecraftforge.fml.ExtensionPoint;
+import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModContainer;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
@@ -34,9 +34,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLPaths;
-import net.minecraftforge.fml.network.FMLNetworkConstants;
-
-import org.apache.commons.lang3.tuple.Pair;
+import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
import java.nio.file.Path;
@@ -51,7 +49,7 @@ public class ForgeSparkMod {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientInit);
MinecraftForge.EVENT_BUS.register(this);
- ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
+ ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
}
public String getVersion() {
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 90d35ee..8beafc9 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
@@ -38,9 +38,9 @@ import me.lucko.spark.forge.ForgeTickHook;
import me.lucko.spark.forge.ForgeTickReporter;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.network.play.ClientPlayNetHandler;
-import net.minecraft.command.ICommandSource;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.commands.CommandSource;
+import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraftforge.client.event.ClientChatEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
@@ -53,10 +53,10 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
-public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements SuggestionProvider<ISuggestionProvider> {
+public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements SuggestionProvider<SharedSuggestionProvider> {
public static void register(ForgeSparkMod mod, FMLClientSetupEvent event) {
- ForgeClientSparkPlugin plugin = new ForgeClientSparkPlugin(mod, event.getMinecraftSupplier().get());
+ ForgeClientSparkPlugin plugin = new ForgeClientSparkPlugin(mod, Minecraft.getInstance());
plugin.enable();
// register listeners
@@ -67,22 +67,22 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Suggesti
}
private final Minecraft minecraft;
- private CommandDispatcher<ISuggestionProvider> dispatcher;
+ private CommandDispatcher<SharedSuggestionProvider> dispatcher;
public ForgeClientSparkPlugin(ForgeSparkMod mod, Minecraft minecraft) {
super(mod);
this.minecraft = minecraft;
}
- private CommandDispatcher<ISuggestionProvider> getPlayerCommandDispatcher() {
+ private CommandDispatcher<SharedSuggestionProvider> getPlayerCommandDispatcher() {
return Optional.ofNullable(this.minecraft.player)
.map(player -> player.connection)
- .map(ClientPlayNetHandler::getCommands)
+ .map(ClientPacketListener::getCommands)
.orElse(null);
}
private void checkCommandRegistered() {
- CommandDispatcher<ISuggestionProvider> dispatcher = getPlayerCommandDispatcher();
+ CommandDispatcher<SharedSuggestionProvider> dispatcher = getPlayerCommandDispatcher();
if (dispatcher == null) {
return;
}
@@ -111,7 +111,7 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Suggesti
}
@Override
- public CompletableFuture<Suggestions> getSuggestions(CommandContext<ISuggestionProvider> context, SuggestionsBuilder builder) throws CommandSyntaxException {
+ public CompletableFuture<Suggestions> getSuggestions(CommandContext<SharedSuggestionProvider> context, SuggestionsBuilder builder) throws CommandSyntaxException {
String[] args = processArgs(context.getInput(), true);
if (args == null) {
return Suggestions.empty();
@@ -135,7 +135,7 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Suggesti
}
@Override
- public boolean hasPermission(ICommandSource sender, String permission) {
+ public boolean hasPermission(CommandSource sender, String permission) {
return 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 3a077d6..ca29505 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
@@ -37,17 +37,17 @@ import me.lucko.spark.forge.ForgeSparkMod;
import me.lucko.spark.forge.ForgeTickHook;
import me.lucko.spark.forge.ForgeTickReporter;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.ICommandSource;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraft.commands.CommandSource;
+import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.entity.player.Player;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
-import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
-import net.minecraftforge.fml.server.ServerLifecycleHooks;
+import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks;
+import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent;
import net.minecraftforge.server.permission.DefaultPermissionLevel;
import net.minecraftforge.server.permission.PermissionAPI;
@@ -56,7 +56,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
import java.util.stream.Stream;
-public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<CommandSource>, SuggestionProvider<CommandSource> {
+public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<CommandSourceStack>, SuggestionProvider<CommandSourceStack> {
public static void register(ForgeSparkMod mod, RegisterCommandsEvent event) {
ForgeServerSparkPlugin plugin = new ForgeServerSparkPlugin(mod, ServerLifecycleHooks::getCurrentServer);
@@ -66,7 +66,7 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
MinecraftForge.EVENT_BUS.register(plugin);
// register commands & permissions
- CommandDispatcher<CommandSource> dispatcher = event.getDispatcher();
+ CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
registerCommands(dispatcher, plugin, plugin, "spark");
PermissionAPI.registerNode("spark", DefaultPermissionLevel.OP, "Access to the spark command");
}
@@ -84,7 +84,7 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
}
@Override
- public int run(CommandContext<CommandSource> context) throws CommandSyntaxException {
+ public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
String[] args = processArgs(context, false);
if (args == null) {
return 0;
@@ -96,13 +96,13 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
}
@Override
- public CompletableFuture<Suggestions> getSuggestions(CommandContext<CommandSource> context, SuggestionsBuilder builder) throws CommandSyntaxException {
+ public CompletableFuture<Suggestions> getSuggestions(CommandContext<CommandSourceStack> context, SuggestionsBuilder builder) throws CommandSyntaxException {
String[] args = processArgs(context, true);
if (args == null) {
return Suggestions.empty();
}
- ServerPlayerEntity player = context.getSource().getPlayerOrException();
+ ServerPlayer player = context.getSource().getPlayerOrException();
return CompletableFuture.supplyAsync(() -> {
for (String suggestion : this.platform.tabCompleteCommand(new ForgeCommandSender(player, this), args)) {
builder.suggest(suggestion);
@@ -111,7 +111,7 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
});
}
- private static String [] processArgs(CommandContext<CommandSource> context, boolean tabComplete) {
+ private static String [] processArgs(CommandContext<CommandSourceStack> context, boolean tabComplete) {
String[] split = context.getInput().split(" ", tabComplete ? -1 : 0);
if (split.length == 0 || !split[0].equals("/spark") && !split[0].equals("spark")) {
return null;
@@ -121,9 +121,9 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
}
@Override
- public boolean hasPermission(ICommandSource sender, String permission) {
- if (sender instanceof PlayerEntity) {
- return PermissionAPI.hasPermission((PlayerEntity) sender, permission);
+ public boolean hasPermission(CommandSource sender, String permission) {
+ if (sender instanceof Player) {
+ return PermissionAPI.hasPermission((Player) sender, permission);
} else {
return true;
}
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java
index c44b587..9386cfc 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java
@@ -35,7 +35,7 @@ import me.lucko.spark.common.util.ClassSourceLookup;
import me.lucko.spark.forge.ForgeClassSourceLookup;
import me.lucko.spark.forge.ForgeSparkMod;
-import net.minecraft.command.ICommandSource;
+import net.minecraft.commands.CommandSource;
import java.nio.file.Path;
import java.util.concurrent.Executors;
@@ -87,7 +87,7 @@ public abstract class ForgeSparkPlugin implements SparkPlugin {
this.scheduler.shutdown();
}
- public abstract boolean hasPermission(ICommandSource sender, String permission);
+ public abstract boolean hasPermission(CommandSource sender, String permission);
@Override
public String getVersion() {
diff --git a/spark-forge/src/main/resources/META-INF/accesstransformer.cfg b/spark-forge/src/main/resources/META-INF/accesstransformer.cfg
index 5f9dd8a..a1d1dc8 100644
--- a/spark-forge/src/main/resources/META-INF/accesstransformer.cfg
+++ b/spark-forge/src/main/resources/META-INF/accesstransformer.cfg
@@ -1 +1 @@
-public net.minecraft.command.CommandSource field_197041_c # source \ No newline at end of file
+public net.minecraft.commands.CommandSourceStack f_81288_ # source \ No newline at end of file
diff --git a/spark-forge1122/build.gradle b/spark-forge1122/build.gradle
index 4e7c50c..5c40d04 100644
--- a/spark-forge1122/build.gradle
+++ b/spark-forge1122/build.gradle
@@ -3,7 +3,7 @@ buildscript {
maven { url = "https://files.minecraftforge.net/maven" }
}
dependencies {
- classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true
+ classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}