Add info about top/underMaterial to BE-biomes

This commit is contained in:
Frank 2021-12-08 23:38:52 +01:00
parent 5c12813b3e
commit 633c5ad553
26 changed files with 430 additions and 67 deletions

View file

@ -2,13 +2,18 @@ package ru.betterend.world.biome;
import java.util.function.BiFunction;
import net.minecraft.core.BlockPos;
import net.minecraft.data.worldgen.StructureFeatures;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Blocks;
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.BiomeAPI;
import ru.bclib.api.biomes.SurfaceMaterialProvider;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.BetterEnd;
import ru.betterend.interfaces.StructureFeaturesAccessor;
@ -16,10 +21,30 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
public class EndBiome extends BCLBiome {
public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
public static class DefaultSurfaceMaterialProvider implements SurfaceMaterialProvider{
public static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
@Override
public BlockState getTopMaterial() {
return END_STONE;
}
@Override
public BlockState getAltTopMaterial() {
return getTopMaterial();
}
@Override
public BlockState getUnderMaterial() {
return END_STONE;
}
}
public abstract static class Config {
public static final SurfaceMaterialProvider DEFAULT_MATERIAL = new DefaultSurfaceMaterialProvider();
protected static final StructureFeaturesAccessor VANILLA_FEATURES = (StructureFeaturesAccessor)new StructureFeatures();
protected static final SurfaceRules.RuleSource END_STONE = SurfaceRules.state(Blocks.END_STONE.defaultBlockState());
protected static final SurfaceRules.RuleSource END_STONE = SurfaceRules.state(DefaultSurfaceMaterialProvider.END_STONE);
protected static final SurfaceRules.RuleSource END_MOSS = SurfaceRules.state(EndBlocks.END_MOSS.defaultBlockState());
protected static final SurfaceRules.RuleSource ENDSTONE_DUST = SurfaceRules.state(EndBlocks.ENDSTONE_DUST.defaultBlockState());
protected static final SurfaceRules.RuleSource END_MYCELIUM = SurfaceRules.state(EndBlocks.END_MYCELIUM.defaultBlockState());
@ -47,6 +72,10 @@ public class EndBiome extends BCLBiome {
protected boolean hasCaves(){
return true;
}
protected SurfaceMaterialProvider surfaceMaterial() {
return DEFAULT_MATERIAL;
}
}
public EndBiome(ResourceLocation biomeID, Biome biome) {
@ -73,7 +102,54 @@ public class EndBiome extends BCLBiome {
EndBiome biome = builder.build(biomeConfig.getSupplier());
biome.addCustomData("has_caves", biomeConfig.hasCaves());
biome.setSurfaceMaterial(biomeConfig.surfaceMaterial());
return biome;
}
private SurfaceMaterialProvider surfMatProv = Config.DEFAULT_MATERIAL;
private void setSurfaceMaterial(SurfaceMaterialProvider prov) {
surfMatProv = prov;
}
@Override
public BlockState getTopMaterial() {
return surfMatProv.getTopMaterial();
}
public BlockState getUnderMaterial() {
return surfMatProv.getUnderMaterial();
}
@Override
public BlockState getAltTopMaterial() {
return surfMatProv.getAltTopMaterial();
}
public static BlockState findTopMaterial(BCLBiome biome){
if (biome instanceof SurfaceMaterialProvider smp){
return smp.getTopMaterial();
}
return EndBiome.Config.DEFAULT_MATERIAL.getTopMaterial();
}
public static BlockState findTopMaterial(Biome biome){
return findTopMaterial(BiomeAPI.getBiome(biome));
}
public static BlockState findTopMaterial(WorldGenLevel world, BlockPos pos){
return findTopMaterial(BiomeAPI.getBiome(world.getBiome(pos)));
}
public static BlockState findUnderMaterial(BCLBiome biome){
if (biome instanceof SurfaceMaterialProvider smp){
return smp.getTopMaterial();
}
return EndBiome.Config.DEFAULT_MATERIAL.getTopMaterial();
}
public static BlockState findUnderMaterial(WorldGenLevel world, BlockPos pos){
return findUnderMaterial(BiomeAPI.getBiome(world.getBiome(pos)));
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
@ -10,33 +13,43 @@ import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.EndBiome;
public class AmberLandBiome extends EndBiome.Config {
public AmberLandBiome() {
super("amber_land");
}
public AmberLandBiome() {
super("amber_land");
}
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.fogColor(255, 184, 71)
.fogDensity(2.0F)
.plantsColor(219, 115, 38)
.waterAndFogColor(145, 108, 72)
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_AMBER_LAND)
.particles(EndParticles.AMBER_SPHERE, 0.001F)
.surface(EndBlocks.AMBER_MOSS)
.feature(EndFeatures.AMBER_ORE)
.feature(EndFeatures.END_LAKE_RARE)
.feature(EndFeatures.HELIX_TREE)
.feature(EndFeatures.LANCELEAF)
.feature(EndFeatures.GLOW_PILLAR)
.feature(EndFeatures.AMBER_GRASS)
.feature(EndFeatures.AMBER_ROOT)
.feature(EndFeatures.BULB_MOSS)
.feature(EndFeatures.BULB_MOSS_WOOD)
.feature(EndFeatures.CHARNIA_ORANGE)
.feature(EndFeatures.CHARNIA_RED)
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 4)
.spawn(EndEntities.END_SLIME, 30, 1, 2);
}
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.fogColor(255, 184, 71)
.fogDensity(2.0F)
.plantsColor(219, 115, 38)
.waterAndFogColor(145, 108, 72)
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_AMBER_LAND)
.particles(EndParticles.AMBER_SPHERE, 0.001F)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.feature(EndFeatures.AMBER_ORE)
.feature(EndFeatures.END_LAKE_RARE)
.feature(EndFeatures.HELIX_TREE)
.feature(EndFeatures.LANCELEAF)
.feature(EndFeatures.GLOW_PILLAR)
.feature(EndFeatures.AMBER_GRASS)
.feature(EndFeatures.AMBER_ROOT)
.feature(EndFeatures.BULB_MOSS)
.feature(EndFeatures.BULB_MOSS_WOOD)
.feature(EndFeatures.CHARNIA_ORANGE)
.feature(EndFeatures.CHARNIA_RED)
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 4)
.spawn(EndEntities.END_SLIME, 30, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.AMBER_MOSS.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
@ -23,7 +26,7 @@ public class BlossomingSpiresBiome extends EndBiome.Config {
builder.fogColor(241, 146, 229)
.fogDensity(1.7F)
.plantsColor(122, 45, 122)
.surface(EndBlocks.PINK_MOSS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)
.feature(EndFeatures.SPIRE)
@ -40,4 +43,14 @@ public class BlossomingSpiresBiome extends EndBiome.Config {
.spawn(EntityType.ENDERMAN, 50, 1, 4)
.spawn(EndEntities.SILK_MOTH, 5, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.PINK_MOSS.defaultBlockState();
}
};
}
}

View file

@ -3,8 +3,11 @@ package ru.betterend.world.biome.land;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.data.worldgen.placement.EndPlacements;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraft.world.level.levelgen.SurfaceRules;
import ru.bclib.api.biomes.BCLBiomeBuilder;
import ru.bclib.api.biomes.SurfaceMaterialProvider;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
@ -22,7 +25,7 @@ public class ChorusForestBiome extends EndBiome.Config {
.fogDensity(1.5F)
.plantsColor(122, 45, 122)
.waterAndFogColor(73, 30, 73)
.surface(EndBlocks.CHORUS_NYLIUM)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.particles(ParticleTypes.PORTAL, 0.01F)
.loop(EndSounds.AMBIENT_CHORUS_FOREST)
.music(EndSounds.MUSIC_DARK)
@ -42,4 +45,14 @@ public class ChorusForestBiome extends EndBiome.Config {
.spawn(EndEntities.END_SLIME, 5, 1, 2)
.spawn(EntityType.ENDERMAN, 50, 1, 4);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.CHORUS_NYLIUM.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
@ -17,9 +20,19 @@ public class CrystalMountainsBiome extends EndBiome.Config {
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.structure(EndStructures.MOUNTAIN.getFeatureConfigured())
.plantsColor(255, 133, 211)
.surface(EndBlocks.CRYSTAL_MOSS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.music(EndSounds.MUSIC_OPENSPACE)
.feature(EndFeatures.CRYSTAL_GRASS)
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.CRYSTAL_MOSS.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
@ -21,7 +24,7 @@ public class DragonGraveyardsBiome extends EndBiome.Config {
.particles(EndParticles.FIREFLY, 0.0007F)
.music(EndSounds.MUSIC_OPENSPACE)
.loop(EndSounds.AMBIENT_GLOWING_GRASSLANDS)
.surface(EndBlocks.SANGNUM)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.waterAndFogColor(203, 59, 167)
.plantsColor(244, 46, 79)
.feature(EndFeatures.OBSIDIAN_PILLAR_BASEMENT)
@ -35,4 +38,14 @@ public class DragonGraveyardsBiome extends EndBiome.Config {
.feature(EndFeatures.CLAWFERN)
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.SANGNUM.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
@ -18,7 +21,7 @@ public class DryShrublandBiome extends EndBiome.Config {
.fogDensity(1.2F)
.waterAndFogColor(113, 88, 53)
.plantsColor(237, 122, 66)
.surface(EndBlocks.RUTISCUS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.music(EndSounds.MUSIC_OPENSPACE)
.feature(EndFeatures.LUCERNIA_BUSH_RARE)
.feature(EndFeatures.ORANGO)
@ -28,4 +31,14 @@ public class DryShrublandBiome extends EndBiome.Config {
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.RUTISCUS.defaultBlockState();
}
};
}
}

View file

@ -2,7 +2,10 @@ package ru.betterend.world.biome.land;
import net.minecraft.core.particles.ParticleTypes;
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;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.EndBiome;
@ -17,7 +20,7 @@ public class DustWastelandsBiome extends EndBiome.Config {
builder.fogColor(226, 239, 168)
.fogDensity(2)
.waterAndFogColor(192, 180, 131)
.surface(EndBlocks.ENDSTONE_DUST)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
//TODO: 1.18 removed
//.depth(1.5F)
.particles(ParticleTypes.WHITE_ASH, 0.01F)
@ -26,4 +29,14 @@ public class DustWastelandsBiome extends EndBiome.Config {
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.ENDSTONE_DUST.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,11 @@
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
@ -22,7 +26,11 @@ public class FoggyMushroomlandBiome extends EndBiome.Config {
.fogDensity(3)
.waterAndFogColor(119, 227, 250)
//TODO: 1.18 check surface Rules
.chancedSurface(END_MOSS, END_MYCELIUM, END_STONE)
.chancedSurface(
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
END_STONE
)
//.surface(EndBlocks.END_MOSS, EndBlocks.END_MYCELIUM)
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
.loop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)
@ -48,4 +56,21 @@ public class FoggyMushroomlandBiome extends EndBiome.Config {
.spawn(EndEntities.END_SLIME, 10, 1, 2)
.spawn(EntityType.ENDERMAN, 10, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.END_MOSS.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return EndBlocks.END_MYCELIUM.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
@ -20,7 +23,7 @@ public class GlowingGrasslandsBiome extends EndBiome.Config {
.particles(EndParticles.FIREFLY, 0.001F)
.music(EndSounds.MUSIC_OPENSPACE)
.loop(EndSounds.AMBIENT_GLOWING_GRASSLANDS)
.surface(EndBlocks.END_MOSS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.waterAndFogColor(92, 250, 230)
.plantsColor(73, 210, 209)
.feature(EndFeatures.END_LAKE_RARE)
@ -39,4 +42,14 @@ public class GlowingGrasslandsBiome extends EndBiome.Config {
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.END_MOSS.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
@ -19,7 +22,7 @@ public class LanternWoodsBiome extends EndBiome.Config {
.fogDensity(1.1F)
.waterAndFogColor(171, 234, 226)
.plantsColor(254, 85, 57)
.surface(EndBlocks.RUTISCUS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.music(EndSounds.MUSIC_FOREST)
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
.feature(EndFeatures.END_LAKE_NORMAL)
@ -39,4 +42,14 @@ public class LanternWoodsBiome extends EndBiome.Config {
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.RUTISCUS.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,11 @@
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
@ -23,7 +27,11 @@ public class MegalakeBiome extends EndBiome.Config {
.music(EndSounds.MUSIC_WATER)
.loop(EndSounds.AMBIENT_MEGALAKE)
//TODO: 1.18 check surface Rules
.chancedSurface(END_MOSS, ENDSTONE_DUST, END_STONE)
.chancedSurface(
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
END_STONE
)
//.surface(EndBlocks.END_MOSS, EndBlocks.ENDSTONE_DUST)
//TODO: 1.18 removed
//.depth(0F)
@ -44,4 +52,19 @@ public class MegalakeBiome extends EndBiome.Config {
.spawn(EndEntities.END_SLIME, 5, 1, 2)
.spawn(EntityType.ENDERMAN, 10, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.END_MOSS.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return EndBlocks.ENDSTONE_DUST.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
@ -25,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(EndBlocks.END_MOSS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
//TODO: 1.18 removed
//.depth(0F)
.feature(EndFeatures.LACUGROVE)
@ -46,4 +49,14 @@ public class MegalakeGroveBiome extends EndBiome.Config {
.spawn(EndEntities.END_SLIME, 5, 1, 2)
.spawn(EntityType.ENDERMAN, 10, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.END_MOSS.defaultBlockState();
}
};
}
}

View file

@ -2,7 +2,11 @@ package ru.betterend.world.biome.land;
import net.minecraft.core.particles.ParticleTypes;
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.EndBiome;
@ -19,7 +23,11 @@ public class NeonOasisBiome extends EndBiome.Config {
.fogDensity(2)
.waterAndFogColor(106, 238, 215)
//TODO: 1.18 check surface Rules
.chancedSurface(ENDSTONE_DUST, END_MOSS, END_STONE)
.chancedSurface(
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
END_STONE
)
//.surface(EndBlocks.ENDSTONE_DUST, EndBlocks.END_MOSS)
.particles(ParticleTypes.WHITE_ASH, 0.01F)
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
@ -34,4 +42,19 @@ public class NeonOasisBiome extends EndBiome.Config {
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.ENDSTONE_DUST.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return EndBlocks.END_MOSS.defaultBlockState();
}
};
}
}

View file

@ -2,7 +2,10 @@ package ru.betterend.world.biome.land;
import net.minecraft.core.particles.ParticleTypes;
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;
import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures;
@ -21,8 +24,18 @@ public class PaintedMountainsBiome extends EndBiome.Config {
.waterAndFogColor(192, 180, 131)
.music(EndSounds.MUSIC_OPENSPACE)
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
.surface(EndBlocks.ENDSTONE_DUST)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.particles(ParticleTypes.WHITE_ASH, 0.01F)
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.ENDSTONE_DUST.defaultBlockState();
}
};
}
}

View file

@ -2,7 +2,10 @@ package ru.betterend.world.biome.land;
import net.minecraft.core.particles.ParticleTypes;
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
@ -20,7 +23,7 @@ public class ShadowForestBiome extends EndBiome.Config {
.fogDensity(2.5F)
.plantsColor(45, 45, 45)
.waterAndFogColor(42, 45, 80)
.surface(EndBlocks.SHADOW_GRASS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.particles(ParticleTypes.MYCELIUM, 0.01F)
.loop(EndSounds.AMBIENT_CHORUS_FOREST)
.music(EndSounds.MUSIC_DARK)
@ -43,4 +46,14 @@ public class ShadowForestBiome extends EndBiome.Config {
.spawn(EntityType.ENDERMAN, 40, 1, 4)
.spawn(EntityType.PHANTOM, 1, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.SHADOW_GRASS.defaultBlockState();
}
};
}
}

View file

@ -1,8 +1,12 @@
package ru.betterend.world.biome.land;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.block.Blocks;
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;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
@ -27,8 +31,8 @@ public class SulphurSpringsBiome extends EndBiome.Config {
//.surface(SurfaceBuilders.SULPHURIC_SURFACE.configured(SurfaceBuilders.DEFAULT_END_CONFIG))
.surface(
SurfaceRules.sequence(
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(-0.6), END_STONE),
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(-0.3), FLAVOLITE),
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(-0.6), SurfaceRules.state(surfaceMaterial().getAltTopMaterial())),
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(-0.3), SurfaceRules.state(surfaceMaterial().getTopMaterial())),
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(0.5), SULPHURIC_ROCK),
BRIMSTONE
))
@ -53,4 +57,19 @@ public class SulphurSpringsBiome extends EndBiome.Config {
.spawn(EndEntities.CUBOZOA, 50, 3, 8)
.spawn(EntityType.ENDERMAN, 50, 1, 4);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.FLAVOLITE.stone.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return Blocks.END_STONE.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
package ru.betterend.world.biome.land;
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndSounds;
@ -23,11 +26,11 @@ public class UmbraValleyBiome extends EndBiome.Config {
.surface(
SurfaceRules.sequence(
SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.4), PALLIDIUM_FULL),
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.4), SurfaceRules.state(surfaceMaterial().getAltTopMaterial())),
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.15), PALLIDIUM_HEAVY),
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(-0.15), PALLIDIUM_THIN),
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(-0.4), PALLIDIUM_TINY)
)), UMBRALITH
)), SurfaceRules.state(surfaceMaterial().getTopMaterial())
)
)
.particles(EndParticles.AMBER_SPHERE, 0.0001F)
@ -38,4 +41,19 @@ public class UmbraValleyBiome extends EndBiome.Config {
.feature(EndFeatures.INFLEXIA)
.feature(EndFeatures.FLAMMALIX);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.UMBRALITH.stone.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return EndBlocks.PALLIDIUM_FULL.defaultBlockState();
}
};
}
}

View file

@ -1,7 +1,10 @@
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;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
@ -22,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(EndBlocks.JUNGLE_MOSS)
.surface(SurfaceRules.state(surfaceMaterial().getTopMaterial()))
.feature(EndFeatures.END_LAKE)
.feature(EndFeatures.UMBRELLA_TREE)
.feature(EndFeatures.JELLYSHROOM)
@ -43,4 +46,14 @@ public class UmbrellaJungleBiome extends EndBiome.Config {
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.JUNGLE_MOSS.defaultBlockState();
}
};
}
}

View file

@ -15,6 +15,7 @@ import ru.bclib.sdf.primitive.SDFCappedCone;
import ru.bclib.util.BlocksHelper;
import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.world.biome.EndBiome;
public class BiomeIslandFeature extends DefaultFeature {
private static final MutableBlockPos CENTER = new MutableBlockPos();
@ -31,7 +32,7 @@ public class BiomeIslandFeature extends DefaultFeature {
Biome biome = world.getBiome(pos);
int dist = BlocksHelper.downRay(world, pos, 10) + 1;
BlockPos surfacePos = new BlockPos(pos.getX(), pos.getY()-dist, pos.getZ());
BlockState topMaterial = world.getBlockState(surfacePos);
BlockState topMaterial = EndBiome.findTopMaterial(world, surfacePos);;
//TODO: 1.18 the block selection should be based on the surface rules of the biome
if (BlocksHelper.isFluid(topMaterial)) {
@ -39,8 +40,7 @@ public class BiomeIslandFeature extends DefaultFeature {
underBlock = Blocks.STONE.defaultBlockState();
}
else {
topBlock = topMaterial.is(Blocks.AIR)?Blocks.GRASS_BLOCK.defaultBlockState():topMaterial;
underBlock = Blocks.DIRT.defaultBlockState();
underBlock = EndBiome.findUnderMaterial(world, surfacePos);
}
simplexNoise = new OpenSimplexNoise(world.getSeed());

View file

@ -18,6 +18,7 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.EndBiome;
public class DesertLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
@ -124,7 +125,7 @@ public class DesertLakeFeature extends DefaultFeature {
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
state = EndBiome.findTopMaterial(world, pos); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(
@ -197,7 +198,7 @@ public class DesertLakeFeature extends DefaultFeature {
else if (y < waterLevel) {
if (world.isEmptyBlock(POS.above())) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
state = EndBiome.findTopMaterial(world, pos); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(
world,
POS,

View file

@ -18,11 +18,16 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.EndBiome;
public class EndLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
private static final MutableBlockPos POS = new MutableBlockPos();
public EndLakeFeature(){
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
@ -124,8 +129,8 @@ public class EndLakeFeature extends DefaultFeature {
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
// state = world.getBiome(pos)
state = EndBiome.findTopMaterial(world, pos);
//state = world.getBiome(pos)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
@ -196,7 +201,7 @@ public class EndLakeFeature extends DefaultFeature {
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
if (world.isEmptyBlock(POS.above())) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
state = EndBiome.findTopMaterial(world, pos);
// state = world.getBiome(POS)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()

View file

@ -21,6 +21,7 @@ import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import ru.betterend.world.biome.EndBiome;
public class FloatingSpireFeature extends SpireFeature {
@Override
@ -65,11 +66,11 @@ public class FloatingSpireFeature extends SpireFeature {
support.add(info.getPos().above());
}
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();//world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
return EndBiome.findTopMaterial(world, info.getPos());//world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
return EndBiome.findUnderMaterial(world, info.getPos());
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()

View file

@ -29,6 +29,7 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import ru.betterend.world.biome.EndBiome;
public class SpireFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE;
@ -68,12 +69,12 @@ public class SpireFeature extends DefaultFeature {
support.add(info.getPos().above());
}
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
return EndBiome.findTopMaterial(world, info.getPos());
//return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
return EndBiome.findUnderMaterial(world, info.getPos());
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()

View file

@ -5,7 +5,6 @@ import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureFeatureManager;
@ -20,9 +19,11 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import ru.betterend.world.biome.EndBiome;
public class CrystalMountainPiece extends MountainPiece {
private BlockState top;
@ -30,7 +31,7 @@ public class CrystalMountainPiece extends MountainPiece {
public CrystalMountainPiece(BlockPos center, float radius, float height, Random random, Biome biome) {
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
//TODO: 1.18 this needs to change to a dynamic block
top = Blocks.END_STONE.defaultBlockState(); //biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
top = EndBiome.findTopMaterial(biome); //biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
public CrystalMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
@ -40,7 +41,7 @@ public class CrystalMountainPiece extends MountainPiece {
@Override
protected void fromNbt(CompoundTag tag) {
super.fromNbt(tag);//TODO: 1.18 this needs to change to a dynamic block
top = Blocks.END_STONE.defaultBlockState(); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
top = EndBiome.findTopMaterial(BiomeAPI.getBiome(biomeID)); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
@Override

View file

@ -32,6 +32,7 @@ import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import ru.betterend.world.biome.EndBiome;
public class LakePiece extends BasePiece {
private static final BlockState ENDSTONE = Blocks.END_STONE.defaultBlockState();
@ -133,7 +134,7 @@ public class LakePiece extends BasePiece {
state = chunk.getBlockState(mut.above());
if (state.isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
state = ENDSTONE;
state = EndBiome.findTopMaterial(world, worldPos);
// state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
@ -170,7 +171,7 @@ public class LakePiece extends BasePiece {
BlockState bState = chunk.getBlockState(mut);
if (bState.isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
bState = ENDSTONE;
bState = EndBiome.findTopMaterial(world, mut.offset(sx, 0, sz));
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
@ -194,7 +195,7 @@ public class LakePiece extends BasePiece {
BlockState bState = chunk.getBlockState(mut);
if (bState.isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
bState = ENDSTONE;
bState =EndBiome.findTopMaterial(world, mut.offset(sx, 0, sz));
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
// .getGenerationSettings()
// .getSurfaceBuilderConfig()