]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/client/commands/SpawningSphereCommand.java
Setup for 1.14.4-Fabric
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / commands / SpawningSphereCommand.java
index 8ab9f1b1e0700301916ec2a06dd47c95bc8e6dc6..88725956a1c005b0eed15ffac749522804837299 100644 (file)
@@ -6,10 +6,10 @@ import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.CommandSource;
+import net.minecraft.server.command.ServerCommandSource;
 import net.minecraft.world.LightType;
 import net.minecraft.world.World;
 
@@ -17,13 +17,13 @@ public class SpawningSphereCommand {
     private static final String COMMAND = "bbor:spawningSphere";
     private static final String CALCULATE_SPAWNABLE = "calculateSpawnable";
 
-    public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
-        LiteralArgumentBuilder command = Commands.literal(COMMAND)
-                .then(Commands.literal(ArgumentNames.SET)
-                        .then(Commands.argument(ArgumentNames.POS, Arguments.point())
+    public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
+        LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
+                .then(CommandManager.literal(ArgumentNames.SET)
+                        .then(CommandManager.argument(ArgumentNames.POS, Arguments.point())
                                 .executes(SpawningSphereCommand::setSphere))
                         .executes(SpawningSphereCommand::setSphere))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             boolean cleared = SpawningSphereProvider.clearSphere();
 
@@ -31,7 +31,7 @@ public class SpawningSphereCommand {
                             CommandHelper.feedback(context, format);
                             return 0;
                         }))
-                .then(Commands.literal(CALCULATE_SPAWNABLE)
+                .then(CommandManager.literal(CALCULATE_SPAWNABLE)
                         .executes(context -> {
                             if (!SpawningSphereProvider.hasSpawningSphereInDimension(Player.getDimensionId())) {
                                 CommandHelper.feedback(context, "bbor.commands.spawningSphere.notSet");
@@ -39,10 +39,10 @@ public class SpawningSphereCommand {
                             }
 
                             Counts counts = new Counts();
-                            World world = Minecraft.getInstance().world;
+                            World world = MinecraftClient.getInstance().world;
                             SpawningSphereProvider.calculateSpawnableSpacesCount(pos -> {
                                 counts.spawnable++;
-                                if (world.getLightFor(LightType.SKY, pos) > 7)
+                                if (world.getLightLevel(LightType.SKY, pos) > 7)
                                     counts.nightSpawnable++;
                             });
                             SpawningSphereProvider.setSpawnableSpacesCount(counts.spawnable);
@@ -55,7 +55,7 @@ public class SpawningSphereCommand {
         commandDispatcher.register(command);
     }
 
-    public static int setSphere(CommandContext<CommandSource> context) throws CommandSyntaxException {
+    public static int setSphere(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
         SpawningSphereProvider.setSphere(Arguments.getPoint(context, ArgumentNames.POS).snapXZ(0.5d));
 
         CommandHelper.feedback(context, "bbor.commands.spawningSphere.set");