From d532896efa0cafe23a7e59310d4be959d12292e2 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 16 Oct 2023 07:01:11 -0700 Subject: [PATCH] Add default implementation for ExtendedWorld in Level This should hopefully help mod compatibility with mods that implement their own Levels. Fixes https://github.com/PaperMC/Starlight/issues/187 --- .../starlight/mixin/common/world/LevelMixin.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/ca/spottedleaf/starlight/mixin/common/world/LevelMixin.java b/src/main/java/ca/spottedleaf/starlight/mixin/common/world/LevelMixin.java index f1eaa433..f57d233b 100644 --- a/src/main/java/ca/spottedleaf/starlight/mixin/common/world/LevelMixin.java +++ b/src/main/java/ca/spottedleaf/starlight/mixin/common/world/LevelMixin.java @@ -3,7 +3,21 @@ import ca.spottedleaf.starlight.common.world.ExtendedWorld; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraft.world.level.chunk.LevelChunk; import org.spongepowered.asm.mixin.Mixin; @Mixin(Level.class) -public abstract class LevelMixin implements LevelAccessor, AutoCloseable, ExtendedWorld {} +public abstract class LevelMixin implements LevelAccessor, AutoCloseable, ExtendedWorld { + + @Override + public LevelChunk getChunkAtImmediately(final int chunkX, final int chunkZ) { + return this.getChunkSource().getChunk(chunkX, chunkZ, false); + } + + @Override + public ChunkAccess getAnyChunkImmediately(final int chunkX, final int chunkZ) { + return this.getChunkSource().getChunk(chunkX, chunkX, ChunkStatus.EMPTY, false); + } +}