mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
remove BiomeProviderHolder
This commit is contained in:
parent
7de66fecf8
commit
8a2024e8d8
@ -64,7 +64,6 @@ import com.dfsek.terra.api.world.info.WorldProperties;
|
|||||||
import com.dfsek.terra.fabric.config.PreLoadCompatibilityOptions;
|
import com.dfsek.terra.fabric.config.PreLoadCompatibilityOptions;
|
||||||
import com.dfsek.terra.fabric.data.Codecs;
|
import com.dfsek.terra.fabric.data.Codecs;
|
||||||
import com.dfsek.terra.fabric.mixin.access.StructureAccessorAccessor;
|
import com.dfsek.terra.fabric.mixin.access.StructureAccessorAccessor;
|
||||||
import com.dfsek.terra.fabric.mixin_ifaces.BiomeProviderHolder;
|
|
||||||
import com.dfsek.terra.fabric.util.FabricAdapter;
|
import com.dfsek.terra.fabric.util.FabricAdapter;
|
||||||
|
|
||||||
|
|
||||||
@ -89,17 +88,6 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
|||||||
this.biomeSource = biomeSource;
|
this.biomeSource = biomeSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompletableFuture<Chunk> populateBiomes(Registry<Biome> biomeRegistry, Executor executor, NoiseConfig noiseConfig,
|
|
||||||
Blender blender, StructureAccessor structureAccessor, Chunk chunk) {
|
|
||||||
if(chunk instanceof net.minecraft.world.chunk.ProtoChunk) {
|
|
||||||
ChunkPos pos = chunk.getPos();
|
|
||||||
((BiomeProviderHolder) chunk)
|
|
||||||
.terra$setHeldBiomeProvider(pack.getBiomeProvider());
|
|
||||||
}
|
|
||||||
return super.populateBiomes(biomeRegistry, executor, noiseConfig, blender, structureAccessor, chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Registry<StructureSet> getNoiseRegistry() {
|
public Registry<StructureSet> getNoiseRegistry() {
|
||||||
return noiseRegistry;
|
return noiseRegistry;
|
||||||
}
|
}
|
||||||
@ -136,15 +124,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
|||||||
StructureAccessor structureAccessor, Chunk chunk) {
|
StructureAccessor structureAccessor, Chunk chunk) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
ProtoWorld world = (ProtoWorld) ((StructureAccessorAccessor) structureAccessor).getWorld();
|
ProtoWorld world = (ProtoWorld) ((StructureAccessorAccessor) structureAccessor).getWorld();
|
||||||
BiomeProvider biomeProvider;
|
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
||||||
if(chunk instanceof BiomeProviderHolder providerHolder) {
|
|
||||||
biomeProvider = providerHolder.terra$getHeldBiomeProvider();
|
|
||||||
if(biomeProvider == null) {
|
|
||||||
biomeProvider = pack.getBiomeProvider();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
biomeProvider = pack.getBiomeProvider();
|
|
||||||
}
|
|
||||||
delegate.generateChunkData((ProtoChunk) chunk, world, biomeProvider, chunk.getPos().x, chunk.getPos().z);
|
delegate.generateChunkData((ProtoChunk) chunk, world, biomeProvider, chunk.getPos().x, chunk.getPos().z);
|
||||||
|
|
||||||
PreLoadCompatibilityOptions compatibilityOptions = pack.getContext().get(PreLoadCompatibilityOptions.class);
|
PreLoadCompatibilityOptions compatibilityOptions = pack.getContext().get(PreLoadCompatibilityOptions.class);
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
package com.dfsek.terra.fabric.mixin.implementations.cache;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|
||||||
import com.dfsek.terra.api.world.chunk.Chunk;
|
|
||||||
import com.dfsek.terra.fabric.mixin_ifaces.BiomeProviderHolder;
|
|
||||||
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
import net.minecraft.world.ChunkRegion;
|
|
||||||
import net.minecraft.world.chunk.ChunkStatus;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
|
||||||
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;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Mixin(ChunkRegion.class)
|
|
||||||
@Implements(@Interface(iface = BiomeProviderHolder.class, prefix = "provider$"))
|
|
||||||
public class ChunkRegionMixin {
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private net.minecraft.world.chunk.Chunk centerPos;
|
|
||||||
private BiomeProvider biomeProvider;
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
public void addProvider(ServerWorld world, List<Chunk> chunks, ChunkStatus status, int placementRadius, CallbackInfo ci) {
|
|
||||||
if(centerPos instanceof BiomeProviderHolder providerHolder) {
|
|
||||||
biomeProvider = providerHolder.terra$getHeldBiomeProvider();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void provider$terra$setHeldBiomeProvider(BiomeProvider provider) {
|
|
||||||
if(this.biomeProvider != null) {
|
|
||||||
throw new IllegalStateException("Already set biome provider for chunk " + this);
|
|
||||||
}
|
|
||||||
this.biomeProvider = provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiomeProvider provider$terra$getHeldBiomeProvider() {
|
|
||||||
return biomeProvider;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.dfsek.terra.fabric.mixin.implementations.cache;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|
||||||
import com.dfsek.terra.fabric.mixin_ifaces.BiomeProviderHolder;
|
|
||||||
|
|
||||||
import net.minecraft.world.chunk.ProtoChunk;
|
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
|
|
||||||
|
|
||||||
@Mixin(ProtoChunk.class)
|
|
||||||
@Implements(@Interface(iface = BiomeProviderHolder.class, prefix = "provider$"))
|
|
||||||
public class ProtoChunkMixin {
|
|
||||||
private BiomeProvider biomeProvider;
|
|
||||||
|
|
||||||
public void provider$terra$setHeldBiomeProvider(BiomeProvider provider) {
|
|
||||||
if(this.biomeProvider != null) {
|
|
||||||
throw new IllegalStateException("Already set biome provider for chunk " + this);
|
|
||||||
}
|
|
||||||
this.biomeProvider = provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiomeProvider provider$terra$getHeldBiomeProvider() {
|
|
||||||
return biomeProvider;
|
|
||||||
}
|
|
||||||
}
|
|
@ -43,14 +43,11 @@ import com.dfsek.terra.api.block.state.BlockState;
|
|||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
import com.dfsek.terra.api.entity.Entity;
|
import com.dfsek.terra.api.entity.Entity;
|
||||||
import com.dfsek.terra.api.entity.EntityType;
|
import com.dfsek.terra.api.entity.EntityType;
|
||||||
import com.dfsek.terra.api.util.generic.Lazy;
|
|
||||||
import com.dfsek.terra.api.world.ServerWorld;
|
import com.dfsek.terra.api.world.ServerWorld;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
|
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
|
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
|
||||||
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
||||||
import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
|
||||||
import com.dfsek.terra.fabric.mixin_ifaces.BiomeProviderHolder;
|
|
||||||
import com.dfsek.terra.fabric.util.FabricUtil;
|
import com.dfsek.terra.fabric.util.FabricUtil;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
package com.dfsek.terra.fabric.mixin_ifaces;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|
||||||
|
|
||||||
|
|
||||||
public interface BiomeProviderHolder {
|
|
||||||
void terra$setHeldBiomeProvider(BiomeProvider biomeProvider);
|
|
||||||
|
|
||||||
BiomeProvider terra$getHeldBiomeProvider();
|
|
||||||
}
|
|
@ -10,8 +10,6 @@
|
|||||||
"access.StructureAccessorAccessor",
|
"access.StructureAccessorAccessor",
|
||||||
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
||||||
"fix.NetherFossilOptimization",
|
"fix.NetherFossilOptimization",
|
||||||
"implementations.cache.ChunkRegionMixin",
|
|
||||||
"implementations.cache.ProtoChunkMixin",
|
|
||||||
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
||||||
"implementations.terra.BiomeMixin",
|
"implementations.terra.BiomeMixin",
|
||||||
"implementations.terra.HandleImplementationMixin",
|
"implementations.terra.HandleImplementationMixin",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user