Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Add default implementation for ExtendedWorld in Level
Browse files Browse the repository at this point in the history
This should hopefully help mod compatibility with mods that
implement their own Levels.

Fixes #187
  • Loading branch information
Spottedleaf committed Oct 17, 2023
1 parent 476f186 commit d532896
Showing 1 changed file with 15 additions and 1 deletion.
Expand Up @@ -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);
}
}

0 comments on commit d532896

Please sign in to comment.