Slightly improve getNoiseBiome
See reason note
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package ca.spottedleaf.moonrise.mixin.random_ticking;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(Level.class)
|
||||
public abstract class LevelMixin implements LevelAccessor, AutoCloseable {
|
||||
|
||||
@Shadow
|
||||
@Nullable
|
||||
public abstract ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus, boolean bl);
|
||||
|
||||
@Override
|
||||
public abstract Holder<Biome> getUncachedNoiseBiome(final int x, final int y, final int z);
|
||||
|
||||
/**
|
||||
* @reason Make getChunk and getUncachedNoiseBiome virtual calls instead of interface calls
|
||||
* by implementing the superclass method in this class.
|
||||
* @author Spottedleaf
|
||||
*/
|
||||
@Override
|
||||
public Holder<Biome> getNoiseBiome(final int x, final int y, final int z) {
|
||||
final ChunkAccess chunk = this.getChunk(x >> 2, z >> 2, ChunkStatus.BIOMES, false);
|
||||
|
||||
return chunk != null ? chunk.getNoiseBiome(x, y, z) : this.getUncachedNoiseBiome(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,7 @@
|
||||
"poi_lookup.PoiManagerMixin",
|
||||
"poi_lookup.PortalForcerMixin",
|
||||
"random_ticking.BiomeMixin",
|
||||
"random_ticking.LevelMixin",
|
||||
"random_ticking.ServerLevelMixin",
|
||||
"serverlist.ConnectionMixin",
|
||||
"starlight.blockstate.BlockStateBaseMixin",
|
||||
|
||||
Reference in New Issue
Block a user