Merge branch '1.17'

This commit is contained in:
gnembon committed 2021-07-14 00:26:22 -03:00
commit af368a159d
173 files changed
+2214 -1462

No files matched your search

@@ -56,7 +56,7 @@ public class CounterCommand
HopperCounter counter = HopperCounter.getCounter(color);
if (counter == null) throw new CommandException(Messenger.s("Unknown wool color: "+color));
for (BaseText message: counter.format(source.getMinecraftServer(), realtime, false))
for (BaseText message: counter.format(source.getServer(), realtime, false))
{
source.sendFeedback(message, false);
}
@@ -72,14 +72,14 @@ public class CounterCommand
{
if (color == null)
{
HopperCounter.resetAll(source.getMinecraftServer(), false);
HopperCounter.resetAll(source.getServer(), false);
Messenger.m(source, "w Restarted all counters");
}
else
{
HopperCounter counter = HopperCounter.getCounter(color);
if (counter == null) throw new CommandException(Messenger.s("Unknown wool color"));
counter.reset(source.getMinecraftServer());
counter.reset(source.getServer());
Messenger.m(source, "w Restarted "+color+" counter");
}
return 1;
@@ -92,7 +92,7 @@ public class CounterCommand
*/
private static int listAllCounters(ServerCommandSource source, boolean realtime)
{
for (BaseText message: HopperCounter.formatAll(source.getMinecraftServer(), realtime))
for (BaseText message: HopperCounter.formatAll(source.getServer(), realtime))
{
source.sendFeedback(message, false);
}
@@ -133,7 +133,7 @@ public class LogCommand
}
private static int unsubFromAll(ServerCommandSource source, String player_name)
{
PlayerEntity player = source.getMinecraftServer().getPlayerManager().getPlayer(player_name);
PlayerEntity player = source.getServer().getPlayerManager().getPlayer(player_name);
if (player == null)
{
Messenger.m(source, "r No player specified");
@@ -148,7 +148,7 @@ public class LogCommand
}
private static int unsubFromLogger(ServerCommandSource source, String player_name, String logname)
{
PlayerEntity player = source.getMinecraftServer().getPlayerManager().getPlayer(player_name);
PlayerEntity player = source.getServer().getPlayerManager().getPlayer(player_name);
if (player == null)
{
Messenger.m(source, "r No player specified");
@@ -166,7 +166,7 @@ public class LogCommand
private static int toggleSubscription(ServerCommandSource source, String player_name, String logName)
{
PlayerEntity player = source.getMinecraftServer().getPlayerManager().getPlayer(player_name);
PlayerEntity player = source.getServer().getPlayerManager().getPlayer(player_name);
if (player == null)
{
Messenger.m(source, "r No player specified");
@@ -190,7 +190,7 @@ public class LogCommand
}
private static int subscribePlayer(ServerCommandSource source, String player_name, String logname, String option)
{
PlayerEntity player = source.getMinecraftServer().getPlayerManager().getPlayer(player_name);
PlayerEntity player = source.getServer().getPlayerManager().getPlayer(player_name);
if (player == null)
{
Messenger.m(source, "r No player specified");
@@ -13,7 +13,7 @@ import net.minecraft.entity.mob.MobEntity;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.command.argument.BlockPosArgumentType;
import net.minecraft.command.argument.EntitySummonArgumentType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.BlockPos;
import static net.minecraft.server.command.CommandManager.argument;
@@ -46,19 +46,19 @@ public class PerimeterInfoCommand
private static int perimeterDiagnose(ServerCommandSource source, BlockPos pos, String mobId)
{
CompoundTag nbttagcompound = new CompoundTag();
NbtCompound nbttagcompound = new NbtCompound();
MobEntity entityliving = null;
if (mobId != null)
{
nbttagcompound.putString("id", mobId);
Entity baseEntity = EntityType.loadEntityWithPassengers(nbttagcompound, source.getWorld(), (entity_1x) -> {
entity_1x.refreshPositionAndAngles(new BlockPos(pos.getX(), -10, pos.getZ()), entity_1x.yaw, entity_1x.pitch);
entity_1x.refreshPositionAndAngles(new BlockPos(pos.getX(), -10, pos.getZ()), entity_1x.getYaw(), entity_1x. getPitch());
return !source.getWorld().tryLoadEntity(entity_1x) ? null : entity_1x;
});
if (!(baseEntity instanceof MobEntity))
{
Messenger.m(source, "r /perimeterinfo requires a mob entity to test agains.");
if (baseEntity != null) baseEntity.remove();
if (baseEntity != null) baseEntity.discard();
return 0;
}
entityliving = (MobEntity) baseEntity;
@@ -72,7 +72,7 @@ public class PerimeterInfoCommand
{
Messenger.m(source, "w ", entityliving.getDisplayName() ,"w : ","wb "+res.specific);
res.samples.forEach(bp -> Messenger.m(source, "w ", Messenger.tp("c", bp)));
entityliving.remove();
entityliving.discard(); // dicard // remove();
}
return 1;
}
@@ -136,7 +136,7 @@ public class PlayerCommand
private static ServerPlayerEntity getPlayer(CommandContext<ServerCommandSource> context)
{
String playerName = StringArgumentType.getString(context, "player");
MinecraftServer server = context.getSource().getMinecraftServer();
MinecraftServer server = context.getSource().getServer();
return server.getPlayerManager().getPlayer(playerName);
}
@@ -158,7 +158,7 @@ public class PlayerCommand
return false;
}
if (!context.getSource().getMinecraftServer().getPlayerManager().isOperator(sendingPlayer.getGameProfile()))
if (!context.getSource().getServer().getPlayerManager().isOperator(sendingPlayer.getGameProfile()))
{
if (sendingPlayer != player && !(player instanceof EntityPlayerMPFake))
{
@@ -181,7 +181,7 @@ public class PlayerCommand
private static boolean cantSpawn(CommandContext<ServerCommandSource> context)
{
String playerName = StringArgumentType.getString(context, "player");
MinecraftServer server = context.getSource().getMinecraftServer();
MinecraftServer server = context.getSource().getServer();
PlayerManager manager = server.getPlayerManager();
PlayerEntity player = manager.getPlayer(playerName);
if (player != null)
@@ -189,7 +189,7 @@ public class PlayerCommand
Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r is already logged on");
return true;
}
GameProfile profile = server.getUserCache().findByName(playerName);
GameProfile profile = server.getUserCache().findByName(playerName).orElse(null);
if (profile == null)
{
if (!CarpetSettings.allowSpawningOfflinePlayers)
@@ -224,9 +224,9 @@ public class PlayerCommand
private static int lookAt(CommandContext<ServerCommandSource> context)
{
return manipulate(context, ap -> {
try {
//try {
ap.lookAt(Vec3ArgumentType.getVec3(context, "position"));
} catch (CommandSyntaxException ignored) {}
//} catch (CommandSyntaxException ignored) {}
});
}
@@ -270,18 +270,18 @@ public class PlayerCommand
{
ServerPlayerEntity player = context.getSource().getPlayer();
mode = player.interactionManager.getGameMode();
flying = player.abilities.flying;
flying = player.getAbilities().flying;
}
catch (CommandSyntaxException ignored) {}
String playerName = StringArgumentType.getString(context, "player");
if (playerName.length()>maxPlayerLength(source.getMinecraftServer()))
if (playerName.length()>maxPlayerLength(source.getServer()))
{
Messenger.m(context.getSource(), "rb Player name: "+playerName+" is too long");
return 0;
}
MinecraftServer server = source.getMinecraftServer();
if (!World.isInBuildLimit(new BlockPos(pos.x, pos.y, pos.z)))
MinecraftServer server = source.getServer();
if (!World.isValid(new BlockPos(pos.x, pos.y, pos.z)))
{
Messenger.m(context.getSource(), "rb Player "+playerName+" cannot be placed outside of the world");
return 0;
@@ -512,9 +512,9 @@ public class ScriptCommand
{
ServerCommandSource source = context.getSource();
CarpetScriptHost host = getHost(context);
BlockBox area = new BlockBox(a, b);
BlockBox area = BlockBox.create(a, b);
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.getBlockCountZ();
int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.getBlockCountZ(); // X Y Z
if (int_1 > CarpetSettings.fillLimit)
{
Messenger.m(source, "r too many blocks to evaluate: " + int_1);
@@ -524,11 +524,11 @@ public class ScriptCommand
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
try
{
for (int x = area.minX; x <= area.maxX; x++)
for (int x = area.getMinX(); x <= area.getMaxX(); x++)
{
for (int y = area.minY; y <= area.maxY; y++)
for (int y = area.getMinY(); y <= area.getMaxY(); y++)
{
for (int z = area.minZ; z <= area.maxZ; z++)
for (int z = area.getMinZ(); z <= area.getMaxZ(); z++)
{
try
{
@@ -561,7 +561,7 @@ public class ScriptCommand
{
ServerCommandSource source = context.getSource();
CarpetScriptHost host = getHost(context);
BlockBox area = new BlockBox(a, b);
BlockBox area = BlockBox.create(a, b);
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
int int_1 = area.getBlockCountX() * area.getBlockCountY() * area.getBlockCountZ();
if (int_1 > CarpetSettings.fillLimit)
@@ -570,22 +570,22 @@ public class ScriptCommand
return 1;
}
boolean[][][] volume = new boolean[area.getBlockCountX()][area.getBlockCountY()][area.getBlockCountZ()];
boolean[][][] volume = new boolean[area.getBlockCountX()][area.getBlockCountY()][area.getBlockCountZ()]; //X then Y then Z got messedup
BlockPos.Mutable mbpos = origin.mutableCopy();
ServerWorld world = source.getWorld();
for (int x = area.minX; x <= area.maxX; x++)
for (int x = area.getMinX(); x <= area.getMaxX(); x++)
{
for (int y = area.minY; y <= area.maxY; y++)
for (int y = area.getMinY(); y <= area.getMaxY(); y++)
{
for (int z = area.minZ; z <= area.maxZ; z++)
for (int z = area.getMinZ(); z <= area.getMaxZ(); z++)
{
try
{
if (cexpr.fillAndScanCommand(host, x, y, z))
{
volume[x-area.minX][y-area.minY][z-area.minZ]=true;
volume[x-area.getMinX()][y-area.getMinY()][z-area.getMinZ()]=true;
}
}
catch (CarpetExpressionException e)
@@ -640,7 +640,7 @@ public class ScriptCommand
{
if (volume[x][y][z])
{
mbpos.set(x+area.minX, y+area.minY, z+area.minZ);
mbpos.set(x+area.getMinX(), y+area.getMinY(), z+area.getMinZ());
if (replacement == null || replacement.test(
new CachedBlockPosition( world, mbpos, true)))
{
@@ -668,7 +668,7 @@ public class ScriptCommand
{
if (volume[x][y][z])
{
mbpos.set(x+area.minX, y+area.minY, z+area.minZ);
mbpos.set(x+area.getMinX(), y+area.getMinY(), z+area.getMinZ());
Block blokc = world.getBlockState(mbpos).getBlock();
world.updateNeighbors(mbpos, blokc);
}
@@ -146,8 +146,8 @@ public class SpawnCommand
Math.max(a.getY(), b.getY()),
Math.max(a.getZ(), b.getZ()) );
}
SpawnReporter.reset_spawn_stats(source.getMinecraftServer(), false);
SpawnReporter.track_spawns = (long) source.getMinecraftServer().getTicks();
SpawnReporter.reset_spawn_stats(source.getServer(), false);
SpawnReporter.track_spawns = (long) source.getServer().getTicks();
SpawnReporter.lower_spawning_limit = lsl;
SpawnReporter.upper_spawning_limit = usl;
Messenger.m(source, "gi Spawning tracking started.");
@@ -157,7 +157,7 @@ public class SpawnCommand
private static int stopTracking(ServerCommandSource source)
{
Messenger.send(source, SpawnReporter.tracking_report(source.getWorld()));
SpawnReporter.reset_spawn_stats(source.getMinecraftServer(),false);
SpawnReporter.reset_spawn_stats(source.getServer(),false);
SpawnReporter.track_spawns = 0L;
SpawnReporter.lower_spawning_limit = null;
SpawnReporter.upper_spawning_limit = null;
@@ -175,19 +175,19 @@ public class SpawnCommand
private static int runTest(ServerCommandSource source, int ticks, String counter)
{
//stop tracking
SpawnReporter.reset_spawn_stats(source.getMinecraftServer(),false);
SpawnReporter.reset_spawn_stats(source.getServer(),false);
//start tracking
SpawnReporter.track_spawns = (long) source.getMinecraftServer().getTicks();
SpawnReporter.track_spawns = (long) source.getServer().getTicks();
//counter reset
if (counter == null)
{
HopperCounter.resetAll(source.getMinecraftServer(), false);
HopperCounter.resetAll(source.getServer(), false);
}
else
{
HopperCounter hCounter = HopperCounter.getCounter(counter);
if (hCounter != null)
hCounter.reset(source.getMinecraftServer());
hCounter.reset(source.getServer());
}