Migrations

This commit is contained in:
Sebastian Hartte
2020-06-27 16:18:20 +02:00
parent d638d083c2
commit ba71a82288
303 changed files with 1216 additions and 1210 deletions
+6 -6
View File
@@ -18,12 +18,12 @@
package appeng.server;
import static net.minecraft.command.Commands.literal;
import static net.minecraft.server.command.CommandManager.literal;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import appeng.api.features.AEFeature;
@@ -31,9 +31,9 @@ import appeng.core.AEConfig;
public final class AECommand {
public void register(CommandDispatcher<CommandSource> dispatcher) {
public void register(CommandDispatcher<ServerCommandSource> dispatcher) {
LiteralArgumentBuilder<CommandSource> builder = literal("ae2");
LiteralArgumentBuilder<ServerCommandSource> builder = literal("ae2");
for (Commands command : Commands.values()) {
if (command.test && !AEConfig.instance().isFeatureEnabled(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS)) {
continue;
@@ -44,9 +44,9 @@ public final class AECommand {
dispatcher.register(builder);
}
private void add(LiteralArgumentBuilder<net.minecraft.command.CommandSource> builder, Commands subCommand) {
private void add(LiteralArgumentBuilder<net.minecraft.server.command.ServerCommandSource> builder, Commands subCommand) {
LiteralArgumentBuilder<CommandSource> subCommandBuilder = literal(subCommand.name().toLowerCase())
LiteralArgumentBuilder<ServerCommandSource> subCommandBuilder = literal(subCommand.name().toLowerCase())
.requires(src -> src.hasPermissionLevel(subCommand.level));
subCommand.command.addArguments(subCommandBuilder);
subCommandBuilder.executes(ctx -> {
+3 -3
View File
@@ -21,13 +21,13 @@ package appeng.server;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.MinecraftServer;
public interface ISubCommand {
default void addArguments(LiteralArgumentBuilder<CommandSource> builder) {
default void addArguments(LiteralArgumentBuilder<ServerCommandSource> builder) {
}
void call(MinecraftServer srv, CommandContext<CommandSource> ctx, CommandSource sender);
void call(MinecraftServer srv, CommandContext<ServerCommandSource> ctx, ServerCommandSource sender);
}
@@ -27,7 +27,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.RayTraceResult;
@@ -136,7 +136,7 @@ public class ServerHelper extends CommonHelper {
final ItemStack is = player.inventory.getStackInSlot(x);
if (!is.isEmpty() && is.getItem() instanceof NetworkToolItem) {
final CompoundNBT c = is.getTag();
final CompoundTag c = is.getTag();
if (c != null && c.getBoolean("hideFacades")) {
return CableRenderMode.CABLE_VIEW;
}
@@ -20,7 +20,7 @@ package appeng.server.subcommands;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.common.MinecraftForge;
@@ -67,7 +67,7 @@ public class ChunkLogger implements ISubCommand {
}
@Override
public void call(final MinecraftServer srv, final CommandContext<CommandSource> data, final CommandSource sender) {
public void call(final MinecraftServer srv, final CommandContext<ServerCommandSource> data, final ServerCommandSource sender) {
this.enabled = !this.enabled;
if (this.enabled) {
@@ -21,7 +21,7 @@ package appeng.server.subcommands;
import com.google.common.base.Joiner;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.StringTextComponent;
@@ -30,7 +30,7 @@ import appeng.server.ISubCommand;
public class Supporters implements ISubCommand {
@Override
public void call(final MinecraftServer srv, final CommandContext<CommandSource> data, final CommandSource sender) {
public void call(final MinecraftServer srv, final CommandContext<ServerCommandSource> data, final ServerCommandSource sender) {
final String[] who = { "Stig Halvorsen", "Josh Ricker", "Jenny \"Othlon\" Sutherland", "Hristo Bogdanov",
"BevoLJ" };
sender.sendFeedback(new StringTextComponent("Special thanks to " + Joiner.on(", ").join(who)), true);
@@ -18,7 +18,7 @@
package appeng.server.subcommands;
import static net.minecraft.command.Commands.literal;
import static net.minecraft.server.command.CommandManager.literal;
import java.util.ArrayList;
import java.util.Comparator;
@@ -30,7 +30,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
@@ -60,7 +60,7 @@ import appeng.worldgen.meteorite.PlacedMeteoriteSettings;
public class TestMeteoritesCommand implements ISubCommand {
@Override
public void addArguments(LiteralArgumentBuilder<CommandSource> builder) {
public void addArguments(LiteralArgumentBuilder<ServerCommandSource> builder) {
builder.then(literal("force").executes(ctx -> {
test(ServerLifecycleHooks.getCurrentServer(), ctx.getSource(), true);
return 1;
@@ -68,11 +68,11 @@ public class TestMeteoritesCommand implements ISubCommand {
}
@Override
public void call(final MinecraftServer srv, final CommandContext<CommandSource> ctx, final CommandSource sender) {
public void call(final MinecraftServer srv, final CommandContext<ServerCommandSource> ctx, final ServerCommandSource sender) {
test(srv, sender, false);
}
private static void test(MinecraftServer srv, final CommandSource sender, boolean force) {
private static void test(MinecraftServer srv, final ServerCommandSource sender, boolean force) {
int radius = 100;
ServerPlayerEntity player = null;
@@ -205,7 +205,7 @@ public class TestMeteoritesCommand implements ISubCommand {
return null;
}
private static void sendLine(CommandSource sender, String text, Object... args) {
private static void sendLine(ServerCommandSource sender, String text, Object... args) {
sender.sendFeedback(new StringTextComponent(String.format(Locale.ROOT, text, args)), true);
}
@@ -29,7 +29,7 @@ import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.block.BlockState;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
@@ -57,7 +57,7 @@ public class TestOreGenCommand implements ISubCommand {
}
@Override
public void call(final MinecraftServer srv, final CommandContext<CommandSource> data, final CommandSource sender) {
public void call(final MinecraftServer srv, final CommandContext<ServerCommandSource> data, final ServerCommandSource sender) {
int radius = 1000;
@@ -97,7 +97,7 @@ public class TestOreGenCommand implements ISubCommand {
sendLine(sender, " Sub-Type Count: %s", chargedCount);
}
private void checkChunk(CommandSource sender, ServerWorld world, ChunkPos cp, Stats stats) {
private void checkChunk(ServerCommandSource sender, ServerWorld world, ChunkPos cp, Stats stats) {
IChunk chunk = world.getChunk(cp.x, cp.z, ChunkStatus.FULL, false);
if (chunk == null) {
sendLine(sender, "Skipping chunk %s", cp);
@@ -129,7 +129,7 @@ public class TestOreGenCommand implements ISubCommand {
stats.chunks.add(chunkStats);
}
private static void sendLine(CommandSource sender, String text, Object... args) {
private static void sendLine(ServerCommandSource sender, String text, Object... args) {
sender.sendFeedback(new StringTextComponent(String.format(Locale.ROOT, text, args)), true);
}