package com.irtimaled.bbor.client.commands;
+import com.irtimaled.bbor.client.PlayerCoords;
import com.irtimaled.bbor.client.providers.SpawningSphereProvider;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.command.Commands;
import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.command.arguments.Vec3Argument;
+import net.minecraft.util.math.Vec3d;
public class SpawningSphereCommand {
private static final String COMMAND = "bbor:spawningSphere";
private static final String SET = "set";
+ private static final String POS = "pos";
private static final String CLEAR = "clear";
private static final String CALCULATE_SPAWNABLE = "calculateSpawnable";
public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
LiteralArgumentBuilder command = Commands.literal(COMMAND)
.then(Commands.literal(SET)
+ .then(Commands.argument(POS, Vec3Argument.vec3())
+ .executes(context -> {
+ Vec3d pos = Vec3Argument.getVec3(context, POS);
+ SpawningSphereProvider.setSphere(pos.x, pos.y, pos.z);
+
+ CommandHelper.feedback(context, "Spawning sphere set");
+ return 0;
+ }))
.executes(context -> {
- SpawningSphereProvider.setSphere();
+ SpawningSphereProvider.setSphere(PlayerCoords.getX(), PlayerCoords.getY(), PlayerCoords.getZ());
CommandHelper.feedback(context, "Spawning sphere set");
return 0;
private static BoundingBoxSpawningSphere spawningSphere;
private static Integer dimensionId;
- public static void setSphere() {
- Coords coords = PlayerCoords.get();
- double xOffset = snapToNearestHalf(PlayerCoords.getX() -coords.getX());
- double yOffset = PlayerCoords.getY()- coords.getY();
- double zOffset = snapToNearestHalf(PlayerCoords.getZ()-coords.getZ());
+ public static void setSphere(double x, double y, double z) {
+ Coords coords = new Coords(x, y, z);
+ double xOffset = snapToNearestHalf(x -coords.getX());
+ double yOffset = y- coords.getY();
+ double zOffset = snapToNearestHalf(z-coords.getZ());
if(spawningSphere != null && spawningSphere.isCenter(coords, xOffset, yOffset, zOffset)) {
return;