30 lines
1.2 KiB
Java
30 lines
1.2 KiB
Java
|
|
package io.lampnet.travelerssuitcase.mixin;
|
||
|
|
|
||
|
|
import io.lampnet.travelerssuitcase.world.FantasyWorldAccess;
|
||
|
|
import io.lampnet.travelerssuitcase.world.RuntimeWorld;
|
||
|
|
import net.minecraft.server.level.ServerChunkCache;
|
||
|
|
import net.minecraft.server.level.ServerLevel;
|
||
|
|
import org.spongepowered.asm.mixin.Final;
|
||
|
|
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.CallbackInfoReturnable;
|
||
|
|
|
||
|
|
@Mixin(ServerChunkCache.class)
|
||
|
|
public class ServerChunkManagerMixin {
|
||
|
|
@Shadow
|
||
|
|
@Final
|
||
|
|
private ServerLevel level;
|
||
|
|
|
||
|
|
@Inject(method = "runDistanceManagerUpdates", at = @At("HEAD"), cancellable = true)
|
||
|
|
private void onRunDistanceManagerUpdates(CallbackInfoReturnable<Boolean> cir) {
|
||
|
|
// Only apply special chunk processing logic to RuntimeWorld instances (fantasy dimensions)
|
||
|
|
if (this.level instanceof RuntimeWorld) {
|
||
|
|
if (!((FantasyWorldAccess) this.level).fantasy$shouldTick()) {
|
||
|
|
cir.setReturnValue(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// Regular worlds (overworld, nether, end) process chunks normally without interference
|
||
|
|
}
|
||
|
|
}
|