last remnants of dim issues, fixes #336
This commit is contained in:
1 parent
8d5dff7d82
commit
838ed4748d
3 files changed
+11
-6
No files matched your search
@@ -13,6 +13,7 @@ import carpet.script.CarpetScriptServer;
|
||||
import carpet.settings.SettingsManager;
|
||||
import carpet.utils.HUDController;
|
||||
import carpet.utils.MobAI;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
@@ -51,6 +52,9 @@ public class CarpetServer // static for now - easier to handle all around the co
|
||||
public static void onServerLoaded(MinecraftServer server)
|
||||
{
|
||||
CarpetServer.minecraft_server = server;
|
||||
// shoudl not be needed - that bit needs refactoring, but not now.
|
||||
SpawnReporter.reset_spawn_stats(server, true);
|
||||
|
||||
settingsManager.attachServer(server);
|
||||
extensions.forEach(e -> {
|
||||
SettingsManager sm = e.customSettingsManager();
|
||||
|
||||
@@ -150,7 +150,7 @@ public class SpawnCommand
|
||||
Math.max(a.getY(), b.getY()),
|
||||
Math.max(a.getZ(), b.getZ()) );
|
||||
}
|
||||
SpawnReporter.reset_spawn_stats(false);
|
||||
SpawnReporter.reset_spawn_stats(source.getMinecraftServer(), false);
|
||||
SpawnReporter.track_spawns = (long) source.getMinecraftServer().getTicks();
|
||||
SpawnReporter.lower_spawning_limit = lsl;
|
||||
SpawnReporter.upper_spawning_limit = usl;
|
||||
@@ -161,7 +161,7 @@ public class SpawnCommand
|
||||
private static int stopTracking(ServerCommandSource source)
|
||||
{
|
||||
Messenger.send(source, SpawnReporter.tracking_report(source.getWorld()));
|
||||
SpawnReporter.reset_spawn_stats(false);
|
||||
SpawnReporter.reset_spawn_stats(source.getMinecraftServer(),false);
|
||||
SpawnReporter.track_spawns = 0L;
|
||||
SpawnReporter.lower_spawning_limit = null;
|
||||
SpawnReporter.upper_spawning_limit = null;
|
||||
@@ -179,7 +179,7 @@ public class SpawnCommand
|
||||
private static int runTest(ServerCommandSource source, int ticks, String counter)
|
||||
{
|
||||
//stop tracking
|
||||
SpawnReporter.reset_spawn_stats(false);
|
||||
SpawnReporter.reset_spawn_stats(source.getMinecraftServer(),false);
|
||||
//start tracking
|
||||
SpawnReporter.track_spawns = (long) source.getMinecraftServer().getTicks();
|
||||
//counter reset
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.entity.SpawnRestriction;
|
||||
import net.minecraft.entity.SpawnReason;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.passive.OcelotEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.text.BaseText;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.DyeColor;
|
||||
@@ -60,7 +61,7 @@ public class SpawnReporter
|
||||
public static HashSet<SpawnGroup> first_chunk_marker = null;
|
||||
|
||||
static {
|
||||
reset_spawn_stats(true);
|
||||
reset_spawn_stats(null, true);
|
||||
}
|
||||
|
||||
public static void registerSpawn(MobEntity mob, SpawnGroup cat, BlockPos pos)
|
||||
@@ -299,7 +300,7 @@ public class SpawnReporter
|
||||
{
|
||||
mock_spawns = false;
|
||||
}
|
||||
public static void reset_spawn_stats(boolean full)
|
||||
public static void reset_spawn_stats(MinecraftServer server, boolean full)
|
||||
{
|
||||
|
||||
spawn_stats.clear();
|
||||
@@ -310,7 +311,7 @@ public class SpawnReporter
|
||||
{
|
||||
spawn_tries.put(enumcreaturetype, 1);
|
||||
}
|
||||
for (RegistryKey<World> dim : Arrays.asList(World.OVERWORLD, World.NETHER, World.END))
|
||||
if (server != null) for (RegistryKey<World> dim : server.getWorldRegistryKeys())
|
||||
{
|
||||
Pair<RegistryKey<World>, SpawnGroup> key = Pair.of(dim, enumcreaturetype);
|
||||
overall_spawn_ticks.put(key, 0L);
|
||||
|
||||
Reference in new issue
Block a user