Migration to BCLib Biome API (WIP)

This commit is contained in:
paulevsGitch 2021-06-06 16:35:33 +03:00
parent 0b336febd8
commit 19b175f788
101 changed files with 344 additions and 1497 deletions

View file

@ -17,5 +17,5 @@ archives_base_name = better-end
patchouli_version = 50-FABRIC
fabric_version = 0.32.9+1.16
canvas_version = 1.0.+
bclib_version = 0.1.15
bclib_version = 0.1.17
rei_version = 5.8.10

View file

@ -34,6 +34,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.phys.AABB;
import ru.bclib.api.BiomeAPI;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;
@ -50,7 +51,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
if (BiomeAPI.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
this.entityData.set(VARIANT, (byte) 1);
}

View file

@ -26,6 +26,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import ru.bclib.api.BiomeAPI;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;
@ -44,7 +45,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
if (BiomeAPI.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
this.entityData.set(VARIANT, (byte) (random.nextInt(VARIANTS_SULPHUR) + VARIANTS_NORMAL));
}

View file

@ -38,11 +38,12 @@ import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import ru.bclib.api.BiomeAPI;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.interfaces.ISlime;
import ru.betterend.registry.EndBiomes;
import ru.betterend.world.biome.EndBiome;
public class EndSlimeEntity extends Slime {
private static final EntityDataAccessor<Byte> VARIANT = SynchedEntityData.defineId(EndSlimeEntity.class, EntityDataSerializers.BYTE);
@ -75,7 +76,7 @@ public class EndSlimeEntity extends Slime {
@Override
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
EndBiome biome = EndBiomes.getFromBiome(world.getBiome(blockPosition()));
BCLBiome biome = BiomeAPI.getFromBiome(world.getBiome(blockPosition()));
if (biome == EndBiomes.FOGGY_MUSHROOMLAND) {
this.setMossy();
}
@ -204,7 +205,7 @@ public class EndSlimeEntity extends Slime {
private static boolean isPermanentBiome(ServerLevelAccessor world, BlockPos pos) {
Biome biome = world.getBiome(pos);
return EndBiomes.getFromBiome(biome) == EndBiomes.CHORUS_FOREST;
return BiomeAPI.getFromBiome(biome) == EndBiomes.CHORUS_FOREST;
}
private static boolean notManyEntities(ServerLevelAccessor world, BlockPos pos, int radius, int maxCount) {

View file

@ -22,8 +22,8 @@ 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 ru.bclib.world.features.BCLFeature;
import ru.betterend.BetterEnd;
import ru.betterend.world.features.EndFeature;
public abstract class ModIntegration {
private final String modID;
@ -60,13 +60,13 @@ public abstract class ModIntegration {
return FabricLoader.getInstance().isModLoaded(modID);
}
public EndFeature getFeature(String featureID, String configuredFeatureID, GenerationStep.Decoration featureStep) {
public BCLFeature getFeature(String featureID, String configuredFeatureID, GenerationStep.Decoration featureStep) {
Feature<?> feature = Registry.FEATURE.get(getID(featureID));
ConfiguredFeature<?, ?> featureConfigured = BuiltinRegistries.CONFIGURED_FEATURE.get(getID(configuredFeatureID));
return new EndFeature(feature, featureConfigured, featureStep);
return new BCLFeature(feature, featureConfigured, featureStep);
}
public EndFeature getFeature(String name, GenerationStep.Decoration featureStep) {
public BCLFeature getFeature(String name, GenerationStep.Decoration featureStep) {
return getFeature(name, name, featureStep);
}

View file

@ -7,8 +7,10 @@ import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.ai.behavior.WeightedList;
import net.minecraft.world.level.biome.Biome;
import ru.bclib.api.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.util.TagHelper;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.integration.Integrations;
import ru.betterend.integration.ModIntegration;
import ru.betterend.integration.byg.biomes.BYGBiomes;
@ -41,13 +43,13 @@ public class BYGIntegration extends ModIntegration {
Biome biome = this.getAndExecuteRuntime(biomeClass, obj, "getBiome");
if (biome != null) {
ResourceLocation biomeID = BuiltinRegistries.BIOME.getKey(biome);
EndBiome endBiome = EndBiomes.getBiome(biomeID);
BCLBiome endBiome = BiomeAPI.getBiome(biomeID);
Biome edge = this.getAndExecuteRuntime(biomeClass, obj, "getEdge");
if (edge != null) {
ResourceLocation edgeID = BuiltinRegistries.BIOME.getKey(edge);
EndBiomes.LAND_BIOMES.removeMutableBiome(edgeID);
EndBiomes.VOID_BIOMES.removeMutableBiome(edgeID);
EndBiome edgeBiome = EndBiomes.getBiome(edgeID);
BCLBiome edgeBiome = BiomeAPI.getBiome(edgeID);
endBiome.setEdge(edgeBiome);
}
else {
@ -59,7 +61,7 @@ public class BYGIntegration extends ModIntegration {
WeightedList<ResourceLocation> subBiomes = this.getAndExecuteRuntime(biomeClass, obj, "getHills");
if (subBiomes != null) {
subBiomes.stream().collect(Collectors.toList()).forEach((id) -> {
EndBiome subBiome = EndBiomes.getBiome(id);
BCLBiome subBiome = BiomeAPI.getBiome(id);
EndBiomes.LAND_BIOMES.removeMutableBiome(id);
EndBiomes.VOID_BIOMES.removeMutableBiome(id);
if (!endBiome.containsSubBiome(subBiome)) {

View file

@ -22,7 +22,7 @@ public class EterialGrove extends EndBiome {
Biome biome = Integrations.BYG.getBiome("ethereal_islands");
BiomeSpecialEffects effects = biome.getSpecialEffects();
BiomeDefinition def = new BiomeDefinition("eterial_grove")
BiomeDefinition def = (BiomeDefinition) new BiomeDefinition("eterial_grove")
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get())
.addFeature(BYGFeatures.BIG_ETHER_TREE);

View file

@ -25,7 +25,7 @@ public class NightshadeRedwoods extends EndBiome {
Biome biome = Integrations.BYG.getBiome("nightshade_forest");
BiomeSpecialEffects effects = biome.getSpecialEffects();
BiomeDefinition def = new BiomeDefinition("nightshade_redwoods")
BiomeDefinition def = (BiomeDefinition) new BiomeDefinition("nightshade_redwoods")
.setFogColor(140, 108, 47)
.setFogDensity(1.5F)
.setWaterAndFogColor(55, 70, 186)

View file

@ -34,7 +34,7 @@ public class OldBulbisGardens extends EndBiome {
Block ivis = Integrations.BYG.getBlock("ivis_phylium");
Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock();
BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens")
BiomeDefinition def = (BiomeDefinition) new BiomeDefinition("old_bulbis_gardens")
.setFogColor(215, 132, 207)
.setFogDensity(1.8F)
.setWaterAndFogColor(40, 0, 56)

View file

@ -1,24 +1,31 @@
package ru.betterend.integration.byg.features;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.world.features.BCLFeature;
import ru.betterend.BetterEnd;
import ru.betterend.integration.Integrations;
import ru.betterend.integration.byg.BYGBlocks;
import ru.betterend.world.features.EndFeature;
import ru.betterend.world.features.SinglePlantFeature;
import ru.betterend.world.features.VineFeature;
import ru.betterend.world.features.WallPlantFeature;
import ru.betterend.world.features.WallPlantOnLogFeature;
public class BYGFeatures {
public static final EndFeature OLD_BULBIS_TREE = new EndFeature("old_bulbis_tree", new OldBulbisTreeFeature(), 1);
public static final EndFeature IVIS_SPROUT = new EndFeature("ivis_sprout", new SinglePlantFeature(Integrations.BYG.getBlock("ivis_sprout"), 6, 2), 6);
public static final EndFeature IVIS_VINE = new EndFeature("ivis_vine", new VineFeature(BYGBlocks.IVIS_VINE, 24), 5);
public static final EndFeature IVIS_MOSS = new EndFeature("ivis_moss", new WallPlantFeature(BYGBlocks.IVIS_MOSS, 6), 1);
public static final EndFeature IVIS_MOSS_WOOD = new EndFeature("ivis_moss_wood", new WallPlantOnLogFeature(BYGBlocks.IVIS_MOSS, 6), 15);
public static final EndFeature NIGHTSHADE_MOSS = new EndFeature("nightshade_moss", new WallPlantFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 2);
public static final EndFeature NIGHTSHADE_MOSS_WOOD = new EndFeature("nightshade_moss_wood", new WallPlantOnLogFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 8);
public static final BCLFeature OLD_BULBIS_TREE = redisterVegetation("old_bulbis_tree", new OldBulbisTreeFeature(), 1);
public static final BCLFeature IVIS_SPROUT = redisterVegetation("ivis_sprout", new SinglePlantFeature(Integrations.BYG.getBlock("ivis_sprout"), 6, 2), 6);
public static final BCLFeature IVIS_VINE = redisterVegetation("ivis_vine", new VineFeature(BYGBlocks.IVIS_VINE, 24), 5);
public static final BCLFeature IVIS_MOSS = redisterVegetation("ivis_moss", new WallPlantFeature(BYGBlocks.IVIS_MOSS, 6), 1);
public static final BCLFeature IVIS_MOSS_WOOD = redisterVegetation("ivis_moss_wood", new WallPlantOnLogFeature(BYGBlocks.IVIS_MOSS, 6), 15);
public static final BCLFeature NIGHTSHADE_MOSS = redisterVegetation("nightshade_moss", new WallPlantFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 2);
public static final BCLFeature NIGHTSHADE_MOSS_WOOD = redisterVegetation("nightshade_moss_wood", new WallPlantOnLogFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 8);
public static final EndFeature NIGHTSHADE_REDWOOD_TREE = new EndFeature("nightshade_redwood_tree", new NightshadeRedwoodTreeFeature(), 1);
public static final EndFeature BIG_ETHER_TREE = new EndFeature("big_ether_tree", new BigEtherTreeFeature(), 1);
public static final BCLFeature NIGHTSHADE_REDWOOD_TREE = redisterVegetation("nightshade_redwood_tree", new NightshadeRedwoodTreeFeature(), 1);
public static final BCLFeature BIG_ETHER_TREE = redisterVegetation("big_ether_tree", new BigEtherTreeFeature(), 1);
public static void register() {}
private static BCLFeature redisterVegetation(String name, Feature<NoneFeatureConfiguration> feature, int density) {
return BCLFeature.makeVegetationFeature(BetterEnd.makeID(name), feature, density);
}
}

View file

@ -16,8 +16,8 @@ import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.util.MHelper;
import ru.bclib.util.SplineHelper;
import ru.bclib.world.features.DefaultFeature;
import ru.betterend.integration.Integrations;
import ru.betterend.world.features.DefaultFeature;
public class BigEtherTreeFeature extends DefaultFeature {
@Override

View file

@ -28,8 +28,8 @@ 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.integration.Integrations;
import ru.betterend.world.features.DefaultFeature;
public class GreatNightshadeTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH;

View file

@ -28,8 +28,8 @@ 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.integration.Integrations;
import ru.betterend.world.features.DefaultFeature;
public class NightshadeRedwoodTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH;

View file

@ -25,9 +25,9 @@ import ru.bclib.sdf.operator.SDFUnion;
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.integration.Integrations;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.world.features.DefaultFeature;
public class OldBulbisTreeFeature extends DefaultFeature {
private static final List<Vector3f> SPLINE;

View file

@ -22,10 +22,10 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biome.BiomeCategory;
import net.minecraft.world.level.material.FluidState;
import ru.bclib.api.BiomeAPI;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.client.ClientOptions;
import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BackgroundInfo;
import ru.betterend.world.biome.EndBiome;
@Mixin(FogRenderer.class)
public class BackgroundRendererMixin {
@ -74,7 +74,7 @@ public class BackgroundRendererMixin {
Biome biome = entity.level.getBiome(entity.blockPosition());
FluidState fluidState = camera.getFluidInCamera();
if (ClientOptions.useFogDensity() && biome.getBiomeCategory() == BiomeCategory.THEEND && fluidState.isEmpty()) {
EndBiome endBiome = EndBiomes.getRenderBiome(biome);
BCLBiome endBiome = BiomeAPI.getRenderBiome(biome);
if (fogDensity == 0) {
fogDensity = endBiome.getFogDensity();

View file

@ -31,7 +31,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
super(settings);
}
@Inject(method = "<init>*", at = @At("TAIL"))
/*@Inject(method = "<init>*", at = @At("TAIL"))
private void beOnInit(BlockBehaviour.Properties settings, CallbackInfo info) {
if (GeneratorOptions.changeChorusPlant()) {
this.registerDefaultState(this.defaultBlockState().setValue(BlockProperties.ROOTS, false));
@ -118,5 +118,5 @@ public abstract class ChorusPlantBlockMixin extends Block {
info.setReturnValue(plant);
info.cancel();
}
}
}*/
}

View file

@ -33,6 +33,7 @@ import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.level.storage.WritableLevelData;
import ru.bclib.api.BiomeAPI;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlocks;
@ -102,7 +103,7 @@ public abstract class ServerLevelMixin extends Level {
)
private BlockState be_modifyTickState(BlockPos pos, BlockState state) {
if (state.is(Blocks.ICE)) {
ResourceLocation biome = EndBiomes.getBiomeID(getBiome(pos));
ResourceLocation biome = BiomeAPI.getBiomeID(getBiome(pos));
if (biome.getNamespace().equals(BetterEnd.MOD_ID)) {
state = EndBlocks.EMERALD_ICE.defaultBlockState();
}

View file

@ -13,11 +13,8 @@ import com.google.common.collect.Sets;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
import net.fabricmc.fabric.impl.biome.WeightedBiomePicker;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceKey;
@ -26,7 +23,11 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biome.BiomeCategory;
import net.minecraft.world.level.biome.Biomes;
import ru.bclib.api.BiomeAPI;
import ru.bclib.util.JsonFactory;
import ru.bclib.world.biomes.BCLBiome;
import ru.bclib.world.generator.BiomeMap;
import ru.bclib.world.generator.BiomePicker;
import ru.betterend.BetterEnd;
import ru.betterend.config.Configs;
import ru.betterend.integration.Integrations;
@ -57,8 +58,6 @@ import ru.betterend.world.biome.land.PaintedMountainsBiome;
import ru.betterend.world.biome.land.ShadowForestBiome;
import ru.betterend.world.biome.land.SulphurSpringsBiome;
import ru.betterend.world.biome.land.UmbrellaJungleBiome;
import ru.betterend.world.generator.BiomeMap;
import ru.betterend.world.generator.BiomePicker;
import ru.betterend.world.generator.BiomeType;
import ru.betterend.world.generator.GeneratorOptions;
@ -71,7 +70,7 @@ public class EndBiomes {
public static final BiomePicker LAND_BIOMES = new BiomePicker();
public static final BiomePicker VOID_BIOMES = new BiomePicker();
public static final BiomePicker CAVE_BIOMES = new BiomePicker();
public static final List<EndBiome> SUBBIOMES = Lists.newArrayList();
public static final List<BCLBiome> SUBBIOMES = Lists.newArrayList();
private static final JsonObject EMPTY_JSON = new JsonObject();
private static Registry<Biome> biomeRegistry;
@ -300,12 +299,12 @@ public class EndBiomes {
*/
public static EndBiome registerSubBiome(EndBiome biome, EndBiome parent) {
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
registerBiomeDirectly(biome);
BiomeAPI.registerBiomeDirectly(biome);
parent.addSubBiome(biome);
SUBBIOMES.add(biome);
SUBBIOMES_UNMUTABLES.add(biome.getID());
ID_MAP.put(biome.getID(), biome);
addLandBiomeToFabricApi(biome);
BiomeAPI.addEndLandBiomeToFabricApi(biome);
}
return biome;
}
@ -318,14 +317,14 @@ public class EndBiomes {
*/
public static EndBiome registerBiome(EndBiome biome, BiomeType type) {
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
registerBiomeDirectly(biome);
BiomeAPI.registerBiomeDirectly(biome);
addToPicker(biome, type);
ID_MAP.put(biome.getID(), biome);
if (type == BiomeType.LAND) {
addLandBiomeToFabricApi(biome);
BiomeAPI.addEndLandBiomeToFabricApi(biome);
}
else {
addVoidBiomeToFabricApi(biome);
BiomeAPI.addEndVoidBiomeToFabricApi(biome);
}
}
return biome;
@ -338,11 +337,11 @@ public class EndBiomes {
*/
public static EndBiome registerSubBiomeIntegration(EndBiome biome) {
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
registerBiomeDirectly(biome);
BiomeAPI.registerBiomeDirectly(biome);
SUBBIOMES.add(biome);
SUBBIOMES_UNMUTABLES.add(biome.getID());
ID_MAP.put(biome.getID(), biome);
addLandBiomeToFabricApi(biome);
BiomeAPI.addEndLandBiomeToFabricApi(biome);
}
return biome;
}
@ -377,70 +376,10 @@ public class EndBiomes {
VOID_BIOMES.addBiome(biome);
}
}
private static void registerBiomeDirectly(EndBiome biome) {
Registry.register(BuiltinRegistries.BIOME, biome.getID(), biome.getBiome());
}
private static void addLandBiomeToFabricApi(EndBiome biome) {
float weight = biome.getGenChanceImmutable();
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get();
InternalBiomeData.addEndBiomeReplacement(Biomes.END_HIGHLANDS, key, weight);
InternalBiomeData.addEndBiomeReplacement(Biomes.END_MIDLANDS, key, weight);
}
private static void addVoidBiomeToFabricApi(EndBiome biome) {
float weight = biome.getGenChanceImmutable();
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get();
InternalBiomeData.addEndBiomeReplacement(Biomes.SMALL_END_ISLANDS, key, weight);
}
public static EndBiome getFromBiome(Biome biome) {
return ID_MAP.getOrDefault(biomeRegistry.getKey(biome), END);
}
@Environment(EnvType.CLIENT)
public static EndBiome getRenderBiome(Biome biome) {
EndBiome endBiome = CLIENT.get(biome);
if (endBiome == null) {
Minecraft minecraft = Minecraft.getInstance();
ResourceLocation id = minecraft.level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getKey(biome);
endBiome = id == null ? END : ID_MAP.getOrDefault(id, END);
CLIENT.put(biome, endBiome);
}
return endBiome;
}
public static ResourceLocation getBiomeID(Biome biome) {
ResourceLocation id = biomeRegistry.getKey(biome);
return id == null ? END.getID() : id;
}
public static EndBiome getBiome(ResourceLocation biomeID) {
return ID_MAP.getOrDefault(biomeID, END);
}
public static Biome getActualBiome(EndBiome biome) {
Biome actual = biome.getActualBiome();
if (actual == null) {
biome.updateActualBiomes(biomeRegistry);
actual = biome.getActualBiome();
}
return actual;
}
public static List<EndBiome> getModBiomes() {
List<EndBiome> result = Lists.newArrayList();
result.addAll(EndBiomes.LAND_BIOMES.getBiomes());
result.addAll(EndBiomes.VOID_BIOMES.getBiomes());
result.addAll(EndBiomes.CAVE_BIOMES.getBiomes());
result.addAll(SUBBIOMES);
return result;
}
public static EndCaveBiome registerCaveBiome(EndCaveBiome biome) {
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
registerBiomeDirectly(biome);
BiomeAPI.registerBiomeDirectly(biome);
CAVE_BIOMES.addBiome(biome);
ID_MAP.put(biome.getID(), biome);
}

View file

@ -7,10 +7,20 @@ import com.google.common.collect.Lists;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
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.placement.FeatureDecorator;
import ru.bclib.api.BiomeAPI;
import ru.bclib.world.features.BCLFeature;
import ru.bclib.world.features.DefaultFeature;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.complex.StoneMaterial;
import ru.betterend.world.biome.BiomeDefinition;
import ru.betterend.world.biome.EndBiome;
import ru.betterend.world.features.BiomeIslandFeature;
@ -18,9 +28,7 @@ import ru.betterend.world.features.BlueVineFeature;
import ru.betterend.world.features.CavePumpkinFeature;
import ru.betterend.world.features.CharniaFeature;
import ru.betterend.world.features.CrashedShipFeature;
import ru.betterend.world.features.DefaultFeature;
import ru.betterend.world.features.DoublePlantFeature;
import ru.betterend.world.features.EndFeature;
import ru.betterend.world.features.EndLilyFeature;
import ru.betterend.world.features.EndLotusFeature;
import ru.betterend.world.features.EndLotusLeafFeature;
@ -51,6 +59,7 @@ import ru.betterend.world.features.terrain.GeyserFeature;
import ru.betterend.world.features.terrain.IceStarFeature;
import ru.betterend.world.features.terrain.ObsidianBoulderFeature;
import ru.betterend.world.features.terrain.ObsidianPillarBasementFeature;
import ru.betterend.world.features.terrain.OreLayerFeature;
import ru.betterend.world.features.terrain.SingleBlockFeature;
import ru.betterend.world.features.terrain.SmaragdantCrystalFeature;
import ru.betterend.world.features.terrain.SpireFeature;
@ -75,147 +84,147 @@ import ru.betterend.world.generator.GeneratorOptions;
public class EndFeatures {
// Trees //
public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
public static final EndFeature PYTHADENDRON_TREE = new EndFeature("pythadendron_tree", new PythadendronTreeFeature(), 2);
public static final EndFeature LACUGROVE = new EndFeature("lacugrove", new LacugroveFeature(), 4);
public static final EndFeature DRAGON_TREE = new EndFeature("dragon_tree", new DragonTreeFeature(), 3);
public static final EndFeature TENANEA = new EndFeature("tenanea", new TenaneaFeature(), 3);
public static final EndFeature HELIX_TREE = new EndFeature("helix_tree", new HelixTreeFeature(), 2);
public static final EndFeature UMBRELLA_TREE = new EndFeature("umbrella_tree", new UmbrellaTreeFeature(), 4);
public static final EndFeature JELLYSHROOM = new EndFeature("jellyshroom", new JellyshroomFeature(), 3);
public static final EndFeature GIGANTIC_AMARANITA = new EndFeature("gigantic_amaranita", new GiganticAmaranitaFeature(), 1);
public static final EndFeature LUCERNIA = new EndFeature("lucernia", new LucerniaFeature(), 3);
public static final BCLFeature MOSSY_GLOWSHROOM = redisterVegetation("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
public static final BCLFeature PYTHADENDRON_TREE = redisterVegetation("pythadendron_tree", new PythadendronTreeFeature(), 2);
public static final BCLFeature LACUGROVE = redisterVegetation("lacugrove", new LacugroveFeature(), 4);
public static final BCLFeature DRAGON_TREE = redisterVegetation("dragon_tree", new DragonTreeFeature(), 3);
public static final BCLFeature TENANEA = redisterVegetation("tenanea", new TenaneaFeature(), 3);
public static final BCLFeature HELIX_TREE = redisterVegetation("helix_tree", new HelixTreeFeature(), 2);
public static final BCLFeature UMBRELLA_TREE = redisterVegetation("umbrella_tree", new UmbrellaTreeFeature(), 4);
public static final BCLFeature JELLYSHROOM = redisterVegetation("jellyshroom", new JellyshroomFeature(), 3);
public static final BCLFeature GIGANTIC_AMARANITA = redisterVegetation("gigantic_amaranita", new GiganticAmaranitaFeature(), 1);
public static final BCLFeature LUCERNIA = redisterVegetation("lucernia", new LucerniaFeature(), 3);
// Bushes //
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new BushFeature(EndBlocks.PYTHADENDRON_LEAVES, EndBlocks.PYTHADENDRON.bark), 4);
public static final EndFeature DRAGON_TREE_BUSH = new EndFeature("dragon_tree_bush", new BushFeature(EndBlocks.DRAGON_TREE_LEAVES, EndBlocks.DRAGON_TREE.bark), 15);
public static final EndFeature TENANEA_BUSH = new EndFeature("tenanea_bush", new TenaneaBushFeature(), 10);
public static final EndFeature LUMECORN = new EndFeature("lumecorn", new Lumecorn(), 5);
public static final EndFeature LARGE_AMARANITA = new EndFeature("large_amaranita", new LargeAmaranitaFeature(), 5);
public static final EndFeature LUCERNIA_BUSH = new EndFeature("lucernia_bush", new BushWithOuterFeature(EndBlocks.LUCERNIA_LEAVES, EndBlocks.LUCERNIA_OUTER_LEAVES, EndBlocks.LUCERNIA.bark), 10);
public static final EndFeature LUCERNIA_BUSH_RARE = new EndFeature("lucernia_bush_rare", new BushWithOuterFeature(EndBlocks.LUCERNIA_LEAVES, EndBlocks.LUCERNIA_OUTER_LEAVES, EndBlocks.LUCERNIA.bark), 1);
public static final EndFeature NEON_CACTUS = new EndFeature("neon_cactus", new NeonCactusFeature(), 2);
public static final BCLFeature PYTHADENDRON_BUSH = redisterVegetation("pythadendron_bush", new BushFeature(EndBlocks.PYTHADENDRON_LEAVES, EndBlocks.PYTHADENDRON.bark), 4);
public static final BCLFeature DRAGON_TREE_BUSH = redisterVegetation("dragon_tree_bush", new BushFeature(EndBlocks.DRAGON_TREE_LEAVES, EndBlocks.DRAGON_TREE.bark), 15);
public static final BCLFeature TENANEA_BUSH = redisterVegetation("tenanea_bush", new TenaneaBushFeature(), 10);
public static final BCLFeature LUMECORN = redisterVegetation("lumecorn", new Lumecorn(), 5);
public static final BCLFeature LARGE_AMARANITA = redisterVegetation("large_amaranita", new LargeAmaranitaFeature(), 5);
public static final BCLFeature LUCERNIA_BUSH = redisterVegetation("lucernia_bush", new BushWithOuterFeature(EndBlocks.LUCERNIA_LEAVES, EndBlocks.LUCERNIA_OUTER_LEAVES, EndBlocks.LUCERNIA.bark), 10);
public static final BCLFeature LUCERNIA_BUSH_RARE = redisterVegetation("lucernia_bush_rare", new BushWithOuterFeature(EndBlocks.LUCERNIA_LEAVES, EndBlocks.LUCERNIA_OUTER_LEAVES, EndBlocks.LUCERNIA.bark), 1);
public static final BCLFeature NEON_CACTUS = redisterVegetation("neon_cactus", new NeonCactusFeature(), 2);
// Plants //
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS_TALL, 5), 5);
public static final EndFeature CREEPING_MOSS = new EndFeature("creeping_moss", new SinglePlantFeature(EndBlocks.CREEPING_MOSS, 5), 5);
public static final EndFeature BLUE_VINE = new EndFeature("blue_vine", new BlueVineFeature(), 1);
public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4), 5);
public static final EndFeature CRYSTAL_GRASS = new EndFeature("crystal_grass", new SinglePlantFeature(EndBlocks.CRYSTAL_GRASS, 8, false), 5);
public static final EndFeature SHADOW_PLANT = new EndFeature("shadow_plant", new SinglePlantFeature(EndBlocks.SHADOW_PLANT, 6), 9);
public static final EndFeature MURKWEED = new EndFeature("murkweed", new SinglePlantFeature(EndBlocks.MURKWEED, 3), 2);
public static final EndFeature NEEDLEGRASS = new EndFeature("needlegrass", new SinglePlantFeature(EndBlocks.NEEDLEGRASS, 3), 2);
public static final EndFeature SHADOW_BERRY = new EndFeature("shadow_berry", new SinglePlantFeature(EndBlocks.SHADOW_BERRY, 2), 1);
public static final EndFeature BUSHY_GRASS = new EndFeature("bushy_grass", new SinglePlantFeature(EndBlocks.BUSHY_GRASS, 8, false), 20);
public static final EndFeature BUSHY_GRASS_WG = new EndFeature("bushy_grass_wg", new SinglePlantFeature(EndBlocks.BUSHY_GRASS, 5), 10);
public static final EndFeature AMBER_GRASS = new EndFeature("amber_grass", new SinglePlantFeature(EndBlocks.AMBER_GRASS, 6), 9);
public static final EndFeature LANCELEAF = new EndFeature("lanceleaf", new LanceleafFeature(), 3);
public static final EndFeature GLOW_PILLAR = new EndFeature("glow_pillar", new GlowPillarFeature(), 1);
public static final EndFeature TWISTED_UMBRELLA_MOSS = new EndFeature("twisted_umbrella_moss", new DoublePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS_TALL, 6), 5);
public static final EndFeature JUNGLE_GRASS = new EndFeature("jungle_grass", new SinglePlantFeature(EndBlocks.JUNGLE_GRASS, 7, 3), 8);
public static final EndFeature SMALL_JELLYSHROOM_FLOOR = new EndFeature("small_jellyshroom_floor", new SinglePlantFeature(EndBlocks.SMALL_JELLYSHROOM, 5, 5), 4);
public static final EndFeature BLOSSOM_BERRY = new EndFeature("blossom_berry", new SinglePlantFeature(EndBlocks.BLOSSOM_BERRY, 3, 3), 2);
public static final EndFeature BLOOMING_COOKSONIA = new EndFeature("blooming_cooksonia", new SinglePlantFeature(EndBlocks.BLOOMING_COOKSONIA, 5), 5);
public static final EndFeature SALTEAGO = new EndFeature("salteago", new SinglePlantFeature(EndBlocks.SALTEAGO, 5), 5);
public static final EndFeature VAIOLUSH_FERN = new EndFeature("vaiolush_fern", new SinglePlantFeature(EndBlocks.VAIOLUSH_FERN, 5), 5);
public static final EndFeature FRACTURN = new EndFeature("fracturn", new SinglePlantFeature(EndBlocks.FRACTURN, 5), 5);
public static final EndFeature UMBRELLA_MOSS_RARE = new EndFeature("umbrella_moss_rare", new SinglePlantFeature(EndBlocks.UMBRELLA_MOSS, 3), 2);
public static final EndFeature CREEPING_MOSS_RARE = new EndFeature("creeping_moss_rare", new SinglePlantFeature(EndBlocks.CREEPING_MOSS, 3), 2);
public static final EndFeature TWISTED_UMBRELLA_MOSS_RARE = new EndFeature("twisted_umbrella_moss_rare", new SinglePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, 3), 2);
public static final EndFeature ORANGO = new EndFeature("orango", new SinglePlantFeature(EndBlocks.ORANGO, 5), 6);
public static final EndFeature AERIDIUM = new EndFeature("aeridium", new SinglePlantFeature(EndBlocks.AERIDIUM, 5, 4), 5);
public static final EndFeature LUTEBUS = new EndFeature("lutebus", new SinglePlantFeature(EndBlocks.LUTEBUS, 5, 2), 5);
public static final EndFeature LAMELLARIUM = new EndFeature("lamellarium", new SinglePlantFeature(EndBlocks.LAMELLARIUM, 5), 6);
public static final EndFeature SMALL_AMARANITA = new EndFeature("small_amaranita", new SinglePlantFeature(EndBlocks.SMALL_AMARANITA_MUSHROOM, 5, 5), 4);
public static final EndFeature GLOBULAGUS = new EndFeature("globulagus", new SinglePlantFeature(EndBlocks.GLOBULAGUS, 5, 3), 6);
public static final EndFeature CLAWFERN = new EndFeature("clawfern", new SinglePlantFeature(EndBlocks.CLAWFERN, 5, 4), 5);
public static final EndFeature BOLUX_MUSHROOM = new EndFeature("bolux_mushroom", new SinglePlantFeature(EndBlocks.BOLUX_MUSHROOM, 5, 5), 2);
public static final EndFeature CHORUS_MUSHROOM = new EndFeature("chorus_mushroom", new SinglePlantFeature(EndBlocks.CHORUS_MUSHROOM, 5, 5), 1);
public static final EndFeature AMBER_ROOT = new EndFeature("amber_root", new SinglePlantFeature(EndBlocks.AMBER_ROOT, 5, 5), 1);
//public static final EndFeature PEARLBERRY = new EndFeature("pearlberry", new SinglePlantFeature(EndBlocks.PEARLBERRY, 5, 5), 1);
public static final BCLFeature UMBRELLA_MOSS = redisterVegetation("umbrella_moss", new DoublePlantFeature(EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS_TALL, 5), 5);
public static final BCLFeature CREEPING_MOSS = redisterVegetation("creeping_moss", new SinglePlantFeature(EndBlocks.CREEPING_MOSS, 5), 5);
public static final BCLFeature BLUE_VINE = redisterVegetation("blue_vine", new BlueVineFeature(), 1);
public static final BCLFeature CHORUS_GRASS = redisterVegetation("chorus_grass", new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4), 5);
public static final BCLFeature CRYSTAL_GRASS = redisterVegetation("crystal_grass", new SinglePlantFeature(EndBlocks.CRYSTAL_GRASS, 8, false), 5);
public static final BCLFeature SHADOW_PLANT = redisterVegetation("shadow_plant", new SinglePlantFeature(EndBlocks.SHADOW_PLANT, 6), 9);
public static final BCLFeature MURKWEED = redisterVegetation("murkweed", new SinglePlantFeature(EndBlocks.MURKWEED, 3), 2);
public static final BCLFeature NEEDLEGRASS = redisterVegetation("needlegrass", new SinglePlantFeature(EndBlocks.NEEDLEGRASS, 3), 2);
public static final BCLFeature SHADOW_BERRY = redisterVegetation("shadow_berry", new SinglePlantFeature(EndBlocks.SHADOW_BERRY, 2), 1);
public static final BCLFeature BUSHY_GRASS = redisterVegetation("bushy_grass", new SinglePlantFeature(EndBlocks.BUSHY_GRASS, 8, false), 20);
public static final BCLFeature BUSHY_GRASS_WG = redisterVegetation("bushy_grass_wg", new SinglePlantFeature(EndBlocks.BUSHY_GRASS, 5), 10);
public static final BCLFeature AMBER_GRASS = redisterVegetation("amber_grass", new SinglePlantFeature(EndBlocks.AMBER_GRASS, 6), 9);
public static final BCLFeature LANCELEAF = redisterVegetation("lanceleaf", new LanceleafFeature(), 3);
public static final BCLFeature GLOW_PILLAR = redisterVegetation("glow_pillar", new GlowPillarFeature(), 1);
public static final BCLFeature TWISTED_UMBRELLA_MOSS = redisterVegetation("twisted_umbrella_moss", new DoublePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS_TALL, 6), 5);
public static final BCLFeature JUNGLE_GRASS = redisterVegetation("jungle_grass", new SinglePlantFeature(EndBlocks.JUNGLE_GRASS, 7, 3), 8);
public static final BCLFeature SMALL_JELLYSHROOM_FLOOR = redisterVegetation("small_jellyshroom_floor", new SinglePlantFeature(EndBlocks.SMALL_JELLYSHROOM, 5, 5), 4);
public static final BCLFeature BLOSSOM_BERRY = redisterVegetation("blossom_berry", new SinglePlantFeature(EndBlocks.BLOSSOM_BERRY, 3, 3), 2);
public static final BCLFeature BLOOMING_COOKSONIA = redisterVegetation("blooming_cooksonia", new SinglePlantFeature(EndBlocks.BLOOMING_COOKSONIA, 5), 5);
public static final BCLFeature SALTEAGO = redisterVegetation("salteago", new SinglePlantFeature(EndBlocks.SALTEAGO, 5), 5);
public static final BCLFeature VAIOLUSH_FERN = redisterVegetation("vaiolush_fern", new SinglePlantFeature(EndBlocks.VAIOLUSH_FERN, 5), 5);
public static final BCLFeature FRACTURN = redisterVegetation("fracturn", new SinglePlantFeature(EndBlocks.FRACTURN, 5), 5);
public static final BCLFeature UMBRELLA_MOSS_RARE = redisterVegetation("umbrella_moss_rare", new SinglePlantFeature(EndBlocks.UMBRELLA_MOSS, 3), 2);
public static final BCLFeature CREEPING_MOSS_RARE = redisterVegetation("creeping_moss_rare", new SinglePlantFeature(EndBlocks.CREEPING_MOSS, 3), 2);
public static final BCLFeature TWISTED_UMBRELLA_MOSS_RARE = redisterVegetation("twisted_umbrella_moss_rare", new SinglePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, 3), 2);
public static final BCLFeature ORANGO = redisterVegetation("orango", new SinglePlantFeature(EndBlocks.ORANGO, 5), 6);
public static final BCLFeature AERIDIUM = redisterVegetation("aeridium", new SinglePlantFeature(EndBlocks.AERIDIUM, 5, 4), 5);
public static final BCLFeature LUTEBUS = redisterVegetation("lutebus", new SinglePlantFeature(EndBlocks.LUTEBUS, 5, 2), 5);
public static final BCLFeature LAMELLARIUM = redisterVegetation("lamellarium", new SinglePlantFeature(EndBlocks.LAMELLARIUM, 5), 6);
public static final BCLFeature SMALL_AMARANITA = redisterVegetation("small_amaranita", new SinglePlantFeature(EndBlocks.SMALL_AMARANITA_MUSHROOM, 5, 5), 4);
public static final BCLFeature GLOBULAGUS = redisterVegetation("globulagus", new SinglePlantFeature(EndBlocks.GLOBULAGUS, 5, 3), 6);
public static final BCLFeature CLAWFERN = redisterVegetation("clawfern", new SinglePlantFeature(EndBlocks.CLAWFERN, 5, 4), 5);
public static final BCLFeature BOLUX_MUSHROOM = redisterVegetation("bolux_mushroom", new SinglePlantFeature(EndBlocks.BOLUX_MUSHROOM, 5, 5), 2);
public static final BCLFeature CHORUS_MUSHROOM = redisterVegetation("chorus_mushroom", new SinglePlantFeature(EndBlocks.CHORUS_MUSHROOM, 5, 5), 1);
public static final BCLFeature AMBER_ROOT = redisterVegetation("amber_root", new SinglePlantFeature(EndBlocks.AMBER_ROOT, 5, 5), 1);
//public static final BCLFeature PEARLBERRY = redisterVegetation("pearlberry", new SinglePlantFeature(EndBlocks.PEARLBERRY, 5, 5), 1);
// Vines //
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);
public static final EndFeature TWISTED_VINE = new EndFeature("twisted_vine", new VineFeature(EndBlocks.TWISTED_VINE, 24), 3);
public static final EndFeature BULB_VINE = new EndFeature("bulb_vine", new VineFeature(EndBlocks.BULB_VINE, 24), 5);
public static final EndFeature JUNGLE_VINE = new EndFeature("jungle_vine", new VineFeature(EndBlocks.JUNGLE_VINE, 24), 5);
public static final BCLFeature DENSE_VINE = redisterVegetation("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);
public static final BCLFeature TWISTED_VINE = redisterVegetation("twisted_vine", new VineFeature(EndBlocks.TWISTED_VINE, 24), 3);
public static final BCLFeature BULB_VINE = redisterVegetation("bulb_vine", new VineFeature(EndBlocks.BULB_VINE, 24), 5);
public static final BCLFeature JUNGLE_VINE = redisterVegetation("jungle_vine", new VineFeature(EndBlocks.JUNGLE_VINE, 24), 5);
// Ceil plants
public static final EndFeature SMALL_JELLYSHROOM_CEIL = new EndFeature("small_jellyshroom_ceil", new SingleInvertedScatterFeature(EndBlocks.SMALL_JELLYSHROOM, 8), 8);
public static final BCLFeature SMALL_JELLYSHROOM_CEIL = redisterVegetation("small_jellyshroom_ceil", new SingleInvertedScatterFeature(EndBlocks.SMALL_JELLYSHROOM, 8), 8);
// Wall Plants //
public static final EndFeature PURPLE_POLYPORE = new EndFeature("purple_polypore", new WallPlantOnLogFeature(EndBlocks.PURPLE_POLYPORE, 3), 5);
public static final EndFeature AURANT_POLYPORE = new EndFeature("aurant_polypore", new WallPlantOnLogFeature(EndBlocks.AURANT_POLYPORE, 3), 5);
public static final EndFeature TAIL_MOSS = new EndFeature("tail_moss", new WallPlantFeature(EndBlocks.TAIL_MOSS, 3), 15);
public static final EndFeature CYAN_MOSS = new EndFeature("cyan_moss", new WallPlantFeature(EndBlocks.CYAN_MOSS, 3), 15);
public static final EndFeature TAIL_MOSS_WOOD = new EndFeature("tail_moss_wood", new WallPlantOnLogFeature(EndBlocks.TAIL_MOSS, 4), 25);
public static final EndFeature CYAN_MOSS_WOOD = new EndFeature("cyan_moss_wood", new WallPlantOnLogFeature(EndBlocks.CYAN_MOSS, 4), 25);
public static final EndFeature TWISTED_MOSS = new EndFeature("twisted_moss", new WallPlantFeature(EndBlocks.TWISTED_MOSS, 6), 15);
public static final EndFeature TWISTED_MOSS_WOOD = new EndFeature("twisted_moss_wood", new WallPlantOnLogFeature(EndBlocks.TWISTED_MOSS, 6), 25);
public static final EndFeature BULB_MOSS = new EndFeature("bulb_moss", new WallPlantFeature(EndBlocks.BULB_MOSS, 6), 1);
public static final EndFeature BULB_MOSS_WOOD = new EndFeature("bulb_moss_wood", new WallPlantOnLogFeature(EndBlocks.BULB_MOSS, 6), 15);
public static final EndFeature SMALL_JELLYSHROOM_WALL = new EndFeature("small_jellyshroom_wall", new WallPlantFeature(EndBlocks.SMALL_JELLYSHROOM, 4), 4);
public static final EndFeature SMALL_JELLYSHROOM_WOOD = new EndFeature("small_jellyshroom_wood", new WallPlantOnLogFeature(EndBlocks.SMALL_JELLYSHROOM, 4), 8);
public static final EndFeature JUNGLE_FERN_WOOD = new EndFeature("jungle_fern_wood", new WallPlantOnLogFeature(EndBlocks.JUNGLE_FERN, 3), 12);
public static final EndFeature RUSCUS = new EndFeature("ruscus", new WallPlantFeature(EndBlocks.RUSCUS, 6), 10);
public static final EndFeature RUSCUS_WOOD = new EndFeature("ruscus_wood", new WallPlantOnLogFeature(EndBlocks.RUSCUS, 6), 10);
public static final BCLFeature PURPLE_POLYPORE = redisterVegetation("purple_polypore", new WallPlantOnLogFeature(EndBlocks.PURPLE_POLYPORE, 3), 5);
public static final BCLFeature AURANT_POLYPORE = redisterVegetation("aurant_polypore", new WallPlantOnLogFeature(EndBlocks.AURANT_POLYPORE, 3), 5);
public static final BCLFeature TAIL_MOSS = redisterVegetation("tail_moss", new WallPlantFeature(EndBlocks.TAIL_MOSS, 3), 15);
public static final BCLFeature CYAN_MOSS = redisterVegetation("cyan_moss", new WallPlantFeature(EndBlocks.CYAN_MOSS, 3), 15);
public static final BCLFeature TAIL_MOSS_WOOD = redisterVegetation("tail_moss_wood", new WallPlantOnLogFeature(EndBlocks.TAIL_MOSS, 4), 25);
public static final BCLFeature CYAN_MOSS_WOOD = redisterVegetation("cyan_moss_wood", new WallPlantOnLogFeature(EndBlocks.CYAN_MOSS, 4), 25);
public static final BCLFeature TWISTED_MOSS = redisterVegetation("twisted_moss", new WallPlantFeature(EndBlocks.TWISTED_MOSS, 6), 15);
public static final BCLFeature TWISTED_MOSS_WOOD = redisterVegetation("twisted_moss_wood", new WallPlantOnLogFeature(EndBlocks.TWISTED_MOSS, 6), 25);
public static final BCLFeature BULB_MOSS = redisterVegetation("bulb_moss", new WallPlantFeature(EndBlocks.BULB_MOSS, 6), 1);
public static final BCLFeature BULB_MOSS_WOOD = redisterVegetation("bulb_moss_wood", new WallPlantOnLogFeature(EndBlocks.BULB_MOSS, 6), 15);
public static final BCLFeature SMALL_JELLYSHROOM_WALL = redisterVegetation("small_jellyshroom_wall", new WallPlantFeature(EndBlocks.SMALL_JELLYSHROOM, 4), 4);
public static final BCLFeature SMALL_JELLYSHROOM_WOOD = redisterVegetation("small_jellyshroom_wood", new WallPlantOnLogFeature(EndBlocks.SMALL_JELLYSHROOM, 4), 8);
public static final BCLFeature JUNGLE_FERN_WOOD = redisterVegetation("jungle_fern_wood", new WallPlantOnLogFeature(EndBlocks.JUNGLE_FERN, 3), 12);
public static final BCLFeature RUSCUS = redisterVegetation("ruscus", new WallPlantFeature(EndBlocks.RUSCUS, 6), 10);
public static final BCLFeature RUSCUS_WOOD = redisterVegetation("ruscus_wood", new WallPlantOnLogFeature(EndBlocks.RUSCUS, 6), 10);
// Sky plants
public static final EndFeature FILALUX = new EndFeature("filalux", new FilaluxFeature(), 1);
public static final BCLFeature FILALUX = redisterVegetation("filalux", new FilaluxFeature(), 1);
// Water //
public static final EndFeature BUBBLE_CORAL = new EndFeature("bubble_coral", new UnderwaterPlantFeature(EndBlocks.BUBBLE_CORAL, 6), 10);
public static final EndFeature BUBBLE_CORAL_RARE = new EndFeature("bubble_coral_rare", new UnderwaterPlantFeature(EndBlocks.BUBBLE_CORAL, 3), 4);
public static final EndFeature END_LILY = new EndFeature("end_lily", new EndLilyFeature(6), 10);
public static final EndFeature END_LILY_RARE = new EndFeature("end_lily_rare", new EndLilyFeature(3), 4);
public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(7), 5);
public static final EndFeature END_LOTUS_LEAF = new EndFeature("end_lotus_leaf", new EndLotusLeafFeature(20), 25);
public static final EndFeature HYDRALUX = new EndFeature("hydralux", new HydraluxFeature(5), 5);
public static final EndFeature POND_ANEMONE = new EndFeature("pond_anemone", new UnderwaterPlantFeature(EndBlocks.POND_ANEMONE, 6), 10);
public static final BCLFeature BUBBLE_CORAL = redisterVegetation("bubble_coral", new UnderwaterPlantFeature(EndBlocks.BUBBLE_CORAL, 6), 10);
public static final BCLFeature BUBBLE_CORAL_RARE = redisterVegetation("bubble_coral_rare", new UnderwaterPlantFeature(EndBlocks.BUBBLE_CORAL, 3), 4);
public static final BCLFeature END_LILY = redisterVegetation("end_lily", new EndLilyFeature(6), 10);
public static final BCLFeature END_LILY_RARE = redisterVegetation("end_lily_rare", new EndLilyFeature(3), 4);
public static final BCLFeature END_LOTUS = redisterVegetation("end_lotus", new EndLotusFeature(7), 5);
public static final BCLFeature END_LOTUS_LEAF = redisterVegetation("end_lotus_leaf", new EndLotusLeafFeature(20), 25);
public static final BCLFeature HYDRALUX = redisterVegetation("hydralux", new HydraluxFeature(5), 5);
public static final BCLFeature POND_ANEMONE = redisterVegetation("pond_anemone", new UnderwaterPlantFeature(EndBlocks.POND_ANEMONE, 6), 10);
public static final EndFeature CHARNIA_RED = new EndFeature("charnia_red", new CharniaFeature(EndBlocks.CHARNIA_RED), 10);
public static final EndFeature CHARNIA_PURPLE = new EndFeature("charnia_purple", new CharniaFeature(EndBlocks.CHARNIA_PURPLE), 10);
public static final EndFeature CHARNIA_CYAN = new EndFeature("charnia_cyan", new CharniaFeature(EndBlocks.CHARNIA_CYAN), 10);
public static final EndFeature CHARNIA_LIGHT_BLUE = new EndFeature("charnia_light_blue", new CharniaFeature(EndBlocks.CHARNIA_LIGHT_BLUE), 10);
public static final EndFeature CHARNIA_ORANGE = new EndFeature("charnia_orange", new CharniaFeature(EndBlocks.CHARNIA_ORANGE), 10);
public static final EndFeature CHARNIA_GREEN = new EndFeature("charnia_green", new CharniaFeature(EndBlocks.CHARNIA_GREEN), 10);
public static final EndFeature MENGER_SPONGE = new EndFeature("menger_sponge", new MengerSpongeFeature(5), 1);
public static final EndFeature CHARNIA_RED_RARE = new EndFeature("charnia_red_rare", new CharniaFeature(EndBlocks.CHARNIA_RED), 2);
public static final EndFeature BIOME_ISLAND = EndFeature.makeFeatureConfigured("overworld_island", new BiomeIslandFeature());
public static final EndFeature FLAMAEA = new EndFeature("flamaea", new SinglePlantFeature(EndBlocks.FLAMAEA, 12, false, 5), 20);
public static final BCLFeature CHARNIA_RED = redisterVegetation("charnia_red", new CharniaFeature(EndBlocks.CHARNIA_RED), 10);
public static final BCLFeature CHARNIA_PURPLE = redisterVegetation("charnia_purple", new CharniaFeature(EndBlocks.CHARNIA_PURPLE), 10);
public static final BCLFeature CHARNIA_CYAN = redisterVegetation("charnia_cyan", new CharniaFeature(EndBlocks.CHARNIA_CYAN), 10);
public static final BCLFeature CHARNIA_LIGHT_BLUE = redisterVegetation("charnia_light_blue", new CharniaFeature(EndBlocks.CHARNIA_LIGHT_BLUE), 10);
public static final BCLFeature CHARNIA_ORANGE = redisterVegetation("charnia_orange", new CharniaFeature(EndBlocks.CHARNIA_ORANGE), 10);
public static final BCLFeature CHARNIA_GREEN = redisterVegetation("charnia_green", new CharniaFeature(EndBlocks.CHARNIA_GREEN), 10);
public static final BCLFeature MENGER_SPONGE = redisterVegetation("menger_sponge", new MengerSpongeFeature(5), 1);
public static final BCLFeature CHARNIA_RED_RARE = redisterVegetation("charnia_red_rare", new CharniaFeature(EndBlocks.CHARNIA_RED), 2);
public static final BCLFeature BIOME_ISLAND = BCLFeature.makeFeatureConfigured(BetterEnd.makeID("overworld_island"), new BiomeIslandFeature());
public static final BCLFeature FLAMAEA = redisterVegetation("flamaea", new SinglePlantFeature(EndBlocks.FLAMAEA, 12, false, 5), 20);
// Terrain //
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);
public static final EndFeature END_LAKE_NORMAL = EndFeature.makeLakeFeature("end_lake_normal", new EndLakeFeature(), 20);
public static final EndFeature END_LAKE_RARE = EndFeature.makeLakeFeature("end_lake_rare", new EndLakeFeature(), 40);
public static final EndFeature DESERT_LAKE = EndFeature.makeLakeFeature("desert_lake", new DesertLakeFeature(), 8);
public static final EndFeature ROUND_CAVE = EndFeature.makeRawGenFeature("round_cave", new RoundCaveFeature(), 2);
public static final EndFeature SPIRE = EndFeature.makeRawGenFeature("spire", new SpireFeature(), 2);
public static final EndFeature FLOATING_SPIRE = EndFeature.makeRawGenFeature("floating_spire", new FloatingSpireFeature(), 8);
public static final EndFeature GEYSER = EndFeature.makeRawGenFeature("geyser", new GeyserFeature(), 8);
public static final EndFeature SULPHURIC_LAKE = EndFeature.makeLakeFeature("sulphuric_lake", new SulphuricLakeFeature(), 8);
public static final EndFeature SULPHURIC_CAVE = EndFeature.makeCountRawFeature("sulphuric_cave", new SulphuricCaveFeature(), 2);
public static final EndFeature ICE_STAR = EndFeature.makeRawGenFeature("ice_star", new IceStarFeature(5, 15, 10, 25), 15);
public static final EndFeature ICE_STAR_SMALL = EndFeature.makeRawGenFeature("ice_star_small", new IceStarFeature(3, 5, 7, 12), 8);
public static final EndFeature SURFACE_VENT = EndFeature.makeChansedFeature("surface_vent", new SurfaceVentFeature(), 4);
public static final EndFeature SULPHUR_HILL = EndFeature.makeChansedFeature("sulphur_hill", new SulphurHillFeature(), 8);
public static final EndFeature OBSIDIAN_PILLAR_BASEMENT = EndFeature.makeChansedFeature("obsidian_pillar_basement", new ObsidianPillarBasementFeature(), 8);
public static final EndFeature OBSIDIAN_BOULDER = EndFeature.makeChansedFeature("obsidian_boulder", new ObsidianBoulderFeature(), 10);
public static final EndFeature FALLEN_PILLAR = EndFeature.makeChansedFeature("fallen_pillar", new FallenPillarFeature(), 20);
public static final EndFeature TUNEL_CAVE = EndFeature.makeChunkFeature("tunel_cave", new TunelCaveFeature());
public static final BCLFeature END_LAKE= registerLake("end_lake", new EndLakeFeature(), 4);
public static final BCLFeature END_LAKE_NORMAL= registerLake("end_lake_normal", new EndLakeFeature(), 20);
public static final BCLFeature END_LAKE_RARE= registerLake("end_lake_rare", new EndLakeFeature(), 40);
public static final BCLFeature DESERT_LAKE= registerLake("desert_lake", new DesertLakeFeature(), 8);
public static final BCLFeature ROUND_CAVE = registerRawGen("round_cave", new RoundCaveFeature(), 2);
public static final BCLFeature SPIRE = registerRawGen("spire", new SpireFeature(), 2);
public static final BCLFeature FLOATING_SPIRE = registerRawGen("floating_spire", new FloatingSpireFeature(), 8);
public static final BCLFeature GEYSER = registerRawGen("geyser", new GeyserFeature(), 8);
public static final BCLFeature SULPHURIC_LAKE= registerLake("sulphuric_lake", new SulphuricLakeFeature(), 8);
public static final BCLFeature SULPHURIC_CAVE = BCLFeature.makeCountRawFeature(BetterEnd.makeID("sulphuric_cave"), new SulphuricCaveFeature(), 2);
public static final BCLFeature ICE_STAR = registerRawGen("ice_star", new IceStarFeature(5, 15, 10, 25), 15);
public static final BCLFeature ICE_STAR_SMALL = registerRawGen("ice_star_small", new IceStarFeature(3, 5, 7, 12), 8);
public static final BCLFeature SURFACE_VENT = registerChanced("surface_vent", new SurfaceVentFeature(), 4);
public static final BCLFeature SULPHUR_HILL = registerChanced("sulphur_hill", new SulphurHillFeature(), 8);
public static final BCLFeature OBSIDIAN_PILLAR_BASEMENT = registerChanced("obsidian_pillar_basement", new ObsidianPillarBasementFeature(), 8);
public static final BCLFeature OBSIDIAN_BOULDER = registerChanced("obsidian_boulder", new ObsidianBoulderFeature(), 10);
public static final BCLFeature FALLEN_PILLAR = registerChanced("fallen_pillar", new FallenPillarFeature(), 20);
public static final BCLFeature TUNEL_CAVE = BCLFeature.makeChunkFeature(BetterEnd.makeID("tunel_cave"), new TunelCaveFeature());
// Ores //
public static final EndFeature THALLASIUM_ORE = EndFeature.makeOreFeature("thallasium_ore", EndBlocks.THALLASIUM.ore, 12, 6, 0, 16, 128);
public static final EndFeature ENDER_ORE = EndFeature.makeOreFeature("ender_ore", EndBlocks.ENDER_ORE, 8, 3, 0, 16, 128);
public static final EndFeature AMBER_ORE = EndFeature.makeOreFeature("amber_ore", EndBlocks.AMBER_ORE, 12, 6, 0, 16, 128);
public static final EndFeature VIOLECITE_LAYER = EndFeature.makeLayerFeature("violecite_layer", EndBlocks.VIOLECITE, 15, 16, 128, 8);
public static final EndFeature FLAVOLITE_LAYER = EndFeature.makeLayerFeature("flavolite_layer", EndBlocks.FLAVOLITE, 12, 16, 128, 6);
public static final BCLFeature THALLASIUM_ORE = registerOre("thallasium_ore", EndBlocks.THALLASIUM.ore, 12, 6, 0, 16, 128);
public static final BCLFeature ENDER_ORE = registerOre("ender_ore", EndBlocks.ENDER_ORE, 8, 3, 0, 16, 128);
public static final BCLFeature AMBER_ORE = registerOre("amber_ore", EndBlocks.AMBER_ORE, 12, 6, 0, 16, 128);
public static final BCLFeature VIOLECITE_LAYER = registerLayer("violecite_layer", EndBlocks.VIOLECITE, 15, 16, 128, 8);
public static final BCLFeature FLAVOLITE_LAYER = registerLayer("flavolite_layer", EndBlocks.FLAVOLITE, 12, 16, 128, 6);
// Buildings
public static final EndFeature CRASHED_SHIP = EndFeature.makeChansedFeature("crashed_ship", new CrashedShipFeature(), 500);
public static final BCLFeature CRASHED_SHIP = registerChanced("crashed_ship", new CrashedShipFeature(), 500);
// Mobs
public static final EndFeature SILK_MOTH_NEST = EndFeature.makeChansedFeature("silk_moth_nest", new SilkMothNestFeature(), 2);
public static final BCLFeature SILK_MOTH_NEST = registerChanced("silk_moth_nest", new SilkMothNestFeature(), 2);
// Caves
public static final DefaultFeature SMARAGDANT_CRYSTAL = new SmaragdantCrystalFeature();
@ -231,6 +240,36 @@ public class EndFeatures {
public static final DefaultFeature END_STONE_STALAGMITE_CAVEMOSS = new StalactiteFeature(false, EndBlocks.END_STONE_STALACTITE_CAVEMOSS, EndBlocks.CAVE_MOSS);
public static final DefaultFeature CAVE_PUMPKIN = new CavePumpkinFeature();
private static BCLFeature redisterVegetation(String name, Feature<NoneFeatureConfiguration> feature, int density) {
return BCLFeature.makeVegetationFeature(BetterEnd.makeID(name), feature, density);
}
private static BCLFeature registerRawGen(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLFeature.makeRawGenFeature(BetterEnd.makeID(name), feature, chance);
}
private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLFeature.makeLakeFeature(BetterEnd.makeID(name), feature, chance);
}
private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLFeature.makeChansedFeature(BetterEnd.makeID(name), feature, chance);
}
private static BCLFeature registerOre(String name, Block blockOre, int veins, int veinSize, int offset, int minY, int maxY) {
return BCLFeature.makeOreFeature(BetterEnd.makeID(name), blockOre, veins, veinSize, offset, minY, maxY);
}
private static BCLFeature registerLayer(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 BCLFeature(BetterEnd.makeID(name), layer, GenerationStep.Decoration.UNDERGROUND_ORES, configured);
}
private static BCLFeature registerLayer(String name, StoneMaterial material, float radius, int minY, int maxY, int count) {
return registerLayer(name, material.stone, radius, minY, maxY, count);
}
public static void registerBiomeFeatures(ResourceLocation id, Biome biome, List<List<Supplier<ConfiguredFeature<?, ?>>>> features) {
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
return;
@ -257,13 +296,13 @@ public class EndFeatures {
addFeature(ENDER_ORE, features);
addFeature(CRASHED_SHIP, features);
if (EndBiomes.getBiome(id).hasCaves() && !EndBiomes.VOID_BIOMES.containsImmutable(id)) {
EndBiome endBiome = (EndBiome) BiomeAPI.getBiome(id);
if (endBiome != null && endBiome.hasCaves() && !EndBiomes.VOID_BIOMES.containsImmutable(id)) {
addFeature(ROUND_CAVE, features);
addFeature(TUNEL_CAVE, features);
}
EndBiome endBiome = EndBiomes.getBiome(id);
EndFeature feature = endBiome.getStructuresFeature();
BCLFeature feature = BiomeAPI.getBiome(id).getStructuresFeature();
if (feature != null) {
addFeature(feature, features);
}
@ -281,7 +320,7 @@ public class EndFeatures {
}
}
private static void addFeature(EndFeature feature, List<List<Supplier<ConfiguredFeature<?, ?>>>> features) {
private static void addFeature(BCLFeature feature, List<List<Supplier<ConfiguredFeature<?, ?>>>> features) {
int index = feature.getFeatureStep().ordinal();
if (features.size() > index) {
features.get(index).add(() -> {

View file

@ -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());
}
}

View file

@ -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();
}
}

View file

@ -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));

View file

@ -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)

View file

@ -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);
}

View file

@ -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)

View file

@ -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;

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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));

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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));
}
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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();

View file

@ -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();

View file

@ -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;
}
}
}

View file

@ -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;
}
}
}
}

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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();

View file

@ -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();

View file

@ -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

View file

@ -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);
}
});

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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);
}
});

View file

@ -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;

View file

@ -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

View file

@ -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();

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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

View file

@ -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;
}

Some files were not shown because too many files have changed in this diff Show more