diff --git a/src/main/java/ru/betterend/integration/byg/biomes/BYGBiomes.java b/src/main/java/ru/betterend/integration/byg/biomes/BYGBiomes.java index 013afbe9..9d01f412 100644 --- a/src/main/java/ru/betterend/integration/byg/biomes/BYGBiomes.java +++ b/src/main/java/ru/betterend/integration/byg/biomes/BYGBiomes.java @@ -1,5 +1,6 @@ package ru.betterend.integration.byg.biomes; +import ru.betterend.BetterEnd; import ru.betterend.integration.Integrations; import ru.betterend.registry.EndBiomes; import ru.betterend.world.biome.EndBiome; @@ -11,7 +12,7 @@ public class BYGBiomes { //public static final EndBiome ETHERIAL_GROVE = EndBiomes.registerSubBiomeIntegration(new EterialGrove()); public static void register() { - System.out.println("Registered " + OLD_BULBIS_GARDENS); + BetterEnd.LOGGER.info("Registered " + OLD_BULBIS_GARDENS); } public static void addBiomes() { diff --git a/src/main/java/ru/betterend/integration/byg/biomes/NightshadeRedwoods.java b/src/main/java/ru/betterend/integration/byg/biomes/NightshadeRedwoods.java index 249b3501..a3b6df63 100644 --- a/src/main/java/ru/betterend/integration/byg/biomes/NightshadeRedwoods.java +++ b/src/main/java/ru/betterend/integration/byg/biomes/NightshadeRedwoods.java @@ -1,69 +1,84 @@ package ru.betterend.integration.byg.biomes; +import java.util.List; + import net.minecraft.core.particles.ParticleTypes; import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import ru.bclib.BCLib; -import ru.bclib.world.biomes.BCLBiomeDef; -import ru.betterend.BetterEnd; +import ru.bclib.api.biomes.BCLBiomeBuilder; import ru.betterend.integration.Integrations; import ru.betterend.integration.byg.features.BYGFeatures; import ru.betterend.registry.EndFeatures; import ru.betterend.world.biome.EndBiome; -import java.util.List; +public class NightshadeRedwoods extends EndBiome.Config { + public NightshadeRedwoods() { + super("nightshade_redwoods"); + } -public class NightshadeRedwoods extends EndBiome { - public NightshadeRedwoods() { - super(makeDef()); - } - - private static BCLBiomeDef makeDef() { - Biome biome = Integrations.BYG.getBiome("nightshade_forest"); - BiomeSpecialEffects effects = biome.getSpecialEffects(); - - BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods")).setFogColor(140, 108, 47) - .setFogDensity(1.5F) - .setWaterAndFogColor(55, 70, 186) - .setFoliageColor(122, 17, 155) - .setParticles( - ParticleTypes.REVERSE_PORTAL, - 0.002F - ) - .setSurface(biome.getGenerationSettings() - .getSurfaceBuilder() - .get()) - .setGrassColor(48, 13, 89) - .setPlantsColor(200, 125, 9) - .addFeature(EndFeatures.END_LAKE_RARE) - .addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE) - .addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD) - .addFeature(BYGFeatures.NIGHTSHADE_MOSS); - - if (BCLib.isClient()) { - SoundEvent loop = effects.getAmbientLoopSoundEvent().get(); - SoundEvent music = effects.getBackgroundMusic().get().getEvent(); - SoundEvent additions = effects.getAmbientAdditionsSettings().get().getSoundEvent(); - SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent(); - def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood); - } - biome.getGenerationSettings().features().forEach((list) -> { - list.forEach((feature) -> { - def.addFeature(Decoration.VEGETAL_DECORATION, feature.get()); - }); - }); - - for (MobCategory group : MobCategory.values()) { - List list = biome.getMobSettings().getMobs(group).unwrap(); - list.forEach((entry) -> { - def.addMobSpawn(entry); - }); - } - - return def; - } + @Override + protected void addCustomBuildData(BCLBiomeBuilder builder) { + Biome biome = Integrations.BYG.getBiome("nightshade_forest"); + BiomeSpecialEffects effects = biome.getSpecialEffects(); + + builder.fogColor(140, 108, 47) + .fogDensity(1.5F) + .waterAndFogColor(55, 70, 186) + .foliageColor(122, 17, 155) + .particles( + ParticleTypes.REVERSE_PORTAL, + 0.002F + ) + //TODO: 1.18 surface rules +// .setSurface(biome.getGenerationSettings() +// .getSurfaceBuilder() +// .get()) + .grassColor(48, 13, 89) + .plantsColor(200, 125, 9) + .feature(EndFeatures.END_LAKE_RARE) + .feature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE) + .feature(BYGFeatures.NIGHTSHADE_MOSS_WOOD) + .feature(BYGFeatures.NIGHTSHADE_MOSS); + + if (BCLib.isClient()) { + SoundEvent loop = effects.getAmbientLoopSoundEvent() + .get(); + SoundEvent music = effects.getBackgroundMusic() + .get() + .getEvent(); + SoundEvent additions = effects.getAmbientAdditionsSettings() + .get() + .getSoundEvent(); + SoundEvent mood = effects.getAmbientMoodSettings() + .get() + .getSoundEvent(); + builder.loop(loop) + .music(music) + .additions(additions) + .mood(mood); + } + biome.getGenerationSettings() + .features() + .forEach((list) -> { + list.forEach((feature) -> { + builder.feature(Decoration.VEGETAL_DECORATION, feature.get()); + }); + }); + + for (MobCategory group : MobCategory.values()) { + List list = biome.getMobSettings() + .getMobs(group) + .unwrap(); + list.forEach((entry) -> { + builder.spawn((EntityType) entry.type, 1, entry.minCount, entry.maxCount); + }); + } + } } diff --git a/src/main/java/ru/betterend/integration/byg/biomes/OldBulbisGardens.java b/src/main/java/ru/betterend/integration/byg/biomes/OldBulbisGardens.java index d33d0bfb..d7eb15e4 100644 --- a/src/main/java/ru/betterend/integration/byg/biomes/OldBulbisGardens.java +++ b/src/main/java/ru/betterend/integration/byg/biomes/OldBulbisGardens.java @@ -1,107 +1,117 @@ package ru.betterend.integration.byg.biomes; +import java.util.List; +import java.util.function.Supplier; + import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.data.BuiltinRegistries; -import net.minecraft.data.worldgen.Features; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.levelgen.GenerationStep.Decoration; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.placement.ConfiguredDecorator; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; import ru.bclib.BCLib; -import ru.bclib.world.biomes.BCLBiomeDef; +import ru.bclib.api.biomes.BCLBiomeBuilder; import ru.betterend.BetterEnd; import ru.betterend.integration.Integrations; import ru.betterend.integration.byg.features.BYGFeatures; import ru.betterend.registry.EndFeatures; import ru.betterend.world.biome.EndBiome; -import java.util.List; -import java.util.function.Supplier; -class FeaturesAccesor extends Features { - static ConfiguredDecorator shadowHEIGHTMAP_SQUARE; - - static { - shadowHEIGHTMAP_SQUARE = Decorators.HEIGHTMAP_SQUARE; - } -} +public class OldBulbisGardens extends EndBiome.Config { + public OldBulbisGardens() { + super("old_bulbis_gardens"); + } -public class OldBulbisGardens extends EndBiome { - public OldBulbisGardens() { - super(makeDef()); - } - - private static BCLBiomeDef makeDef() { - Biome biome = Integrations.BYG.getBiome("bulbis_gardens"); - BiomeSpecialEffects effects = biome.getSpecialEffects(); - - Block ivis = Integrations.BYG.getBlock("ivis_phylium"); - Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock(); - BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens")).setFogColor(215, 132, 207) - .setFogDensity(1.8F) - .setWaterAndFogColor(40, 0, 56) - .setFoliageColor(122, 17, 155) - .setParticles( - ParticleTypes.REVERSE_PORTAL, - 0.002F - ) - .setSurface(ivis, origin) - .addFeature(EndFeatures.END_LAKE_RARE) - .addFeature(BYGFeatures.OLD_BULBIS_TREE); - - if (BCLib.isClient()) { - SoundEvent loop = effects.getAmbientLoopSoundEvent().get(); - SoundEvent music = effects.getBackgroundMusic().get().getEvent(); - SoundEvent additions = effects.getAmbientAdditionsSettings().get().getSoundEvent(); - SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent(); - def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood); - } - - for (MobCategory group : MobCategory.values()) { - List list = biome.getMobSettings().getMobs(group).unwrap(); - list.forEach((entry) -> { - def.addMobSpawn(entry); - }); - } - - List>>> features = biome.getGenerationSettings().features(); - List>> vegetal = features.get(Decoration.VEGETAL_DECORATION.ordinal()); - if (vegetal.size() > 2) { - Supplier> getter; - // Trees (first two features) - // I couldn't process them with conditions, so that's why they are hardcoded (paulevs) - for (int i = 0; i < 2; i++) { - getter = vegetal.get(i); - ConfiguredFeature feature = getter.get(); - ResourceLocation id = BetterEnd.makeID("obg_feature_" + i); - feature = Registry.register( - BuiltinRegistries.CONFIGURED_FEATURE, - id, - feature.decorated(FeaturesAccesor.shadowHEIGHTMAP_SQUARE).countRandom(1) - ); - def.addFeature(Decoration.VEGETAL_DECORATION, feature); - } - // Grasses and other features - for (int i = 2; i < vegetal.size(); i++) { - getter = vegetal.get(i); - ConfiguredFeature feature = getter.get(); - def.addFeature(Decoration.VEGETAL_DECORATION, feature); - } - } - - def.addFeature(EndFeatures.PURPLE_POLYPORE) - .addFeature(BYGFeatures.IVIS_MOSS_WOOD) - .addFeature(BYGFeatures.IVIS_MOSS) - .addFeature(BYGFeatures.IVIS_VINE) - .addFeature(BYGFeatures.IVIS_SPROUT); - - return def; - } + @Override + protected void addCustomBuildData(BCLBiomeBuilder builder) { + Biome biome = Integrations.BYG.getBiome("bulbis_gardens"); + BiomeSpecialEffects effects = biome.getSpecialEffects(); + + Block ivis = Integrations.BYG.getBlock("ivis_phylium"); +// Block origin = biome.getGenerationSettings() +// .getSurfaceBuilderConfig() +// .getTopMaterial() +// .getBlock(); + builder.fogColor(215, 132, 207) + .fogDensity(1.8F) + .waterAndFogColor(40, 0, 56) + .foliageColor(122, 17, 155) + .particles( + ParticleTypes.REVERSE_PORTAL, + 0.002F + ) + //TODO: 1.18 surface rules + //.surface(ivis, origin) + .feature(EndFeatures.END_LAKE_RARE) + .feature(BYGFeatures.OLD_BULBIS_TREE); + + if (BCLib.isClient()) { + SoundEvent loop = effects.getAmbientLoopSoundEvent() + .get(); + SoundEvent music = effects.getBackgroundMusic() + .get() + .getEvent(); + SoundEvent additions = effects.getAmbientAdditionsSettings() + .get() + .getSoundEvent(); + SoundEvent mood = effects.getAmbientMoodSettings() + .get() + .getSoundEvent(); + builder.loop(loop) + .music(music) + .additions(additions) + .mood(mood); + } + + for (MobCategory group : MobCategory.values()) { + List list = biome.getMobSettings() + .getMobs(group) + .unwrap(); + list.forEach((entry) -> { + builder.spawn((EntityType) entry.type, 1, entry.minCount, entry.maxCount); + }); + } + + List>> features = biome.getGenerationSettings() + .features(); + List> vegetal = features.get(Decoration.VEGETAL_DECORATION.ordinal()); + if (vegetal.size() > 2) { + Supplier getter; + // Trees (first two features) + // I couldn't process them with conditions, so that's why they are hardcoded (paulevs) + for (int i = 0; i < 2; i++) { + getter = vegetal.get(i); + PlacedFeature feature = getter.get(); + ResourceLocation id = BetterEnd.makeID("obg_feature_" + i); + feature = Registry.register( + BuiltinRegistries.PLACED_FEATURE, + id, + //TODO: 1.18 Check if this is correct + feature//.decorated(FeaturesAccesor.shadowHEIGHTMAP_SQUARE).countRandom(1) + ); + builder.feature(Decoration.VEGETAL_DECORATION, feature); + } + // Grasses and other features + for (int i = 2; i < vegetal.size(); i++) { + getter = vegetal.get(i); + PlacedFeature feature = getter.get(); + builder.feature(Decoration.VEGETAL_DECORATION, feature); + } + } + + builder.feature(EndFeatures.PURPLE_POLYPORE) + .feature(BYGFeatures.IVIS_MOSS_WOOD) + .feature(BYGFeatures.IVIS_MOSS) + .feature(BYGFeatures.IVIS_VINE) + .feature(BYGFeatures.IVIS_SPROUT); + } } diff --git a/src/main/java/ru/betterend/registry/EndBiomes.java b/src/main/java/ru/betterend/registry/EndBiomes.java index 04407e82..a09637e5 100644 --- a/src/main/java/ru/betterend/registry/EndBiomes.java +++ b/src/main/java/ru/betterend/registry/EndBiomes.java @@ -124,10 +124,11 @@ public class EndBiomes { /** * Put integration sub-biome {@link EndBiome} into subbiomes list and registers it. * - * @param biome - {@link EndBiome} instance + * @param biomeConfig - {@link EndBiome.Config} instance * @return registered {@link EndBiome} */ - public static EndBiome registerSubBiomeIntegration(EndBiome biome) { + public static EndBiome registerSubBiomeIntegration(EndBiome.Config biomeConfig) { + EndBiome biome = EndBiome.create(biomeConfig); if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) { BiomeAPI.registerBiome(biome); }