Fixed surface block setting

This commit is contained in:
Frank 2021-12-08 23:59:53 +01:00
parent 633c5ad553
commit 2a0f58a729
14 changed files with 73 additions and 21 deletions

View file

@ -1,8 +1,28 @@
package ru.betterend;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.Consumer;
import java.util.function.Supplier;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import org.apache.commons.lang3.mutable.MutableInt;
import ru.bclib.api.WorldDataAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.Logger;
@ -34,7 +54,7 @@ public class BetterEnd implements ModInitializer {
public static final String MOD_ID = "betterend";
public static final Logger LOGGER = new Logger(MOD_ID);
public static final boolean RUNS_FALL_FLYING_LIB = FabricLoader.getInstance().getModContainer("fallflyinglib").isPresent();
@Override
public void onInitialize() {
WorldDataAPI.registerModCache(MOD_ID);
@ -60,19 +80,53 @@ public class BetterEnd implements ModInitializer {
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
Integrations.init();
Configs.saveConfigs();
if (GeneratorOptions.useNewGenerator()) {
ru.bclib.world.generator.GeneratorOptions.setFarEndBiomes(GeneratorOptions.getIslandDistBlock() > 250000L);
ru.bclib.world.generator.GeneratorOptions.setEndLandFunction((pos) -> TerrainGenerator.isLand(pos.x, pos.y));
}
BiomeAPI.registerEndBiomeModification((biomeID, biome) -> {
EndStructures.addBiomeStructures(biomeID, biome);
EndFeatures.addBiomeFeatures(biomeID, biome);
//EndStructures.addBiomeStructures(biomeID, biome);
//TODO: 1.18 disabled to test feature-sorting of BE biomes
//EndFeatures.addBiomeFeatures(biomeID, biome);
});
List<Biome> biomes = new LinkedList<>();
biomes.add(net.minecraft.data.worldgen.biome.EndBiomes.endBarrens());
biomes.add(net.minecraft.data.worldgen.biome.EndBiomes.endHighlands());
biomes.add(net.minecraft.data.worldgen.biome.EndBiomes.endMidlands());
biomes.add(net.minecraft.data.worldgen.biome.EndBiomes.theEnd());
biomes.add(net.minecraft.data.worldgen.biome.EndBiomes.smallEndIslands());
List<Biome> lBiomes = new LinkedList<>();
lBiomes.add(EndBiomes.FOGGY_MUSHROOMLAND.getBiome());
lBiomes.add(EndBiomes.CHORUS_FOREST.getBiome());
lBiomes.add(EndBiomes.DUST_WASTELANDS.getBiome());
lBiomes.add(EndBiomes.MEGALAKE.getBiome());
lBiomes.add(EndBiomes.MEGALAKE_GROVE.getBiome());
lBiomes.add(EndBiomes.CRYSTAL_MOUNTAINS.getBiome());
lBiomes.add(EndBiomes.PAINTED_MOUNTAINS.getBiome());
lBiomes.add(EndBiomes.SHADOW_FOREST.getBiome());
lBiomes.add(EndBiomes.AMBER_LAND.getBiome());
lBiomes.add(EndBiomes.BLOSSOMING_SPIRES.getBiome());
lBiomes.add(EndBiomes.SULPHUR_SPRINGS.getBiome());
lBiomes.add(EndBiomes.UMBRELLA_JUNGLE.getBiome());
lBiomes.add(EndBiomes.GLOWING_GRASSLANDS.getBiome());
lBiomes.add(EndBiomes.DRAGON_GRAVEYARDS.getBiome());
lBiomes.add(EndBiomes.DRY_SHRUBLAND.getBiome());
lBiomes.add(EndBiomes.LANTERN_WOODS.getBiome());
lBiomes.add(EndBiomes.NEON_OASIS.getBiome());
lBiomes.add(EndBiomes.UMBRA_VALLEY.getBiome());
lBiomes.forEach(biome -> {
BiomeAPI.sortBiomeFeatures(biome);
});
biomes.addAll(lBiomes);
//buildFeaturesPerStep(lBiomes, true);
}
public static ResourceLocation makeID(String path) {
return new ResourceLocation(MOD_ID, path);
}
}

View file

@ -2,7 +2,6 @@ package ru.betterend.world.biome.land;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SurfaceRules;
import ru.bclib.api.biomes.BCLBiomeBuilder;
import ru.bclib.api.biomes.SurfaceMaterialProvider;
import ru.betterend.registry.EndBlocks;
@ -26,7 +25,7 @@ public class AmberLandBiome extends EndBiome.Config {
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_AMBER_LAND)
.particles(EndParticles.AMBER_SPHERE, 0.001F)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.feature(EndFeatures.AMBER_ORE)
.feature(EndFeatures.END_LAKE_RARE)
.feature(EndFeatures.HELIX_TREE)

View file

@ -2,7 +2,6 @@ package ru.betterend.world.biome.land;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SurfaceRules;
import ru.bclib.api.biomes.BCLBiomeBuilder;
import ru.bclib.api.biomes.SurfaceMaterialProvider;
import ru.betterend.registry.EndBlocks;
@ -26,7 +25,7 @@ public class BlossomingSpiresBiome extends EndBiome.Config {
builder.fogColor(241, 146, 229)
.fogDensity(1.7F)
.plantsColor(122, 45, 122)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)
.feature(EndFeatures.SPIRE)

View file

@ -25,7 +25,7 @@ public class ChorusForestBiome extends EndBiome.Config {
.fogDensity(1.5F)
.plantsColor(122, 45, 122)
.waterAndFogColor(73, 30, 73)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.particles(ParticleTypes.PORTAL, 0.01F)
.loop(EndSounds.AMBIENT_CHORUS_FOREST)
.music(EndSounds.MUSIC_DARK)

View file

@ -20,7 +20,7 @@ public class CrystalMountainsBiome extends EndBiome.Config {
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.structure(EndStructures.MOUNTAIN.getFeatureConfigured())
.plantsColor(255, 133, 211)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.music(EndSounds.MUSIC_OPENSPACE)
.feature(EndFeatures.CRYSTAL_GRASS)
.spawn(EntityType.ENDERMAN, 50, 1, 2);

View file

@ -24,7 +24,7 @@ public class DragonGraveyardsBiome extends EndBiome.Config {
.particles(EndParticles.FIREFLY, 0.0007F)
.music(EndSounds.MUSIC_OPENSPACE)
.loop(EndSounds.AMBIENT_GLOWING_GRASSLANDS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.waterAndFogColor(203, 59, 167)
.plantsColor(244, 46, 79)
.feature(EndFeatures.OBSIDIAN_PILLAR_BASEMENT)

View file

@ -21,7 +21,7 @@ public class DryShrublandBiome extends EndBiome.Config {
.fogDensity(1.2F)
.waterAndFogColor(113, 88, 53)
.plantsColor(237, 122, 66)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.music(EndSounds.MUSIC_OPENSPACE)
.feature(EndFeatures.LUCERNIA_BUSH_RARE)
.feature(EndFeatures.ORANGO)

View file

@ -20,7 +20,7 @@ public class DustWastelandsBiome extends EndBiome.Config {
builder.fogColor(226, 239, 168)
.fogDensity(2)
.waterAndFogColor(192, 180, 131)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
//TODO: 1.18 removed
//.depth(1.5F)
.particles(ParticleTypes.WHITE_ASH, 0.01F)

View file

@ -23,7 +23,7 @@ public class GlowingGrasslandsBiome extends EndBiome.Config {
.particles(EndParticles.FIREFLY, 0.001F)
.music(EndSounds.MUSIC_OPENSPACE)
.loop(EndSounds.AMBIENT_GLOWING_GRASSLANDS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.waterAndFogColor(92, 250, 230)
.plantsColor(73, 210, 209)
.feature(EndFeatures.END_LAKE_RARE)

View file

@ -22,7 +22,7 @@ public class LanternWoodsBiome extends EndBiome.Config {
.fogDensity(1.1F)
.waterAndFogColor(171, 234, 226)
.plantsColor(254, 85, 57)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.music(EndSounds.MUSIC_FOREST)
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
.feature(EndFeatures.END_LAKE_NORMAL)

View file

@ -28,7 +28,7 @@ public class MegalakeGroveBiome extends EndBiome.Config {
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
.music(EndSounds.MUSIC_WATER)
.loop(EndSounds.AMBIENT_MEGALAKE_GROVE)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
//TODO: 1.18 removed
//.depth(0F)
.feature(EndFeatures.LACUGROVE)

View file

@ -24,7 +24,7 @@ public class PaintedMountainsBiome extends EndBiome.Config {
.waterAndFogColor(192, 180, 131)
.music(EndSounds.MUSIC_OPENSPACE)
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.particles(ParticleTypes.WHITE_ASH, 0.01F)
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}

View file

@ -23,7 +23,7 @@ public class ShadowForestBiome extends EndBiome.Config {
.fogDensity(2.5F)
.plantsColor(45, 45, 45)
.waterAndFogColor(42, 45, 80)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.particles(ParticleTypes.MYCELIUM, 0.01F)
.loop(EndSounds.AMBIENT_CHORUS_FOREST)
.music(EndSounds.MUSIC_DARK)

View file

@ -25,7 +25,7 @@ public class UmbrellaJungleBiome extends EndBiome.Config {
.particles(EndParticles.JUNGLE_SPORE, 0.001F)
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_UMBRELLA_JUNGLE)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.surface(surfaceMaterial().getTopMaterial())
.feature(EndFeatures.END_LAKE)
.feature(EndFeatures.UMBRELLA_TREE)
.feature(EndFeatures.JELLYSHROOM)