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
This commit is contained in:
1 parent
17c2d601d2
commit
8cd60db5e4
6 files changed
+30
-46
No files matched your search
@@ -3,9 +3,12 @@ package carpet.mixins;
|
||||
import carpet.CarpetServer;
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.utils.CarpetProfiler;
|
||||
import carpet.utils.SpawnChunks;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -56,12 +59,15 @@ public abstract class MinecraftServer_coreMixin
|
||||
CarpetServer.onServerDoneClosing((MinecraftServer) (Object) this);
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public abstract ServerLevel overworld();
|
||||
|
||||
@Inject(method = "prepareLevels", at = @At("RETURN"))
|
||||
private void afterSpawnCreated(ChunkProgressListener worldGenerationProgressListener, CallbackInfo ci)
|
||||
{
|
||||
if (CarpetSettings.spawnChunksSize != 11)
|
||||
CarpetSettings.ChangeSpawnChunksValidator.changeSpawnSize(CarpetSettings.spawnChunksSize);
|
||||
SpawnChunks.changeSpawnSize(overworld(), CarpetSettings.spawnChunksSize);
|
||||
|
||||
CarpetSettings.LightBatchValidator.applyLightBatchSizes(CarpetSettings.lightEngineMaxBatchSize);
|
||||
CarpetSettings.LightBatchValidator.applyLightBatchSizes((MinecraftServer) (Object) this, CarpetSettings.lightEngineMaxBatchSize);
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S
|
||||
{
|
||||
ServerPlayer player = (ServerPlayer) (Object)this;
|
||||
Vec3 to = null;
|
||||
if (!wonGame || previousDimension != Level.END || destination.dimension() != Level.OVERWORLD) // end ow
|
||||
if (!wonGame || previousDimension != Level.END || destination.dimension() != Level.OVERWORLD)
|
||||
{
|
||||
to = position();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user