Migration to BCLib Biome API (WIP)
This commit is contained in:
parent
0b336febd8
commit
19b175f788
101 changed files with 344 additions and 1497 deletions
|
@ -1,235 +1,20 @@
|
|||
package ru.betterend.world.biome;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.Musics;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome.BiomeCategory;
|
||||
import net.minecraft.world.level.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.level.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects.Builder;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Carving;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.ProbabilityFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
||||
import ru.bclib.util.ColorUtil;
|
||||
import ru.bclib.world.biomes.BCLBiomeDef;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.features.EndFeature;
|
||||
import ru.betterend.world.structures.EndStructureFeature;
|
||||
import ru.betterend.world.surface.DoubleBlockSurfaceBuilder;
|
||||
import ru.betterend.world.surface.SurfaceBuilders;
|
||||
|
||||
public class BiomeDefinition {
|
||||
private static final int DEF_FOLIAGE = ColorUtil.color(197, 210, 112);
|
||||
|
||||
private final List<ConfiguredStructureFeature<?, ?>> structures = Lists.newArrayList();
|
||||
private final List<FeatureInfo> features = Lists.newArrayList();
|
||||
private final List<CarverInfo> carvers = Lists.newArrayList();
|
||||
private final List<SpawnInfo> mobs = Lists.newArrayList();
|
||||
private final List<SpawnerData> spawns = Lists.newArrayList();
|
||||
|
||||
private AmbientParticleSettings particleConfig;
|
||||
private AmbientAdditionsSettings additions;
|
||||
private AmbientMoodSettings mood;
|
||||
private SoundEvent music;
|
||||
private SoundEvent loop;
|
||||
|
||||
private int waterFogColor = 329011;
|
||||
private int waterColor = 4159204;
|
||||
private int fogColor = 10518688;
|
||||
private int foliageColor = DEF_FOLIAGE;
|
||||
private int grassColor = DEF_FOLIAGE;
|
||||
private float fogDensity = 1F;
|
||||
private float depth = 0.1F;
|
||||
|
||||
private final ResourceLocation id;
|
||||
private float genChance = 1F;
|
||||
public class BiomeDefinition extends BCLBiomeDef {
|
||||
private boolean hasCaves = true;
|
||||
private boolean isCaveBiome = false;
|
||||
private float temperature = 1F;
|
||||
|
||||
private ConfiguredSurfaceBuilder<?> surface;
|
||||
|
||||
public BiomeDefinition(String name) {
|
||||
this.id = BetterEnd.makeID(name);
|
||||
super(BetterEnd.makeID(name));
|
||||
this.endBiome();
|
||||
}
|
||||
|
||||
public BiomeDefinition setCaveBiome() {
|
||||
isCaveBiome = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setSurface(Block block) {
|
||||
setSurface(SurfaceBuilder.DEFAULT.configured(new SurfaceBuilderBaseConfiguration(
|
||||
block.defaultBlockState(),
|
||||
Blocks.END_STONE.defaultBlockState(),
|
||||
Blocks.END_STONE.defaultBlockState()
|
||||
)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setSurface(Block block1, Block block2) {
|
||||
setSurface(DoubleBlockSurfaceBuilder.register("be_" + id.getPath() + "_surface").setBlock1(block1).setBlock2(block2).configured());
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setSurface(ConfiguredSurfaceBuilder<?> builder) {
|
||||
this.surface = builder;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setSurface(SurfaceBuilder<SurfaceBuilderBaseConfiguration> builder) {
|
||||
return setSurface(builder.configured(SurfaceBuilders.DEFAULT_END_CONFIG));
|
||||
}
|
||||
|
||||
public BiomeDefinition setParticles(ParticleOptions particle, float probability) {
|
||||
this.particleConfig = new AmbientParticleSettings(particle, probability);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setGenChance(float genChance) {
|
||||
this.genChance = genChance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setDepth(float depth) {
|
||||
this.depth = depth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setTemperature(float temperature) {
|
||||
this.temperature = temperature;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition addMobSpawn(EntityType<?> type, int weight, int minGroupSize, int maxGroupSize) {
|
||||
ResourceLocation eID = Registry.ENTITY_TYPE.getKey(type);
|
||||
if (eID != Registry.ENTITY_TYPE.getDefaultKey()) {
|
||||
SpawnInfo info = new SpawnInfo();
|
||||
info.type = type;
|
||||
info.weight = weight;
|
||||
info.minGroupSize = minGroupSize;
|
||||
info.maxGroupSize = maxGroupSize;
|
||||
mobs.add(info);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition addMobSpawn(SpawnerData entry) {
|
||||
spawns.add(entry);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition addStructureFeature(ConfiguredStructureFeature<?, ?> feature) {
|
||||
structures.add(feature);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition addStructureFeature(EndStructureFeature feature) {
|
||||
structures.add(feature.getFeatureConfigured());
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition addFeature(EndFeature feature) {
|
||||
FeatureInfo info = new FeatureInfo();
|
||||
info.featureStep = feature.getFeatureStep();
|
||||
info.feature = feature.getFeatureConfigured();
|
||||
features.add(info);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition addFeature(Decoration featureStep, ConfiguredFeature<?, ?> feature) {
|
||||
FeatureInfo info = new FeatureInfo();
|
||||
info.featureStep = featureStep;
|
||||
info.feature = feature;
|
||||
features.add(info);
|
||||
return this;
|
||||
}
|
||||
|
||||
private int getColor(int r, int g, int b) {
|
||||
r = Mth.clamp(r, 0, 255);
|
||||
g = Mth.clamp(g, 0, 255);
|
||||
b = Mth.clamp(b, 0, 255);
|
||||
return ColorUtil.color(r, g, b);
|
||||
}
|
||||
|
||||
public BiomeDefinition setFogColor(int r, int g, int b) {
|
||||
this.fogColor = getColor(r, g, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setFogDensity(float density) {
|
||||
this.fogDensity = density;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setWaterColor(int r, int g, int b) {
|
||||
this.waterColor = getColor(r, g, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setWaterFogColor(int r, int g, int b) {
|
||||
this.waterFogColor = getColor(r, g, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setWaterAndFogColor(int r, int g, int b) {
|
||||
return setWaterColor(r, g, b).setWaterFogColor(r, g, b);
|
||||
}
|
||||
|
||||
public BiomeDefinition setFoliageColor(int r, int g, int b) {
|
||||
this.foliageColor = getColor(r, g, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setGrassColor(int r, int g, int b) {
|
||||
this.grassColor = getColor(r, g, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setPlantsColor(int r, int g, int b) {
|
||||
return this.setFoliageColor(r, g, b).setGrassColor(r, g, b);
|
||||
}
|
||||
|
||||
public BiomeDefinition setLoop(SoundEvent loop) {
|
||||
this.loop = loop;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setMood(SoundEvent mood) {
|
||||
this.mood = new AmbientMoodSettings(mood, 6000, 8, 2.0D);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setAdditions(SoundEvent additions) {
|
||||
this.additions = new AmbientAdditionsSettings(additions, 0.0111);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setMusic(SoundEvent music) {
|
||||
this.music = music;
|
||||
this.setCategory(BiomeCategory.NONE);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -238,83 +23,11 @@ public class BiomeDefinition {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Biome build() {
|
||||
MobSpawnSettings.Builder spawnSettings = new MobSpawnSettings.Builder();
|
||||
BiomeGenerationSettings.Builder generationSettings = new BiomeGenerationSettings.Builder();
|
||||
Builder effects = new Builder();
|
||||
|
||||
mobs.forEach((spawn) -> {
|
||||
spawnSettings.addSpawn(spawn.type.getCategory(), new MobSpawnSettings.SpawnerData(spawn.type, spawn.weight, spawn.minGroupSize, spawn.maxGroupSize));
|
||||
});
|
||||
|
||||
spawns.forEach((entry) -> {
|
||||
spawnSettings.addSpawn(entry.type.getCategory(), entry);
|
||||
});
|
||||
|
||||
EndFeatures.addDefaultFeatures(this);
|
||||
generationSettings.surfaceBuilder(surface == null ? net.minecraft.data.worldgen.SurfaceBuilders.END : surface);
|
||||
structures.forEach((structure) -> generationSettings.addStructureStart(structure));
|
||||
features.forEach((info) -> generationSettings.addFeature(info.featureStep, info.feature));
|
||||
carvers.forEach((info) -> generationSettings.addCarver(info.carverStep, info.carver));
|
||||
|
||||
effects.skyColor(0).waterColor(waterColor).waterFogColor(waterFogColor).fogColor(fogColor).foliageColorOverride(foliageColor).grassColorOverride(grassColor);
|
||||
if (loop != null) effects.ambientLoopSound(loop);
|
||||
if (mood != null) effects.ambientMoodSound(mood);
|
||||
if (additions != null) effects.ambientAdditionsSound(additions);
|
||||
if (particleConfig != null) effects.ambientParticle(particleConfig);
|
||||
effects.backgroundMusic(music != null ? new Music(music, 600, 2400, true) : Musics.END);
|
||||
|
||||
return new Biome.BiomeBuilder()
|
||||
.precipitation(Precipitation.NONE)
|
||||
.biomeCategory(isCaveBiome ? BiomeCategory.NONE : BiomeCategory.THEEND)
|
||||
.depth(depth)
|
||||
.scale(0.2F)
|
||||
.temperature(temperature)
|
||||
.downfall(0.0F)
|
||||
.specialEffects(effects.build())
|
||||
.mobSpawnSettings(spawnSettings.build())
|
||||
.generationSettings(generationSettings.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
private static final class SpawnInfo {
|
||||
EntityType<?> type;
|
||||
int weight;
|
||||
int minGroupSize;
|
||||
int maxGroupSize;
|
||||
}
|
||||
|
||||
private static final class FeatureInfo {
|
||||
Decoration featureStep;
|
||||
ConfiguredFeature<?, ?> feature;
|
||||
}
|
||||
|
||||
private static final class CarverInfo {
|
||||
Carving carverStep;
|
||||
ConfiguredWorldCarver<ProbabilityFeatureConfiguration> carver;
|
||||
}
|
||||
|
||||
public ResourceLocation getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public float getFodDensity() {
|
||||
return fogDensity;
|
||||
}
|
||||
|
||||
public float getGenChance() {
|
||||
return genChance;
|
||||
}
|
||||
|
||||
public boolean hasCaves() {
|
||||
return hasCaves;
|
||||
}
|
||||
|
||||
public BiomeDefinition addCarver(Carving carverStep, ConfiguredWorldCarver<ProbabilityFeatureConfiguration> carver) {
|
||||
CarverInfo info = new CarverInfo();
|
||||
info.carverStep = carverStep;
|
||||
info.carver = carver;
|
||||
carvers.add(info);
|
||||
return this;
|
||||
public BCLBiomeDef addStructureFeature(EndStructureFeature structure) {
|
||||
return addStructureFeature(structure.getFeatureConfigured());
|
||||
}
|
||||
}
|
|
@ -1,211 +1,24 @@
|
|||
package ru.betterend.world.biome;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import ru.bclib.util.JsonFactory;
|
||||
import ru.bclib.util.StructureHelper;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.world.features.EndFeature;
|
||||
import ru.betterend.world.features.ListFeature;
|
||||
import ru.betterend.world.features.ListFeature.StructureInfo;
|
||||
import ru.betterend.world.features.NBTStructureFeature.TerrainMerge;
|
||||
|
||||
public class EndBiome {
|
||||
protected List<EndBiome> subbiomes = Lists.newArrayList();
|
||||
|
||||
protected final Biome biome;
|
||||
protected final ResourceLocation mcID;
|
||||
protected EndBiome edge;
|
||||
protected int edgeSize;
|
||||
|
||||
protected EndBiome biomeParent;
|
||||
protected float maxSubBiomeChance = 1;
|
||||
protected final float genChanceUnmutable;
|
||||
protected float genChance = 1;
|
||||
|
||||
private final float fogDensity;
|
||||
public class EndBiome extends BCLBiome {
|
||||
private final boolean hasCaves;
|
||||
private EndFeature structuresFeature;
|
||||
private Biome actualBiome;
|
||||
|
||||
|
||||
public EndBiome(BiomeDefinition definition) {
|
||||
this.mcID = definition.getID();
|
||||
this.readStructureList();
|
||||
if (structuresFeature != null) {
|
||||
definition.addFeature(structuresFeature);
|
||||
}
|
||||
this.biome = definition.build();
|
||||
this.fogDensity = Configs.BIOME_CONFIG.getFloat(mcID, "fog_density", definition.getFodDensity());
|
||||
this.genChanceUnmutable = Configs.BIOME_CONFIG.getFloat(mcID, "generation_chance", definition.getGenChance());
|
||||
super(definition.loadConfigValues(Configs.BIOME_CONFIG));
|
||||
this.hasCaves = Configs.BIOME_CONFIG.getBoolean(mcID, "has_caves", definition.hasCaves());
|
||||
this.edgeSize = Configs.BIOME_CONFIG.getInt(mcID, "edge_size", 32);
|
||||
}
|
||||
|
||||
public EndBiome(ResourceLocation id, Biome biome, float fogDensity, float genChance, boolean hasCaves) {
|
||||
this.mcID = id;
|
||||
this.readStructureList();
|
||||
this.biome = biome;
|
||||
this.fogDensity = Configs.BIOME_CONFIG.getFloat(mcID, "fog_density", fogDensity);
|
||||
this.genChanceUnmutable = Configs.BIOME_CONFIG.getFloat(mcID, "generation_chance", genChance);
|
||||
super(id, biome, fogDensity, genChance);
|
||||
this.hasCaves = Configs.BIOME_CONFIG.getBoolean(mcID, "has_caves", hasCaves);
|
||||
this.edgeSize = Configs.BIOME_CONFIG.getInt(mcID, "edge_size", 32);
|
||||
}
|
||||
|
||||
public EndBiome getEdge() {
|
||||
return edge == null ? this : edge;
|
||||
}
|
||||
|
||||
public void setEdge(EndBiome edge) {
|
||||
this.edge = edge;
|
||||
edge.biomeParent = this;
|
||||
}
|
||||
|
||||
public int getEdgeSize() {
|
||||
return edgeSize;
|
||||
}
|
||||
|
||||
public void setEdgeSize(int size) {
|
||||
edgeSize = size;
|
||||
}
|
||||
|
||||
public void addSubBiome(EndBiome biome) {
|
||||
maxSubBiomeChance += biome.mutateGenChance(maxSubBiomeChance);
|
||||
biome.biomeParent = this;
|
||||
subbiomes.add(biome);
|
||||
}
|
||||
|
||||
public boolean containsSubBiome(EndBiome biome) {
|
||||
return subbiomes.contains(biome);
|
||||
}
|
||||
|
||||
public EndBiome getSubBiome(Random random) {
|
||||
float chance = random.nextFloat() * maxSubBiomeChance;
|
||||
for (EndBiome biome : subbiomes)
|
||||
if (biome.canGenerate(chance))
|
||||
return biome;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EndBiome getParentBiome() {
|
||||
return this.biomeParent;
|
||||
}
|
||||
|
||||
public boolean hasEdge() {
|
||||
return edge != null;
|
||||
}
|
||||
|
||||
public boolean hasParentBiome() {
|
||||
return biomeParent != null;
|
||||
}
|
||||
|
||||
public boolean isSame(EndBiome biome) {
|
||||
return biome == this || (biome.hasParentBiome() && biome.getParentBiome() == this);
|
||||
}
|
||||
|
||||
public boolean canGenerate(float chance) {
|
||||
return chance <= this.genChance;
|
||||
}
|
||||
|
||||
public float mutateGenChance(float chance) {
|
||||
genChance = genChanceUnmutable;
|
||||
genChance += chance;
|
||||
return genChance;
|
||||
}
|
||||
|
||||
public Biome getBiome() {
|
||||
return biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mcID.toString();
|
||||
}
|
||||
|
||||
public ResourceLocation getID() {
|
||||
return mcID;
|
||||
}
|
||||
|
||||
public float getFogDensity() {
|
||||
return fogDensity;
|
||||
}
|
||||
|
||||
protected void readStructureList() {
|
||||
String ns = mcID.getNamespace();
|
||||
String nm = mcID.getPath();
|
||||
|
||||
String path = "/data/" + ns + "/structures/biome/" + nm + "/";
|
||||
InputStream inputstream = StructureHelper.class.getResourceAsStream(path + "structures.json");
|
||||
if (inputstream != null) {
|
||||
JsonObject obj = JsonFactory.getJsonObject(inputstream);
|
||||
JsonArray enties = obj.getAsJsonArray("structures");
|
||||
if (enties != null) {
|
||||
List<StructureInfo> list = Lists.newArrayList();
|
||||
enties.forEach((entry) -> {
|
||||
JsonObject e = entry.getAsJsonObject();
|
||||
String structure = path + e.get("nbt").getAsString() + ".nbt";
|
||||
TerrainMerge terrainMerge = TerrainMerge.getFromString(e.get("terrainMerge").getAsString());
|
||||
int offsetY = e.get("offsetY").getAsInt();
|
||||
list.add(new StructureInfo(structure, offsetY, terrainMerge));
|
||||
});
|
||||
if (!list.isEmpty()) {
|
||||
structuresFeature = EndFeature.makeChansedFeature(nm + "_structures", new ListFeature(list), 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EndFeature getStructuresFeature() {
|
||||
return structuresFeature;
|
||||
}
|
||||
|
||||
public Biome getActualBiome() {
|
||||
return this.actualBiome;
|
||||
}
|
||||
|
||||
public float getGenChance() {
|
||||
return this.genChance;
|
||||
}
|
||||
|
||||
public float getGenChanceImmutable() {
|
||||
return this.genChanceUnmutable;
|
||||
}
|
||||
|
||||
public boolean hasCaves() {
|
||||
return hasCaves;
|
||||
}
|
||||
|
||||
public void updateActualBiomes(Registry<Biome> biomeRegistry) {
|
||||
subbiomes.forEach((sub) -> {
|
||||
if (sub != this) {
|
||||
sub.updateActualBiomes(biomeRegistry);
|
||||
}
|
||||
});
|
||||
if (edge != null && edge != this) {
|
||||
edge.updateActualBiomes(biomeRegistry);
|
||||
}
|
||||
this.actualBiome = biomeRegistry.get(mcID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
EndBiome biome = (EndBiome) obj;
|
||||
return biome == null ? false : biome.mcID.equals(mcID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mcID.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class BiomeIceStarfield extends EndBiome {
|
||||
public BiomeIceStarfield() {
|
||||
super(new BiomeDefinition("ice_starfield")
|
||||
super((BiomeDefinition) new BiomeDefinition("ice_starfield")
|
||||
.setCaves(false)
|
||||
.addStructureFeature(EndStructures.GIANT_ICE_STAR)
|
||||
.setFogColor(224, 245, 254)
|
||||
.setTemperature(0F)
|
||||
.setFogDensity(2.2F)
|
||||
.setFoliageColor(193, 244, 244)
|
||||
.setGenChance(0.25F)
|
||||
.setCaves(false)
|
||||
.setParticles(EndParticles.SNOWFLAKE, 0.002F)
|
||||
.addStructureFeature(EndStructures.GIANT_ICE_STAR)
|
||||
.addFeature(EndFeatures.ICE_STAR)
|
||||
.addFeature(EndFeatures.ICE_STAR_SMALL)
|
||||
.addMobSpawn(EntityType.ENDERMAN, 20, 1, 4));
|
||||
|
|
|
@ -6,7 +6,7 @@ import ru.betterend.world.biome.BiomeDefinition;
|
|||
|
||||
public class EmptyAuroraCaveBiome extends EndCaveBiome {
|
||||
public EmptyAuroraCaveBiome() {
|
||||
super(new BiomeDefinition("empty_aurora_cave")
|
||||
super((BiomeDefinition) new BiomeDefinition("empty_aurora_cave")
|
||||
.setFogColor(150, 30, 68)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(108, 25, 46)
|
||||
|
|
|
@ -5,7 +5,7 @@ import ru.betterend.world.biome.BiomeDefinition;
|
|||
|
||||
public class EmptyEndCaveBiome extends EndCaveBiome {
|
||||
public EmptyEndCaveBiome() {
|
||||
super(new BiomeDefinition("empty_end_cave").setFogDensity(2.0F));
|
||||
super((BiomeDefinition) new BiomeDefinition("empty_end_cave").setFogDensity(2.0F));
|
||||
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE, 1);
|
||||
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE, 1);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import ru.betterend.world.biome.BiomeDefinition;
|
|||
|
||||
public class EmptySmaragdantCaveBiome extends EndCaveBiome {
|
||||
public EmptySmaragdantCaveBiome() {
|
||||
super(new BiomeDefinition("empty_smaragdant_cave")
|
||||
super((BiomeDefinition) new BiomeDefinition("empty_smaragdant_cave")
|
||||
.setFogColor(0, 253, 182)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(0, 131, 145)
|
||||
|
|
|
@ -6,11 +6,12 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.world.entity.ai.behavior.WeightedList;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.world.features.BCLFeature;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.features.EndFeature;
|
||||
import ru.betterend.world.features.terrain.caves.CaveChunkPopulatorFeature;
|
||||
|
||||
public class EndCaveBiome extends EndBiome {
|
||||
|
@ -22,11 +23,11 @@ public class EndCaveBiome extends EndBiome {
|
|||
}
|
||||
|
||||
private static BiomeDefinition makeDef(BiomeDefinition definition) {
|
||||
EndFeature feature = EndFeature.makeChunkFeature(
|
||||
definition.getID().getPath() + "_cave_populator",
|
||||
new CaveChunkPopulatorFeature(() -> (EndCaveBiome) EndBiomes.getBiome(definition.getID()))
|
||||
BCLFeature feature = BCLFeature.makeChunkFeature(
|
||||
BetterEnd.makeID(definition.getID().getPath() + "_cave_populator"),
|
||||
new CaveChunkPopulatorFeature(() -> (EndCaveBiome) BiomeAPI.getBiome(definition.getID()))
|
||||
);
|
||||
definition.addFeature(feature).setCaveBiome();
|
||||
definition.setCaveBiome().addFeature(feature);
|
||||
definition.setMusic(EndSounds.MUSIC_CAVES);
|
||||
definition.setLoop(EndSounds.AMBIENT_CAVES);
|
||||
return definition;
|
||||
|
|
|
@ -13,7 +13,7 @@ public class JadeCaveBiome extends EndCaveBiome {
|
|||
private static final BlockState[] JADE = new BlockState[3];
|
||||
|
||||
public JadeCaveBiome() {
|
||||
super(new BiomeDefinition("jade_cave")
|
||||
super((BiomeDefinition) new BiomeDefinition("jade_cave")
|
||||
.setFogColor(118, 150, 112)
|
||||
.setFogDensity(2.0F)
|
||||
.setWaterAndFogColor(95, 223, 255)
|
||||
|
|
|
@ -11,7 +11,7 @@ import ru.betterend.world.biome.BiomeDefinition;
|
|||
|
||||
public class LushAuroraCaveBiome extends EndCaveBiome {
|
||||
public LushAuroraCaveBiome() {
|
||||
super(new BiomeDefinition("lush_aurora_cave")
|
||||
super((BiomeDefinition) new BiomeDefinition("lush_aurora_cave")
|
||||
.setFogColor(150, 30, 68)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(108, 25, 46)
|
||||
|
|
|
@ -7,7 +7,7 @@ import ru.betterend.world.biome.BiomeDefinition;
|
|||
|
||||
public class LushSmaragdantCaveBiome extends EndCaveBiome {
|
||||
public LushSmaragdantCaveBiome() {
|
||||
super(new BiomeDefinition("lush_smaragdant_cave")
|
||||
super((BiomeDefinition) new BiomeDefinition("lush_smaragdant_cave")
|
||||
.setFogColor(0, 253, 182)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(0, 131, 145)
|
||||
|
|
|
@ -12,7 +12,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class AmberLandBiome extends EndBiome {
|
||||
public AmberLandBiome() {
|
||||
super(new BiomeDefinition("amber_land")
|
||||
super((BiomeDefinition) new BiomeDefinition("amber_land")
|
||||
.setFogColor(255, 184, 71)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(219, 115, 38)
|
||||
|
|
|
@ -10,11 +10,11 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class BlossomingSpiresBiome extends EndBiome {
|
||||
public BlossomingSpiresBiome() {
|
||||
super(new BiomeDefinition("blossoming_spires")
|
||||
super((BiomeDefinition) new BiomeDefinition("blossoming_spires")
|
||||
.setCaves(false)
|
||||
.setFogColor(241, 146, 229)
|
||||
.setFogDensity(1.7F)
|
||||
.setPlantsColor(122, 45, 122)
|
||||
.setCaves(false)
|
||||
.setSurface(EndBlocks.PINK_MOSS)
|
||||
.setMusic(EndSounds.MUSIC_FOREST)
|
||||
.setLoop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)
|
||||
|
|
|
@ -14,7 +14,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class ChorusForestBiome extends EndBiome {
|
||||
public ChorusForestBiome() {
|
||||
super(new BiomeDefinition("chorus_forest")
|
||||
super((BiomeDefinition) new BiomeDefinition("chorus_forest")
|
||||
.setFogColor(87, 26, 87)
|
||||
.setFogDensity(1.5F)
|
||||
.setPlantsColor(122, 45, 122)
|
||||
|
|
|
@ -10,11 +10,11 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class CrystalMountainsBiome extends EndBiome {
|
||||
public CrystalMountainsBiome() {
|
||||
super(new BiomeDefinition("crystal_mountains")
|
||||
super((BiomeDefinition) new BiomeDefinition("crystal_mountains")
|
||||
.addStructureFeature(EndStructures.MOUNTAIN)
|
||||
.setPlantsColor(255, 133, 211)
|
||||
.setSurface(EndBlocks.CRYSTAL_MOSS)
|
||||
.setMusic(EndSounds.MUSIC_OPENSPACE)
|
||||
.addStructureFeature(EndStructures.MOUNTAIN)
|
||||
.addFeature(EndFeatures.ROUND_CAVE)
|
||||
.addFeature(EndFeatures.CRYSTAL_GRASS)
|
||||
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
|
||||
|
|
|
@ -10,7 +10,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class DragonGraveyardsBiome extends EndBiome {
|
||||
public DragonGraveyardsBiome() {
|
||||
super(new BiomeDefinition("dragon_graveyards")
|
||||
super((BiomeDefinition) new BiomeDefinition("dragon_graveyards")
|
||||
.setGenChance(0.1F)
|
||||
.setFogColor(244, 46, 79)
|
||||
.setFogDensity(1.3F)
|
||||
|
|
|
@ -10,7 +10,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class DryShrublandBiome extends EndBiome {
|
||||
public DryShrublandBiome() {
|
||||
super(new BiomeDefinition("dry_shrubland")
|
||||
super((BiomeDefinition) new BiomeDefinition("dry_shrubland")
|
||||
.setFogColor(132, 35, 13)
|
||||
.setFogDensity(1.2F)
|
||||
.setWaterAndFogColor(113, 88, 53)
|
||||
|
|
|
@ -10,7 +10,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class DustWastelandsBiome extends EndBiome {
|
||||
public DustWastelandsBiome() {
|
||||
super(new BiomeDefinition("dust_wastelands")
|
||||
super((BiomeDefinition) new BiomeDefinition("dust_wastelands")
|
||||
.setFogColor(226, 239, 168)
|
||||
.setFogDensity(2)
|
||||
.setWaterAndFogColor(192, 180, 131)
|
||||
|
|
|
@ -13,7 +13,8 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class FoggyMushroomlandBiome extends EndBiome {
|
||||
public FoggyMushroomlandBiome() {
|
||||
super(new BiomeDefinition("foggy_mushroomland")
|
||||
super((BiomeDefinition) new BiomeDefinition("foggy_mushroomland")
|
||||
.addStructureFeature(EndStructures.GIANT_MOSSY_GLOWSHROOM)
|
||||
.setPlantsColor(73, 210, 209)
|
||||
.setFogColor(41, 122, 173)
|
||||
.setFogDensity(3)
|
||||
|
@ -22,7 +23,6 @@ public class FoggyMushroomlandBiome extends EndBiome {
|
|||
.setParticles(EndParticles.GLOWING_SPHERE, 0.001F)
|
||||
.setLoop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)
|
||||
.setMusic(EndSounds.MUSIC_FOREST)
|
||||
.addStructureFeature(EndStructures.GIANT_MOSSY_GLOWSHROOM)
|
||||
.addFeature(EndFeatures.END_LAKE)
|
||||
.addFeature(EndFeatures.MOSSY_GLOWSHROOM)
|
||||
.addFeature(EndFeatures.BLUE_VINE)
|
||||
|
|
|
@ -11,7 +11,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class GlowingGrasslandsBiome extends EndBiome {
|
||||
public GlowingGrasslandsBiome() {
|
||||
super(new BiomeDefinition("glowing_grasslands")
|
||||
super((BiomeDefinition) new BiomeDefinition("glowing_grasslands")
|
||||
.setFogColor(99, 228, 247)
|
||||
.setFogDensity(1.3F)
|
||||
.setParticles(EndParticles.FIREFLY, 0.001F)
|
||||
|
|
|
@ -11,7 +11,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class LanternWoodsBiome extends EndBiome {
|
||||
public LanternWoodsBiome() {
|
||||
super(new BiomeDefinition("lantern_woods")
|
||||
super((BiomeDefinition) new BiomeDefinition("lantern_woods")
|
||||
.setFogColor(189, 82, 70)
|
||||
.setFogDensity(1.1F)
|
||||
.setWaterAndFogColor(171, 234, 226)
|
||||
|
|
|
@ -11,7 +11,8 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class MegalakeBiome extends EndBiome {
|
||||
public MegalakeBiome() {
|
||||
super(new BiomeDefinition("megalake")
|
||||
super((BiomeDefinition) new BiomeDefinition("megalake")
|
||||
.addStructureFeature(EndStructures.MEGALAKE)
|
||||
.setPlantsColor(73, 210, 209)
|
||||
.setFogColor(178, 209, 248)
|
||||
.setWaterAndFogColor(96, 163, 255)
|
||||
|
@ -20,7 +21,6 @@ public class MegalakeBiome extends EndBiome {
|
|||
.setLoop(EndSounds.AMBIENT_MEGALAKE)
|
||||
.setSurface(EndBlocks.END_MOSS, EndBlocks.ENDSTONE_DUST)
|
||||
.setDepth(0F)
|
||||
.addStructureFeature(EndStructures.MEGALAKE)
|
||||
.addFeature(EndFeatures.END_LOTUS)
|
||||
.addFeature(EndFeatures.END_LOTUS_LEAF)
|
||||
.addFeature(EndFeatures.BUBBLE_CORAL_RARE)
|
||||
|
|
|
@ -12,7 +12,8 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class MegalakeGroveBiome extends EndBiome {
|
||||
public MegalakeGroveBiome() {
|
||||
super(new BiomeDefinition("megalake_grove")
|
||||
super((BiomeDefinition) new BiomeDefinition("megalake_grove")
|
||||
.addStructureFeature(EndStructures.MEGALAKE_SMALL)
|
||||
.setPlantsColor(73, 210, 209)
|
||||
.setFogColor(178, 209, 248)
|
||||
.setWaterAndFogColor(96, 163, 255)
|
||||
|
@ -22,7 +23,6 @@ public class MegalakeGroveBiome extends EndBiome {
|
|||
.setLoop(EndSounds.AMBIENT_MEGALAKE_GROVE)
|
||||
.setSurface(EndBlocks.END_MOSS)
|
||||
.setDepth(0F)
|
||||
.addStructureFeature(EndStructures.MEGALAKE_SMALL)
|
||||
.addFeature(EndFeatures.LACUGROVE)
|
||||
.addFeature(EndFeatures.END_LOTUS)
|
||||
.addFeature(EndFeatures.END_LOTUS_LEAF)
|
||||
|
|
|
@ -11,7 +11,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class NeonOasisBiome extends EndBiome {
|
||||
public NeonOasisBiome() {
|
||||
super(new BiomeDefinition("neon_oasis")
|
||||
super((BiomeDefinition) new BiomeDefinition("neon_oasis")
|
||||
.setGenChance(0.5F)
|
||||
.setFogColor(226, 239, 168)
|
||||
.setFogDensity(2)
|
||||
|
|
|
@ -10,7 +10,8 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class PaintedMountainsBiome extends EndBiome {
|
||||
public PaintedMountainsBiome() {
|
||||
super(new BiomeDefinition("painted_mountains")
|
||||
super((BiomeDefinition) new BiomeDefinition("painted_mountains")
|
||||
.addStructureFeature(EndStructures.PAINTED_MOUNTAIN)
|
||||
.setFogColor(226, 239, 168)
|
||||
.setFogDensity(2)
|
||||
.setWaterAndFogColor(192, 180, 131)
|
||||
|
@ -18,7 +19,6 @@ public class PaintedMountainsBiome extends EndBiome {
|
|||
.setLoop(EndSounds.AMBIENT_DUST_WASTELANDS)
|
||||
.setSurface(EndBlocks.ENDSTONE_DUST)
|
||||
.setParticles(ParticleTypes.WHITE_ASH, 0.01F)
|
||||
.addStructureFeature(EndStructures.PAINTED_MOUNTAIN)
|
||||
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class ShadowForestBiome extends EndBiome {
|
||||
public ShadowForestBiome() {
|
||||
super(new BiomeDefinition("shadow_forest")
|
||||
super((BiomeDefinition) new BiomeDefinition("shadow_forest")
|
||||
.setFogColor(0, 0, 0)
|
||||
.setFogDensity(2.5F)
|
||||
.setPlantsColor(45, 45, 45)
|
||||
|
|
|
@ -11,15 +11,15 @@ import ru.betterend.world.surface.SurfaceBuilders;
|
|||
|
||||
public class SulphurSpringsBiome extends EndBiome {
|
||||
public SulphurSpringsBiome() {
|
||||
super(new BiomeDefinition("sulphur_springs")
|
||||
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
|
||||
super((BiomeDefinition) new BiomeDefinition("sulphur_springs")
|
||||
.setCaves(false)
|
||||
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE.configured(SurfaceBuilders.DEFAULT_END_CONFIG))
|
||||
.setMusic(EndSounds.MUSIC_OPENSPACE)
|
||||
.setLoop(EndSounds.AMBIENT_SULPHUR_SPRINGS)
|
||||
.setWaterColor(25, 90, 157)
|
||||
.setWaterFogColor(30, 65, 61)
|
||||
.setFogColor(207, 194, 62)
|
||||
.setFogDensity(1.5F)
|
||||
.setCaves(false)
|
||||
.setDepth(0F)
|
||||
.setParticles(EndParticles.SULPHUR_PARTICLE, 0.001F)
|
||||
.addFeature(EndFeatures.GEYSER)
|
||||
|
|
|
@ -11,7 +11,7 @@ import ru.betterend.world.biome.EndBiome;
|
|||
|
||||
public class UmbrellaJungleBiome extends EndBiome {
|
||||
public UmbrellaJungleBiome() {
|
||||
super(new BiomeDefinition("umbrella_jungle")
|
||||
super((BiomeDefinition) new BiomeDefinition("umbrella_jungle")
|
||||
.setFogColor(87, 223, 221)
|
||||
.setWaterAndFogColor(119, 198, 253)
|
||||
.setFoliageColor(27, 183, 194)
|
||||
|
|
|
@ -17,6 +17,7 @@ import ru.bclib.sdf.operator.SDFDisplacement;
|
|||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
public class BiomeIslandFeature extends DefaultFeature {
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.world.level.material.Material;
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.StructureHelper;
|
||||
import ru.bclib.world.features.NBTStructureFeature;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
|
||||
public class CrashedShipFeature extends NBTStructureFeature {
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
public abstract class DefaultFeature extends Feature<NoneFeatureConfiguration> {
|
||||
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
protected static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
||||
public DefaultFeature() {
|
||||
super(NoneFeatureConfiguration.CODEC);
|
||||
}
|
||||
|
||||
public static int getYOnSurface(WorldGenLevel world, int x, int z) {
|
||||
return world.getHeight(Types.WORLD_SURFACE, x, z);
|
||||
}
|
||||
|
||||
public static int getYOnSurfaceWG(WorldGenLevel world, int x, int z) {
|
||||
return world.getHeight(Types.WORLD_SURFACE_WG, x, z);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurface(WorldGenLevel world, BlockPos pos) {
|
||||
return world.getHeightmapPos(Types.WORLD_SURFACE, pos);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurfaceWG(WorldGenLevel world, BlockPos pos) {
|
||||
return world.getHeightmapPos(Types.WORLD_SURFACE_WG, pos);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurfaceRaycast(WorldGenLevel world, BlockPos pos) {
|
||||
return getPosOnSurfaceRaycast(world, pos, 256);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurfaceRaycast(WorldGenLevel world, BlockPos pos, int dist) {
|
||||
int h = BlocksHelper.downRay(world, pos, dist);
|
||||
return pos.below(h);
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.data.worldgen.Features;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.RangeDecoratorConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.ChanceDecoratorConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.FeatureDecorator;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.blocks.complex.StoneMaterial;
|
||||
import ru.betterend.world.features.terrain.OreLayerFeature;
|
||||
|
||||
public class EndFeature {
|
||||
private Feature<?> feature;
|
||||
private ConfiguredFeature<?, ?> featureConfigured;
|
||||
private GenerationStep.Decoration featureStep;
|
||||
|
||||
protected EndFeature() {}
|
||||
|
||||
public EndFeature(Feature<?> feature, ConfiguredFeature<?, ?> configuredFeature, GenerationStep.Decoration featureStep) {
|
||||
this.featureStep = featureStep;
|
||||
this.feature = feature;
|
||||
this.featureConfigured = configuredFeature;
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<NoneFeatureConfiguration> feature, GenerationStep.Decoration featureStep, ConfiguredFeature<?, ?> configuredFeature) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
this.featureStep = featureStep;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, configuredFeature);
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<NoneFeatureConfiguration> feature) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
this.featureStep = GenerationStep.Decoration.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.CHANCE.configured(new ChanceDecoratorConfiguration(100))));
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<NoneFeatureConfiguration> feature, int density) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
this.featureStep = GenerationStep.Decoration.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configured(FeatureConfiguration.NONE).decorated(Features.Decorators.HEIGHTMAP_SQUARE).countRandom(density));
|
||||
}
|
||||
|
||||
public static EndFeature makeRawGenFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.CHANCE.configured(new ChanceDecoratorConfiguration(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Decoration.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeLakeFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.WATER_LAKE.configured(new ChanceDecoratorConfiguration(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Decoration.LAKES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeOreFeature(String name, Block blockOre, int veins, int veinSize, int offset, int minY, int maxY) {
|
||||
EndFeature newFeature = new EndFeature();
|
||||
OreConfiguration featureConfig = new OreConfiguration(new BlockMatchTest(Blocks.END_STONE), blockOre.defaultBlockState(), veinSize);
|
||||
RangeDecoratorConfiguration rangeDecorator = new RangeDecoratorConfiguration(offset, minY, maxY);
|
||||
ConfiguredFeature<?, ?> oreFeature = Feature.ORE.configured(featureConfig)
|
||||
.decorated(FeatureDecorator.RANGE.configured(rangeDecorator))
|
||||
.squared()
|
||||
.count(veins);
|
||||
newFeature.feature = Feature.ORE;
|
||||
newFeature.featureStep = GenerationStep.Decoration.UNDERGROUND_ORES;
|
||||
newFeature.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, BetterEnd.makeID(name), oreFeature);
|
||||
|
||||
return newFeature;
|
||||
}
|
||||
|
||||
public static EndFeature makeLayerFeature(String name, BlockState state, float radius, int minY, int maxY, int count) {
|
||||
OreLayerFeature layer = new OreLayerFeature(state, radius, minY, maxY);
|
||||
ConfiguredFeature<?, ?> configured = layer.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.COUNT.configured(new CountConfiguration(count)));
|
||||
return new EndFeature(name, layer, GenerationStep.Decoration.UNDERGROUND_ORES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeLayerFeature(String name, Block block, float radius, int minY, int maxY, int count) {
|
||||
OreLayerFeature layer = new OreLayerFeature(block.defaultBlockState(), radius, minY, maxY);
|
||||
ConfiguredFeature<?, ?> configured = layer.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.COUNT.configured(new CountConfiguration(count)));
|
||||
return new EndFeature(name, layer, GenerationStep.Decoration.UNDERGROUND_ORES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeLayerFeature(String name, StoneMaterial material, float radius, int minY, int maxY, int count) {
|
||||
OreLayerFeature layer = new OreLayerFeature(material.stone.defaultBlockState(), radius, minY, maxY);
|
||||
ConfiguredFeature<?, ?> configured = layer.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.COUNT.configured(new CountConfiguration(count)));
|
||||
return new EndFeature(name, layer, GenerationStep.Decoration.UNDERGROUND_ORES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeChunkFeature(String name, Feature<NoneFeatureConfiguration> feature) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.COUNT.configured(new CountConfiguration(1)));
|
||||
return new EndFeature(name, feature, GenerationStep.Decoration.LOCAL_MODIFICATIONS, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeChansedFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.CHANCE.configured(new ChanceDecoratorConfiguration(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Decoration.SURFACE_STRUCTURES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeCountRawFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.COUNT.configured(new CountConfiguration(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Decoration.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeFeatureConfigured(String name, Feature<NoneFeatureConfiguration> feature) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configured(FeatureConfiguration.NONE);
|
||||
return new EndFeature(name, feature, GenerationStep.Decoration.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public Feature<?> getFeature() {
|
||||
return feature;
|
||||
}
|
||||
|
||||
public ConfiguredFeature<?, ?> getFeatureConfigured() {
|
||||
return featureConfigured;
|
||||
}
|
||||
|
||||
public GenerationStep.Decoration getFeatureStep() {
|
||||
return featureStep;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
public abstract class FullHeightScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
public abstract class InvertedScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.StructureHelper;
|
||||
|
||||
public class ListFeature extends NBTStructureFeature {
|
||||
private final List<StructureInfo> list;
|
||||
private StructureInfo selected;
|
||||
|
||||
public ListFeature(List<StructureInfo> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StructureTemplate getStructure(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
selected = list.get(random.nextInt(list.size()));
|
||||
return selected.getStructure();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
int cx = pos.getX() >> 4;
|
||||
int cz = pos.getZ() >> 4;
|
||||
return ((cx + cz) & 1) == 0 && pos.getY() > 58 && world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rotation getRotation(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return Rotation.getRandom(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Mirror getMirror(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return Mirror.values()[random.nextInt(3)];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYOffset(StructureTemplate structure, WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return selected.offsetY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TerrainMerge getTerrainMerge(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return selected.terrainMerge;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addStructureData(StructurePlaceSettings data) {}
|
||||
|
||||
public static final class StructureInfo {
|
||||
public final TerrainMerge terrainMerge;
|
||||
public final String structurePath;
|
||||
public final int offsetY;
|
||||
|
||||
private StructureTemplate structure;
|
||||
|
||||
public StructureInfo(String structurePath, int offsetY, TerrainMerge terrainMerge) {
|
||||
this.terrainMerge = terrainMerge;
|
||||
this.structurePath = structurePath;
|
||||
this.offsetY = offsetY;
|
||||
}
|
||||
|
||||
public StructureTemplate getStructure() {
|
||||
if (structure == null) {
|
||||
structure = StructureHelper.readStructure(structurePath);
|
||||
}
|
||||
return structure;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.processors.DestructionStructureProcessor;
|
||||
|
||||
public abstract class NBTStructureFeature extends DefaultFeature {
|
||||
protected static final DestructionStructureProcessor DESTRUCTION = new DestructionStructureProcessor();
|
||||
|
||||
protected abstract StructureTemplate getStructure(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract boolean canSpawn(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract Rotation getRotation(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract Mirror getMirror(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract int getYOffset(StructureTemplate structure, WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract TerrainMerge getTerrainMerge(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract void addStructureData(StructurePlaceSettings data);
|
||||
|
||||
protected BlockPos getGround(WorldGenLevel world, BlockPos center) {
|
||||
Biome biome = world.getBiome(center);
|
||||
ResourceLocation id = EndBiomes.getBiomeID(biome);
|
||||
if (id.getNamespace().contains("moutain") || id.getNamespace().contains("lake")) {
|
||||
int y = getAverageY(world, center);
|
||||
return new BlockPos(center.getX(), y, center.getZ());
|
||||
} else {
|
||||
int y = getAverageYWG(world, center);
|
||||
return new BlockPos(center.getX(), y, center.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
protected int getAverageY(WorldGenLevel world, BlockPos center) {
|
||||
int y = getYOnSurface(world, center.getX(), center.getZ());
|
||||
y += getYOnSurface(world, center.getX() - 2, center.getZ() - 2);
|
||||
y += getYOnSurface(world, center.getX() + 2, center.getZ() - 2);
|
||||
y += getYOnSurface(world, center.getX() - 2, center.getZ() + 2);
|
||||
y += getYOnSurface(world, center.getX() + 2, center.getZ() + 2);
|
||||
return y / 5;
|
||||
}
|
||||
|
||||
protected int getAverageYWG(WorldGenLevel world, BlockPos center) {
|
||||
int y = getYOnSurfaceWG(world, center.getX(), center.getZ());
|
||||
y += getYOnSurfaceWG(world, center.getX() - 2, center.getZ() - 2);
|
||||
y += getYOnSurfaceWG(world, center.getX() + 2, center.getZ() - 2);
|
||||
y += getYOnSurfaceWG(world, center.getX() - 2, center.getZ() + 2);
|
||||
y += getYOnSurfaceWG(world, center.getX() + 2, center.getZ() + 2);
|
||||
return y / 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
center = new BlockPos(((center.getX() >> 4) << 4) | 8, 128, ((center.getZ() >> 4) << 4) | 8);
|
||||
center = getGround(world, center);
|
||||
|
||||
if (!canSpawn(world, center, random)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int posY = center.getY() + 1;
|
||||
StructureTemplate structure = getStructure(world, center, random);
|
||||
Rotation rotation = getRotation(world, center, random);
|
||||
Mirror mirror = getMirror(world, center, random);
|
||||
BlockPos offset = StructureTemplate.transform(structure.getSize(), mirror, rotation, BlockPos.ZERO);
|
||||
center = center.offset(0, getYOffset(structure, world, center, random) + 0.5, 0);
|
||||
|
||||
BoundingBox bounds = makeBox(center);
|
||||
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation).setMirror(mirror)
|
||||
.setBoundingBox(bounds);
|
||||
addStructureData(placementData);
|
||||
center = center.offset(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5);
|
||||
structure.placeInWorldChunk(world, center, placementData, random);
|
||||
|
||||
TerrainMerge merge = getTerrainMerge(world, center, random);
|
||||
int x1 = center.getX();
|
||||
int z1 = center.getZ();
|
||||
int x2 = x1 + offset.getX();
|
||||
int z2 = z1 + offset.getZ();
|
||||
if (merge != TerrainMerge.NONE) {
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
|
||||
if (x2 < x1) {
|
||||
int a = x1;
|
||||
x1 = x2;
|
||||
x2 = a;
|
||||
}
|
||||
|
||||
if (z2 < z1) {
|
||||
int a = z1;
|
||||
z1 = z2;
|
||||
z2 = a;
|
||||
}
|
||||
|
||||
int surfMax = posY - 1;
|
||||
for (int x = x1; x <= x2; x++) {
|
||||
mut.setX(x);
|
||||
for (int z = z1; z <= z2; z++) {
|
||||
mut.setZ(z);
|
||||
mut.setY(surfMax);
|
||||
BlockState state = world.getBlockState(mut);
|
||||
if (!state.is(TagAPI.GEN_TERRAIN) && state.isFaceSturdy(world, mut, Direction.DOWN)) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
BlockState stateSt = world.getBlockState(mut);
|
||||
if (!stateSt.is(TagAPI.GEN_TERRAIN)) {
|
||||
if (merge == TerrainMerge.SURFACE) {
|
||||
SurfaceBuilderConfiguration config = world.getBiome(mut).getGenerationSettings().getSurfaceBuilderConfig();
|
||||
boolean isTop = mut.getY() == surfMax && state.getMaterial().isSolidBlocking();
|
||||
BlockState top = isTop ? config.getTopMaterial() : config.getUnderMaterial();
|
||||
BlocksHelper.setWithoutUpdate(world, mut, top);
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (stateSt.is(TagAPI.END_GROUND) && state.getMaterial().isSolidBlocking()) {
|
||||
if (merge == TerrainMerge.SURFACE) {
|
||||
SurfaceBuilderConfiguration config = world.getBiome(mut).getGenerationSettings().getSurfaceBuilderConfig();
|
||||
BlocksHelper.setWithoutUpdate(world, mut, config.getUnderMaterial());
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BlockFixer.fixBlocks(world, new BlockPos(x1, center.getY(), z1), new BlockPos(x2, center.getY() + offset.getY(), z2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected BoundingBox makeBox(BlockPos pos) {
|
||||
int sx = ((pos.getX() >> 4) << 4) - 16;
|
||||
int sz = ((pos.getZ() >> 4) << 4) - 16;
|
||||
int ex = sx + 47;
|
||||
int ez = sz + 47;
|
||||
return BoundingBox.createProper(sx, 0, sz, ex, 255, ez);
|
||||
}
|
||||
|
||||
protected static StructureTemplate readStructure(ResourceLocation resource) {
|
||||
String ns = resource.getNamespace();
|
||||
String nm = resource.getPath();
|
||||
|
||||
try {
|
||||
InputStream inputstream = MinecraftServer.class.getResourceAsStream("/data/" + ns + "/structures/" + nm + ".nbt");
|
||||
return readStructureFromStream(inputstream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static StructureTemplate readStructureFromStream(InputStream stream) throws IOException {
|
||||
CompoundTag nbttagcompound = NbtIo.readCompressed(stream);
|
||||
|
||||
StructureTemplate template = new StructureTemplate();
|
||||
template.load(nbttagcompound);
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
public static enum TerrainMerge {
|
||||
NONE, SURFACE, OBJECT;
|
||||
|
||||
public static TerrainMerge getFromString(String type) {
|
||||
if (type.equals("surface")) {
|
||||
return SURFACE;
|
||||
} else if (type.equals("object")) {
|
||||
return OBJECT;
|
||||
} else {
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.NeonCactusPlantBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
public abstract class ScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
public abstract class WallScatterFeature extends DefaultFeature {
|
||||
private static final Direction[] DIR = BlocksHelper.makeHorizontal();
|
||||
|
|
|
@ -21,8 +21,8 @@ import ru.bclib.sdf.operator.SDFTranslate;
|
|||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class BushFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -22,8 +22,8 @@ import ru.bclib.sdf.operator.SDFTranslate;
|
|||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class BushWithOuterFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
|
|
|
@ -12,10 +12,10 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class LargeAmaranitaFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -12,10 +12,10 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties.LumecornShape;
|
||||
import ru.betterend.blocks.LumecornBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class Lumecorn extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -24,12 +24,12 @@ import ru.bclib.sdf.operator.SDFTranslate;
|
|||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class TenaneaBushFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -15,8 +15,8 @@ import ru.bclib.sdf.operator.SDFRotation;
|
|||
import ru.bclib.sdf.primitive.SDFHexPrism;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -14,10 +14,10 @@ import net.minecraft.world.level.material.Material;
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
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.features.DefaultFeature;
|
||||
|
||||
public class DesertLakeFeature extends DefaultFeature {
|
||||
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||
|
|
|
@ -14,10 +14,10 @@ import net.minecraft.world.level.material.Material;
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
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.features.DefaultFeature;
|
||||
|
||||
public class EndLakeFeature extends DefaultFeature {
|
||||
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||
|
|
|
@ -18,9 +18,9 @@ import ru.bclib.sdf.operator.SDFRotation;
|
|||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class FallenPillarFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
|
@ -62,7 +63,7 @@ public class FloatingSpireFeature extends SpireFeature {
|
|||
sdf.fillRecursive(world, center);
|
||||
|
||||
support.forEach((bpos) -> {
|
||||
if (EndBiomes.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
EndFeatures.TENANEA_BUSH.getFeature().place(world, chunkGenerator, random, bpos, null);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -33,12 +33,12 @@ import ru.bclib.sdf.primitive.SDFPrimitive;
|
|||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.HydrothermalVentBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class GeyserFeature extends DefaultFeature {
|
||||
protected static final Function<BlockState, Boolean> REPLACE1;
|
||||
|
|
|
@ -17,8 +17,8 @@ import ru.bclib.sdf.operator.SDFTranslate;
|
|||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class IceStarFeature extends DefaultFeature {
|
||||
private final float minSize;
|
||||
|
|
|
@ -15,9 +15,9 @@ import ru.bclib.sdf.operator.SDFDisplacement;
|
|||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class ObsidianBoulderFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -20,9 +20,9 @@ import ru.bclib.sdf.operator.SDFTranslate;
|
|||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.sdf.primitive.SDFFlatland;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class ObsidianPillarBasementFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -13,8 +13,8 @@ import ru.bclib.sdf.operator.SDFCoordModify;
|
|||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class OreLayerFeature extends DefaultFeature {
|
||||
private static final SDFSphere SPHERE;
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
public class SingleBlockFeature extends DefaultFeature {
|
||||
private final Block block;
|
||||
|
|
|
@ -12,8 +12,8 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
|
@ -22,10 +23,10 @@ import ru.bclib.sdf.operator.SDFSmoothUnion;
|
|||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.MHelper;
|
||||
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.features.DefaultFeature;
|
||||
|
||||
public class SpireFeature extends DefaultFeature {
|
||||
protected static final Function<BlockState, Boolean> REPLACE;
|
||||
|
@ -66,7 +67,7 @@ public class SpireFeature extends DefaultFeature {
|
|||
}).fillRecursive(world, center);
|
||||
|
||||
support.forEach((bpos) -> {
|
||||
if (EndBiomes.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
EndFeatures.TENANEA_BUSH.getFeature().place(world, chunkGenerator, random, bpos, null);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,8 +13,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.basis.StalactiteBlock;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class StalactiteFeature extends DefaultFeature {
|
||||
private final boolean ceiling;
|
||||
|
|
|
@ -12,10 +12,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SulphurHillFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -19,12 +19,12 @@ import net.minecraft.world.level.material.Material;
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.SulphurCrystalBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SulphuricCaveFeature extends DefaultFeature {
|
||||
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||
|
|
|
@ -17,11 +17,11 @@ import net.minecraft.world.level.material.Fluids;
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.SulphurCrystalBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SulphuricLakeFeature extends DefaultFeature {
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||
|
|
|
@ -11,9 +11,9 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.HydrothermalVentBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SurfaceVentFeature extends DefaultFeature {
|
||||
@Override
|
||||
|
|
|
@ -17,9 +17,9 @@ import net.minecraft.world.level.levelgen.feature.Feature;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||
private Supplier<EndCaveBiome> supplier;
|
||||
|
|
|
@ -19,15 +19,16 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.interfaces.IBiomeArray;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public abstract class EndCaveFeature extends DefaultFeature {
|
||||
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||
|
@ -152,7 +153,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
protected void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
|
||||
IBiomeArray array = (IBiomeArray) world.getChunk(pos).getBiomes();
|
||||
if (array != null) {
|
||||
Biome bio = EndBiomes.getActualBiome(biome);
|
||||
Biome bio = BiomeAPI.getActualBiome(biome);
|
||||
array.be_setBiome(bio, pos);
|
||||
}
|
||||
}
|
||||
|
@ -229,8 +230,8 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
Biome biome = world.getBiome(pos.offset(x << 4, 0, z << 4));
|
||||
EndBiome endBiome = EndBiomes.getFromBiome(biome);
|
||||
if (!endBiome.hasCaves() && EndBiomes.LAND_BIOMES.containsImmutable(endBiome.getID())) {
|
||||
EndBiome endBiome = (EndBiome) BiomeAPI.getFromBiome(biome);
|
||||
if (endBiome != null && !endBiome.hasCaves() && EndBiomes.LAND_BIOMES.containsImmutable(endBiome.getID())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class DragonTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -23,9 +23,9 @@ import ru.bclib.sdf.SDF;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.basis.AttachedBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class GiganticAmaranitaFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -26,9 +26,9 @@ import ru.bclib.sdf.operator.SDFUnion;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.HelixTreeLeavesBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class HelixTreeFeature extends DefaultFeature {
|
||||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
|
|
@ -24,9 +24,9 @@ import ru.bclib.sdf.operator.SDFTranslate;
|
|||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.JellyshroomCapBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class JellyshroomFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -25,9 +25,9 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class LacugroveFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -27,12 +27,12 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class LucerniaFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
|
|
|
@ -30,11 +30,11 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.MossyGlowshroomCapBlock;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class MossyGlowshroomFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -26,9 +26,9 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class PythadendronTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -27,12 +27,12 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class TenaneaFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
|
|
|
@ -29,10 +29,10 @@ import ru.bclib.sdf.primitive.SDFSphere;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.SplineHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.UmbrellaTreeClusterBlock;
|
||||
import ru.betterend.blocks.UmbrellaTreeMembraneBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class UmbrellaTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
|
|
@ -14,6 +14,9 @@ import net.minecraft.world.level.biome.Biomes;
|
|||
import net.minecraft.world.level.biome.TheEndBiomeSource;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
import net.minecraft.world.level.levelgen.synth.SimplexNoise;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.bclib.world.generator.BiomeMap;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
|
@ -89,10 +92,10 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
mapVoid.clearCache();
|
||||
}
|
||||
|
||||
EndBiome endBiome = null;
|
||||
BCLBiome endBiome = null;
|
||||
if (GeneratorOptions.useNewGenerator()) {
|
||||
if (TerrainGenerator.isLand(biomeX, biomeZ)) {
|
||||
endBiome = mapLand.getBiome(biomeX << 2, biomeZ << 2);
|
||||
endBiome = (EndBiome) mapLand.getBiome(biomeX << 2, biomeZ << 2);
|
||||
}
|
||||
else {
|
||||
if (!GeneratorOptions.noRingVoid() && dist <= 65536L) {
|
||||
|
@ -111,7 +114,7 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
endBiome = height < -10F ? mapVoid.getBiome(biomeX << 2, biomeZ << 2) : mapLand.getBiome(biomeX << 2, biomeZ << 2);
|
||||
}
|
||||
|
||||
return EndBiomes.getActualBiome(endBiome);
|
||||
return BiomeAPI.getActualBiome(endBiome);
|
||||
}
|
||||
|
||||
public Biome getLandBiome(int biomeX, int biomeY, int biomeZ) {
|
||||
|
@ -129,7 +132,7 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
return this.centerBiome;
|
||||
}
|
||||
}
|
||||
return EndBiomes.getActualBiome(mapLand.getBiome(biomeX << 2, biomeZ << 2));
|
||||
return BiomeAPI.getActualBiome(mapLand.getBiome(biomeX << 2, biomeZ << 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package ru.betterend.world.generator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
public class BiomeChunk {
|
||||
protected static final int WIDTH = 16;
|
||||
private static final int SM_WIDTH = WIDTH >> 1;
|
||||
private static final int MASK_OFFSET = SM_WIDTH - 1;
|
||||
protected static final int MASK_WIDTH = WIDTH - 1;
|
||||
|
||||
private final EndBiome[][] biomes;
|
||||
|
||||
public BiomeChunk(BiomeMap map, Random random, BiomePicker picker) {
|
||||
EndBiome[][] PreBio = new EndBiome[SM_WIDTH][SM_WIDTH];
|
||||
biomes = new EndBiome[WIDTH][WIDTH];
|
||||
|
||||
for (int x = 0; x < SM_WIDTH; x++)
|
||||
for (int z = 0; z < SM_WIDTH; z++)
|
||||
PreBio[x][z] = picker.getBiome(random);
|
||||
|
||||
for (int x = 0; x < WIDTH; x++)
|
||||
for (int z = 0; z < WIDTH; z++)
|
||||
biomes[x][z] = PreBio[offsetXZ(x, random)][offsetXZ(z, random)].getSubBiome(random);
|
||||
}
|
||||
|
||||
public EndBiome getBiome(int x, int z) {
|
||||
return biomes[x & MASK_WIDTH][z & MASK_WIDTH];
|
||||
}
|
||||
|
||||
private int offsetXZ(int x, Random random) {
|
||||
return ((x + random.nextInt(2)) >> 1) & MASK_OFFSET;
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package ru.betterend.world.generator;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
public class BiomeMap {
|
||||
private static final WorldgenRandom RANDOM = new WorldgenRandom();
|
||||
|
||||
private final Map<ChunkPos, BiomeChunk> maps = Maps.newHashMap();
|
||||
private final int size;
|
||||
private final int sizeXZ;
|
||||
private final int depth;
|
||||
private final OpenSimplexNoise noiseX;
|
||||
private final OpenSimplexNoise noiseZ;
|
||||
private final BiomePicker picker;
|
||||
private final long seed;
|
||||
|
||||
public BiomeMap(long seed, int size, BiomePicker picker) {
|
||||
maps.clear();
|
||||
RANDOM.setSeed(seed);
|
||||
noiseX = new OpenSimplexNoise(RANDOM.nextLong());
|
||||
noiseZ = new OpenSimplexNoise(RANDOM.nextLong());
|
||||
this.sizeXZ = size;
|
||||
depth = (int) Math.ceil(Math.log(size) / Math.log(2)) - 2;
|
||||
this.size = 1 << depth;
|
||||
this.picker = picker;
|
||||
this.seed = seed;
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return seed;
|
||||
}
|
||||
|
||||
public void clearCache() {
|
||||
if (maps.size() > 32) {
|
||||
maps.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private EndBiome getRawBiome(int bx, int bz) {
|
||||
double x = (double) bx * size / sizeXZ;
|
||||
double z = (double) bz * size / sizeXZ;
|
||||
double nx = x;
|
||||
double nz = z;
|
||||
|
||||
double px = bx * 0.2;
|
||||
double pz = bz * 0.2;
|
||||
|
||||
for (int i = 0; i < depth; i++) {
|
||||
nx = (x + noiseX.eval(px, pz)) / 2F;
|
||||
nz = (z + noiseZ.eval(px, pz)) / 2F;
|
||||
|
||||
x = nx;
|
||||
z = nz;
|
||||
|
||||
px = px / 2 + i;
|
||||
pz = pz / 2 + i;
|
||||
}
|
||||
|
||||
bx = MHelper.floor(x);
|
||||
bz = MHelper.floor(z);
|
||||
if ((bx & BiomeChunk.MASK_WIDTH) == BiomeChunk.MASK_WIDTH) {
|
||||
x += (bz / 2) & 1;
|
||||
}
|
||||
if ((bz & BiomeChunk.MASK_WIDTH) == BiomeChunk.MASK_WIDTH) {
|
||||
z += (bx / 2) & 1;
|
||||
}
|
||||
|
||||
ChunkPos cpos = new ChunkPos(MHelper.floor(x / BiomeChunk.WIDTH), MHelper.floor(z / BiomeChunk.WIDTH));
|
||||
BiomeChunk chunk = maps.get(cpos);
|
||||
if (chunk == null) {
|
||||
RANDOM.setBaseChunkSeed(cpos.x, cpos.z);
|
||||
chunk = new BiomeChunk(this, RANDOM, picker);
|
||||
maps.put(cpos, chunk);
|
||||
}
|
||||
|
||||
return chunk.getBiome(MHelper.floor(x), MHelper.floor(z));
|
||||
}
|
||||
|
||||
public EndBiome getBiome(int x, int z) {
|
||||
EndBiome biome = getRawBiome(x, z);
|
||||
|
||||
if (biome.hasEdge() || (biome.hasParentBiome() && biome.getParentBiome().hasEdge())) {
|
||||
EndBiome search = biome;
|
||||
if (biome.hasParentBiome()) {
|
||||
search = biome.getParentBiome();
|
||||
}
|
||||
int d = (int) Math.ceil(search.getEdgeSize() / 4F) << 2;
|
||||
|
||||
boolean edge = !search.isSame(getRawBiome(x + d, z));
|
||||
edge = edge || !search.isSame(getRawBiome(x - d, z));
|
||||
edge = edge || !search.isSame(getRawBiome(x, z + d));
|
||||
edge = edge || !search.isSame(getRawBiome(x, z - d));
|
||||
edge = edge || !search.isSame(getRawBiome(x - 1, z - 1));
|
||||
edge = edge || !search.isSame(getRawBiome(x - 1, z + 1));
|
||||
edge = edge || !search.isSame(getRawBiome(x + 1, z - 1));
|
||||
edge = edge || !search.isSame(getRawBiome(x + 1, z + 1));
|
||||
|
||||
if (edge) {
|
||||
biome = search.getEdge();
|
||||
}
|
||||
}
|
||||
|
||||
return biome;
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package ru.betterend.world.generator;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
public class BiomePicker {
|
||||
private final Set<ResourceLocation> immutableIDs = Sets.newHashSet();
|
||||
private final List<EndBiome> biomes = Lists.newArrayList();
|
||||
private float maxChanceUnmutable = 0;
|
||||
private float maxChance = 0;
|
||||
private int biomeCount = 0;
|
||||
private WeighTree tree;
|
||||
|
||||
public void addBiome(EndBiome biome) {
|
||||
maxChance = biome.mutateGenChance(maxChance);
|
||||
immutableIDs.add(biome.getID());
|
||||
maxChanceUnmutable = maxChance;
|
||||
biomes.add(biome);
|
||||
biomeCount ++;
|
||||
}
|
||||
|
||||
public void addBiomeMutable(EndBiome biome) {
|
||||
biomes.add(biome);
|
||||
}
|
||||
|
||||
public void clearMutables() {
|
||||
maxChance = maxChanceUnmutable;
|
||||
for (int i = biomes.size() - 1; i >= biomeCount; i--) {
|
||||
biomes.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
public EndBiome getBiome(Random random) {
|
||||
return biomes.isEmpty() ? null : tree.getBiome(random.nextFloat() * maxChance);
|
||||
}
|
||||
|
||||
public List<EndBiome> getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
|
||||
public boolean containsImmutable(ResourceLocation id) {
|
||||
return immutableIDs.contains(id);
|
||||
}
|
||||
|
||||
public void removeMutableBiome(ResourceLocation id) {
|
||||
for (int i = biomeCount; i < biomes.size(); i++) {
|
||||
EndBiome biome = biomes.get(i);
|
||||
if (biome.getID().equals(id)) {
|
||||
biomes.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuild() {
|
||||
if (biomes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
maxChance = maxChanceUnmutable;
|
||||
for (int i = biomeCount; i < biomes.size(); i++) {
|
||||
maxChance = biomes.get(i).mutateGenChance(maxChance);
|
||||
}
|
||||
tree = new WeighTree(biomes);
|
||||
}
|
||||
}
|
|
@ -18,9 +18,9 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
|||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class CrystalMountainPiece extends MountainPiece {
|
|||
@Override
|
||||
protected void fromNbt(CompoundTag tag) {
|
||||
super.fromNbt(tag);
|
||||
top = EndBiomes.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
top = BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,11 +24,11 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
|
|||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class LakePiece extends BasePiece {
|
|||
this.seed = random.nextInt();
|
||||
this.noise = new OpenSimplexNoise(this.seed);
|
||||
this.aspect = radius / depth;
|
||||
this.biomeID = EndBiomes.getBiomeID(biome);
|
||||
this.biomeID = BiomeAPI.getBiomeID(biome);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ public class LakePiece extends BasePiece {
|
|||
return h;
|
||||
}
|
||||
|
||||
if (!EndBiomes.getBiomeID(world.getBiome(pos)).equals(biomeID)) {
|
||||
if (!BiomeAPI.getBiomeID(world.getBiome(pos)).equals(biomeID)) {
|
||||
heightmap.put(p, (byte) 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
|
|||
import net.minecraft.world.level.levelgen.feature.StructurePieceType;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
|
||||
public abstract class MountainPiece extends BasePiece {
|
||||
protected Map<Integer, Integer> heightmap = Maps.newHashMap();
|
||||
|
@ -43,7 +43,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
this.seed2 = random.nextInt();
|
||||
this.noise1 = new OpenSimplexNoise(this.seed1);
|
||||
this.noise2 = new OpenSimplexNoise(this.seed2);
|
||||
this.biomeID = EndBiomes.getBiomeID(biome);
|
||||
this.biomeID = BiomeAPI.getBiomeID(biome);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
return h;
|
||||
}
|
||||
|
||||
if (!EndBiomes.getBiomeID(world.getBiome(pos)).equals(biomeID)) {
|
||||
if (!BiomeAPI.getBiomeID(world.getBiome(pos)).equals(biomeID)) {
|
||||
heightmap.put(p, -10);
|
||||
return -10;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue