Mojang Mappings
This commit is contained in:
@@ -6,24 +6,24 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import io.github.skippyall.minions.minion.MinionData;
|
||||
import io.github.skippyall.minions.minion.fakeplayer.MinionFakePlayer;
|
||||
import net.minecraft.command.argument.PosArgument;
|
||||
import net.minecraft.command.argument.Vec3ArgumentType;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.arguments.coordinates.Coordinates;
|
||||
import net.minecraft.commands.arguments.coordinates.Vec3Argument;
|
||||
|
||||
import static net.minecraft.server.command.CommandManager.argument;
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
import static net.minecraft.commands.Commands.argument;
|
||||
import static net.minecraft.commands.Commands.literal;
|
||||
|
||||
public class SpawnSubcommand {
|
||||
public static final LiteralArgumentBuilder<ServerCommandSource> SPAWN = literal("spawn")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
public static final LiteralArgumentBuilder<CommandSourceStack> SPAWN = literal("spawn")
|
||||
.requires(source -> source.hasPermission(2))
|
||||
.then(argument("minion", StringArgumentType.word())
|
||||
.suggests(MinionArgument.SUGGESTION_PROVIDER)
|
||||
.then(argument("pos", Vec3ArgumentType.vec3())
|
||||
.then(argument("pos", Vec3Argument.vec3())
|
||||
.executes(context ->
|
||||
spawnCommand(
|
||||
context.getSource(),
|
||||
StringArgumentType.getString(context, "minion"),
|
||||
Vec3ArgumentType.getPosArgument(context, "pos"),
|
||||
Vec3Argument.getCoordinates(context, "pos"),
|
||||
false
|
||||
)
|
||||
)
|
||||
@@ -32,7 +32,7 @@ public class SpawnSubcommand {
|
||||
spawnCommand(
|
||||
context.getSource(),
|
||||
StringArgumentType.getString(context, "minion"),
|
||||
Vec3ArgumentType.getPosArgument(context, "pos"),
|
||||
Vec3Argument.getCoordinates(context, "pos"),
|
||||
BoolArgumentType.getBool(context, "force")
|
||||
)
|
||||
)
|
||||
@@ -47,9 +47,9 @@ public class SpawnSubcommand {
|
||||
))
|
||||
);
|
||||
|
||||
public static int spawnCommand(ServerCommandSource source, String minion, PosArgument pos, boolean force) throws CommandSyntaxException {
|
||||
public static int spawnCommand(CommandSourceStack source, String minion, Coordinates pos, boolean force) throws CommandSyntaxException {
|
||||
MinionData data = MinionArgument.parse(source.getServer(), minion);
|
||||
MinionFakePlayer.spawnMinion(data, source.getWorld(), pos != null ? pos.getPos(source) : null, pos != null ? pos.getRotation(source) : null, force);
|
||||
MinionFakePlayer.spawnMinion(data, source.getLevel(), pos != null ? pos.getPosition(source) : null, pos != null ? pos.getRotation(source) : null, force);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user