[Fix] No Features when Terrablender is present
This commit is contained in:
parent
31ec9c58f2
commit
e49323be93
10 changed files with 134 additions and 5 deletions
|
@ -0,0 +1,23 @@
|
|||
package org.betterx.bclib.mixin.common;
|
||||
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.biome.FeatureSorter;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(ChunkGenerator.class)
|
||||
public interface ChunkGeneratorAccessor {
|
||||
@Accessor("biomeSource")
|
||||
@Mutable
|
||||
void bcl_setBiomeSource(BiomeSource biomeSource);
|
||||
|
||||
@Accessor("featuresPerStep")
|
||||
@Mutable
|
||||
void bcl_setFeaturesPerStep(Supplier<List<FeatureSorter.StepFeatureData>> supplier);
|
||||
}
|
|
@ -5,13 +5,16 @@ import org.betterx.bclib.interfaces.ChunkGeneratorAccessor;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
@ -24,6 +27,7 @@ public class ChunkGeneratorMixin implements ChunkGeneratorAccessor {
|
|||
protected Registry<StructureSet> structureSets;
|
||||
private int bclib_featureIteratorSeed;
|
||||
|
||||
|
||||
@ModifyArg(method = "applyBiomeDecoration", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/WorldgenRandom;setFeatureSeed(JII)V"))
|
||||
private long bclib_updateFeatureSeed(long seed) {
|
||||
return Long.rotateRight(seed, bclib_featureIteratorSeed++);
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
|
||||
|
@ -28,7 +29,7 @@ import java.util.Collection;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
@Mixin(value=MinecraftServer.class)
|
||||
public class MinecraftServerMixin {
|
||||
@Shadow
|
||||
private MinecraftServer.ReloadableResources resources;
|
||||
|
@ -41,7 +42,7 @@ public class MinecraftServerMixin {
|
|||
@Shadow
|
||||
protected WorldData worldData;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void bclib_onServerInit(
|
||||
Thread thread,
|
||||
LevelStorageAccess levelStorageAccess,
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.betterx.bclib.mixin.common;
|
||||
|
||||
import org.betterx.bclib.api.v2.generator.BCLChunkGenerator;
|
||||
import org.betterx.bclib.api.v2.levelgen.LevelGenUtil;
|
||||
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.Services;
|
||||
import net.minecraft.server.WorldStem;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.Proxy;
|
||||
|
||||
@Mixin(value= MinecraftServer.class, priority = 2000)
|
||||
public class MinecraftServerMixinLate {
|
||||
@Inject(at = @At("RETURN"), method = "<init>")
|
||||
private void appendGlobalFeatures(
|
||||
Thread thread,
|
||||
LevelStorageSource.LevelStorageAccess levelStorageAccess,
|
||||
PackRepository packRepository,
|
||||
WorldStem worldStem,
|
||||
Proxy proxy,
|
||||
DataFixer dataFixer,
|
||||
Services services,
|
||||
ChunkProgressListenerFactory chunkProgressListenerFactory,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
BCLChunkGenerator.restoreInitialBiomeSources(worldStem.worldData().worldGenSettings());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue