Update
This commit is contained in:
@@ -6,7 +6,7 @@ import io.github.skippyall.minions.mixinhelper.ChunkLevelManager$DistanceFromNea
|
||||
import io.github.skippyall.minions.mixinhelper.ChunkLevelManagerAccessor;
|
||||
import io.github.skippyall.minions.mixins.antimobcap.ServerChunkManagerAccessor;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.world.ChunkTicketManager;
|
||||
import net.minecraft.server.world.ChunkLevelManager;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
@@ -16,8 +16,8 @@ public class MobCapDebugSubcommand {
|
||||
.executes(MobCapDebugSubcommand::mobcapdebugCommand);
|
||||
|
||||
public static int mobcapdebugCommand(CommandContext<ServerCommandSource> context) {
|
||||
ChunkTicketManager ticketManager = ((ServerChunkManagerAccessor)context.getSource().getWorld().getChunkManager()).getTicketManager();
|
||||
int tickedChunkCount = ((ChunkLevelManager$DistanceFromNearestPlayerTrackerAccessor)((ChunkLevelManagerAccessor)ticketManager).minions$getMinionless()).minions$getTickedChunkCount();
|
||||
ChunkLevelManager levelManager = ((ServerChunkManagerAccessor)context.getSource().getWorld().getChunkManager()).getLevelManager();
|
||||
int tickedChunkCount = ((ChunkLevelManager$DistanceFromNearestPlayerTrackerAccessor)((ChunkLevelManagerAccessor)levelManager).minions$getMinionless()).minions$getTickedChunkCount();
|
||||
context.getSource().sendFeedback(() -> Text.of(String.valueOf(tickedChunkCount)), false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,33 +15,41 @@ import static net.minecraft.server.command.CommandManager.literal;
|
||||
|
||||
public class SpawnSubcommand {
|
||||
public static final LiteralArgumentBuilder<ServerCommandSource> SPAWN = literal("spawn")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
.then(argument("minion", StringArgumentType.word())
|
||||
.suggests(MinionArgument.SUGGESTION_PROVIDER)
|
||||
.then(argument("pos", Vec3ArgumentType.vec3()))
|
||||
.executes(context ->
|
||||
spawnCommand(
|
||||
context.getSource(),
|
||||
StringArgumentType.getString(context, "minion"),
|
||||
Vec3ArgumentType.getPosArgument(context, "pos"),
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
.then(argument("force", BoolArgumentType.bool())
|
||||
.then(argument("pos", Vec3ArgumentType.vec3())
|
||||
.executes(context ->
|
||||
spawnCommand(
|
||||
context.getSource(),
|
||||
StringArgumentType.getString(context, "minion"),
|
||||
Vec3ArgumentType.getPosArgument(context, "pos"),
|
||||
BoolArgumentType.getBool(context, "force")
|
||||
false
|
||||
)
|
||||
)
|
||||
.then(argument("force", BoolArgumentType.bool())
|
||||
.executes(context ->
|
||||
spawnCommand(
|
||||
context.getSource(),
|
||||
StringArgumentType.getString(context, "minion"),
|
||||
Vec3ArgumentType.getPosArgument(context, "pos"),
|
||||
BoolArgumentType.getBool(context, "force")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.executes(context ->
|
||||
spawnCommand(
|
||||
context.getSource(),
|
||||
StringArgumentType.getString(context, "minion"),
|
||||
null,
|
||||
false
|
||||
))
|
||||
);
|
||||
|
||||
public static int spawnCommand(ServerCommandSource source, String minion, PosArgument pos, boolean force) throws CommandSyntaxException {
|
||||
MinionData data = MinionArgument.parse(minion);
|
||||
MinionFakePlayer.spawnMinion(data, source.getWorld(), pos.getPos(source), pos.getRotation(source), force);
|
||||
MinionFakePlayer.spawnMinion(data, source.getWorld(), pos != null ? pos.getPos(source) : null, pos != null ? pos.getRotation(source) : null, force);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user