Files
fabric-carpet/src/main/java/carpet/utils/SpawnChunks.java
T
altrisi 8cd60db5e4 Random cleanups to users of Level.OVERWORLD and reduce minecraft_server usage (#1697)
- Use `overworld()` instead of `getLevel(Level.OVERWORLD)` when convenient
- Remove now unnecessary `// OW` comments, from when it had no mappings
- Make spawn chunk size and light batches not depend on global server instance
- Merge all spawn chunk size logic into SpawnChunks instead of methods in the validator
- Remove unneeded `withWorld(OVERWORLD)` with just-created server `CommandSource`s
- Use enhanced for in light batch application
2023-04-08 20:01:30 +02:00

22 lines
783 B
Java

package carpet.utils;
import carpet.fakes.ChunkTicketManagerInterface;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.DistanceManager;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
public class SpawnChunks
{
public static void changeSpawnSize(ServerLevel overworld, int size)
{
ChunkPos centerChunk = new ChunkPos(new BlockPos(
overworld.getLevelData().getXSpawn(),
overworld.getLevelData().getYSpawn(),
overworld.getLevelData().getZSpawn()
));
DistanceManager ticketManager = overworld.getChunkSource().chunkMap.getDistanceManager();
((ChunkTicketManagerInterface)ticketManager).changeSpawnChunks(centerChunk, size);
}
}