mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
use zero multinoise
This commit is contained in:
@@ -10,8 +10,12 @@ import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.util.dynamic.RegistryLookupCodec;
|
||||
import net.minecraft.util.dynamic.RegistryElementCodec;
|
||||
import net.minecraft.util.dynamic.RegistryLoader;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryCodecs;
|
||||
import net.minecraft.util.registry.RegistryFixedCodec;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
|
||||
|
||||
@@ -34,8 +38,9 @@ public final class Codecs {
|
||||
id)))));
|
||||
|
||||
public static final Codec<TerraBiomeSource> TERRA_BIOME_SOURCE = RecordCodecBuilder
|
||||
.create(instance -> instance.group(RegistryLookupCodec.of(Registry.BIOME_KEY)
|
||||
.forGetter(TerraBiomeSource::getBiomeRegistry),
|
||||
.create(instance -> instance.group(RegistryCodecs.entryList(Registry.BIOME_KEY)
|
||||
.fieldOf("biome_registry")
|
||||
.forGetter(TerraBiomeSource::getBiomeRegistry),
|
||||
Codec.LONG.fieldOf("seed").stable()
|
||||
.forGetter(TerraBiomeSource::getSeed),
|
||||
CONFIG_PACK.fieldOf("pack").stable()
|
||||
|
||||
@@ -94,7 +94,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
|
||||
@Override
|
||||
public MultiNoiseUtil.MultiNoiseSampler getMultiNoiseSampler() {
|
||||
return (x, y, z) -> new MultiNoiseUtil.NoiseValuePoint(0, 0, 0, 0, 0, 0);
|
||||
return MultiNoiseUtil.method_40443(); // zero
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,43 +114,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
|
||||
@Override
|
||||
public int getWorldHeight() {
|
||||
return settingsSupplier.get().getGenerationShapeConfig().height();
|
||||
}
|
||||
|
||||
public Pool<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) {
|
||||
if(!accessor.hasStructureReferences(pos)) {
|
||||
return super.getEntitySpawnList(biome, accessor, group, pos);
|
||||
} else {
|
||||
if(accessor.getStructureAt(pos, StructureFeature.SWAMP_HUT).hasChildren()) {
|
||||
if(group == SpawnGroup.MONSTER) {
|
||||
return SwampHutFeature.MONSTER_SPAWNS;
|
||||
}
|
||||
|
||||
if(group == SpawnGroup.CREATURE) {
|
||||
return SwampHutFeature.CREATURE_SPAWNS;
|
||||
}
|
||||
}
|
||||
|
||||
if(group == SpawnGroup.MONSTER) {
|
||||
if(accessor.getStructureAt(pos, StructureFeature.PILLAGER_OUTPOST).hasChildren()) {
|
||||
return PillagerOutpostFeature.MONSTER_SPAWNS;
|
||||
}
|
||||
|
||||
if(accessor.getStructureAt(pos, StructureFeature.MONUMENT).hasChildren()) {
|
||||
return OceanMonumentFeature.MONSTER_SPAWNS;
|
||||
}
|
||||
|
||||
if(accessor.getStructureAt(pos, StructureFeature.FORTRESS).hasChildren()) {
|
||||
return NetherFortressFeature.MONSTER_SPAWNS;
|
||||
}
|
||||
}
|
||||
|
||||
return (group == SpawnGroup.UNDERGROUND_WATER_CREATURE || group == SpawnGroup.AXOLOTLS) && accessor.getStructureAt(pos,
|
||||
StructureFeature.MONUMENT)
|
||||
.hasChildren()
|
||||
? SpawnSettings.EMPTY_ENTRY_POOL
|
||||
: super.getEntitySpawnList(biome, accessor, group, pos);
|
||||
}
|
||||
return settingsSupplier.get().generationShapeConfig().height();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,12 +144,12 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
|
||||
@Override
|
||||
public int getSeaLevel() {
|
||||
return settingsSupplier.get().getSeaLevel();
|
||||
return settingsSupplier.get().seaLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumY() {
|
||||
return settingsSupplier.get().getGenerationShapeConfig().minimumY();
|
||||
return settingsSupplier.get().generationShapeConfig().minimumY();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,12 +22,11 @@ import com.dfsek.terra.fabric.data.Codecs;
|
||||
import com.dfsek.terra.fabric.util.ProtoPlatformBiome;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -36,7 +35,6 @@ import java.util.stream.Collectors;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
import com.dfsek.terra.fabric.util.FabricUtil;
|
||||
|
||||
|
||||
public class TerraBiomeSource extends BiomeSource {
|
||||
@@ -73,7 +71,7 @@ public class TerraBiomeSource extends BiomeSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minecraft.world.biome.Biome getBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseSampler noiseSampler) {
|
||||
public RegistryEntry<net.minecraft.world.biome.Biome> getBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseSampler noiseSampler) {
|
||||
return ((ProtoPlatformBiome) pack.getBiomeProvider().getBiome(biomeX << 2, biomeZ << 2, seed).getPlatformBiome()).getDelegate();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.biome.Biome.Builder;
|
||||
@@ -62,7 +63,7 @@ public final class FabricUtil {
|
||||
public static void registerBiome(Biome biome, ConfigPack pack, DynamicRegistryManager registryManager,
|
||||
com.dfsek.terra.api.registry.key.RegistryKey id) {
|
||||
Registry<net.minecraft.world.biome.Biome> biomeRegistry = registryManager.get(Registry.BIOME_KEY);
|
||||
net.minecraft.world.biome.Biome vanilla = ((ProtoPlatformBiome) biome.getPlatformBiome()).get(biomeRegistry);
|
||||
RegistryEntry<net.minecraft.world.biome.Biome> vanilla = ((ProtoPlatformBiome) biome.getPlatformBiome()).get(biomeRegistry);
|
||||
|
||||
|
||||
if(pack.getContext().get(PreLoadCompatibilityOptions.class).useVanillaBiomes()) {
|
||||
|
||||
@@ -22,20 +22,21 @@ import net.minecraft.util.registry.Registry;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
|
||||
public class ProtoPlatformBiome implements PlatformBiome {
|
||||
private final Identifier identifier;
|
||||
|
||||
private Biome delegate;
|
||||
private RegistryEntry<Biome> delegate;
|
||||
|
||||
public ProtoPlatformBiome(Identifier identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public net.minecraft.world.biome.Biome get(Registry<net.minecraft.world.biome.Biome> registry) {
|
||||
return registry.get(identifier);
|
||||
public RegistryEntry<Biome> get(Registry<net.minecraft.world.biome.Biome> registry) {
|
||||
return registry.getOrCreateEntry(registry.getKey(registry.get(identifier)).orElseThrow());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,11 +44,11 @@ public class ProtoPlatformBiome implements PlatformBiome {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public Biome getDelegate() {
|
||||
public RegistryEntry<Biome> getDelegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
public void setDelegate(Biome delegate) {
|
||||
public void setDelegate(RegistryEntry<Biome> delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user