This commit is contained in:
paulevsGitch 2020-12-20 15:19:05 +03:00
parent 7b4965dde1
commit adf1cafaac
3 changed files with 47 additions and 2 deletions

View file

@ -56,4 +56,8 @@ public abstract class ModIntegration {
public ConfiguredFeature<?, ?> getConfiguredFeature(String name) { public ConfiguredFeature<?, ?> getConfiguredFeature(String name) {
return BuiltinRegistries.CONFIGURED_FEATURE.get(getID(name)); return BuiltinRegistries.CONFIGURED_FEATURE.get(getID(name));
} }
public Biome getBiome(String name) {
return BuiltinRegistries.BIOME.get(getID(name));
}
} }

View file

@ -1,6 +1,12 @@
package ru.betterend.integration.byg; package ru.betterend.integration.byg;
import java.util.List;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundEvent;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import net.minecraft.world.gen.GenerationStep.Feature; import net.minecraft.world.gen.GenerationStep.Feature;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
@ -9,12 +15,27 @@ import ru.betterend.world.biome.EndBiome;
public class OldBulbisGardens extends EndBiome { public class OldBulbisGardens extends EndBiome {
public OldBulbisGardens() { public OldBulbisGardens() {
super(new BiomeDefinition("old_bulbis_gardens") super(makeDef());
}
private static BiomeDefinition makeDef() {
Biome biome = Integrations.BYG.getBiome("bulbis_gardens");
SoundEvent loop = biome.getLoopSound().get();
SoundEvent music = biome.getMusic().get().getSound();
SoundEvent additions = biome.getAdditionsSound().get().getSound();
SoundEvent mood = biome.getMoodSound().get().getSound();
BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens")
.setFogColor(132, 0, 202) .setFogColor(132, 0, 202)
.setFogDensity(2F) .setFogDensity(2F)
.setWaterAndFogColor(40, 0, 56) .setWaterAndFogColor(40, 0, 56)
.setFoliageColor(122, 17, 155)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F) .setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
.setSurface(Integrations.BYG.getBlock("ivis_phylium")) .setSurface(Integrations.BYG.getBlock("ivis_phylium"))
.setLoop(loop)
.setMusic(music)
.setAdditions(additions)
.setMood(mood)
.addFeature(EndFeatures.END_LAKE_RARE) .addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(BYGFeatures.OLD_BULBIS_TREE) .addFeature(BYGFeatures.OLD_BULBIS_TREE)
.addFeature(Feature.VEGETAL_DECORATION, BYGFeatures.BULBIS_TREES) .addFeature(Feature.VEGETAL_DECORATION, BYGFeatures.BULBIS_TREES)
@ -25,6 +46,15 @@ public class OldBulbisGardens extends EndBiome {
.addFeature(BYGFeatures.IVIS_VINE) .addFeature(BYGFeatures.IVIS_VINE)
.addFeature(BYGFeatures.IVIS_SPROUT) .addFeature(BYGFeatures.IVIS_SPROUT)
.addFeature(BYGFeatures.BULBIS_ODDITY) .addFeature(BYGFeatures.BULBIS_ODDITY)
.addFeature(BYGFeatures.PURPLE_BULBIS_ODDITY)); .addFeature(BYGFeatures.PURPLE_BULBIS_ODDITY);
for (SpawnGroup group: SpawnGroup.values()) {
List<SpawnEntry> list = biome.getSpawnSettings().getSpawnEntry(group);
list.forEach((entry) -> {
def.addMobSpawn(entry);
});
}
return def;
} }
} }

View file

@ -23,6 +23,7 @@ import net.minecraft.world.biome.BiomeEffects.Builder;
import net.minecraft.world.biome.BiomeParticleConfig; import net.minecraft.world.biome.BiomeParticleConfig;
import net.minecraft.world.biome.GenerationSettings; import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.GenerationStep.Carver;
import net.minecraft.world.gen.GenerationStep.Feature; import net.minecraft.world.gen.GenerationStep.Feature;
import net.minecraft.world.gen.ProbabilityConfig; import net.minecraft.world.gen.ProbabilityConfig;
@ -47,6 +48,7 @@ public class BiomeDefinition {
private final List<FeatureInfo> features = Lists.newArrayList(); private final List<FeatureInfo> features = Lists.newArrayList();
private final List<CarverInfo> carvers = Lists.newArrayList(); private final List<CarverInfo> carvers = Lists.newArrayList();
private final List<SpawnInfo> mobs = Lists.newArrayList(); private final List<SpawnInfo> mobs = Lists.newArrayList();
private final List<SpawnEntry> spawns = Lists.newArrayList();
private BiomeParticleConfig particleConfig; private BiomeParticleConfig particleConfig;
private BiomeAdditionsSound additions; private BiomeAdditionsSound additions;
@ -116,6 +118,11 @@ public class BiomeDefinition {
} }
return this; return this;
} }
public BiomeDefinition addMobSpawn(SpawnEntry entry) {
spawns.add(entry);
return this;
}
public BiomeDefinition addStructureFeature(ConfiguredStructureFeature<?, ?> feature) { public BiomeDefinition addStructureFeature(ConfiguredStructureFeature<?, ?> feature) {
structures.add(feature); structures.add(feature);
@ -221,6 +228,10 @@ public class BiomeDefinition {
mobs.forEach((spawn) -> { mobs.forEach((spawn) -> {
spawnSettings.spawn(spawn.type.getSpawnGroup(), new SpawnSettings.SpawnEntry(spawn.type, spawn.weight, spawn.minGroupSize, spawn.maxGroupSize)); spawnSettings.spawn(spawn.type.getSpawnGroup(), new SpawnSettings.SpawnEntry(spawn.type, spawn.weight, spawn.minGroupSize, spawn.maxGroupSize));
}); });
spawns.forEach((entry) -> {
spawnSettings.spawn(entry.type.getSpawnGroup(), entry);
});
generationSettings.surfaceBuilder(surface == null ? ConfiguredSurfaceBuilders.END : surface); generationSettings.surfaceBuilder(surface == null ? ConfiguredSurfaceBuilders.END : surface);
structures.forEach((structure) -> generationSettings.structureFeature(structure)); structures.forEach((structure) -> generationSettings.structureFeature(structure));