BYG crash fix, BYG end sub-biome support, Old Bulbis Gardens
improvements
This commit is contained in:
parent
7ef23332fc
commit
38a09c7221
10 changed files with 183 additions and 53 deletions
|
@ -1,11 +1,20 @@
|
|||
package ru.betterend.integration.byg;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.WeightedList;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.ModIntegration;
|
||||
import ru.betterend.integration.byg.biomes.BYGBiomes;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.TagHelper;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
public class BYGIntegration extends ModIntegration {
|
||||
public BYGIntegration() {
|
||||
|
@ -23,5 +32,46 @@ public class BYGIntegration extends ModIntegration {
|
|||
@Override
|
||||
public void addBiomes() {
|
||||
BYGBiomes.addBiomes();
|
||||
|
||||
Class<?> biomeClass = this.getClass("corgiaoc.byg.common.world.biome.BYGEndBiome");
|
||||
List<Object> biomes = this.getStaticFieldValue(biomeClass, "BYG_END_BIOMES");
|
||||
|
||||
if (biomes != null && biomeClass != null) {
|
||||
biomes.forEach((obj) -> {
|
||||
Biome biome = this.getAndExecuteRuntime(biomeClass, obj, "getBiome");
|
||||
if (biome != null) {
|
||||
Identifier biomeID = BuiltinRegistries.BIOME.getId(biome);
|
||||
EndBiome endBiome = EndBiomes.getBiome(biomeID);
|
||||
Biome edge = this.getAndExecuteRuntime(biomeClass, obj, "getEdge");
|
||||
if (edge != null) {
|
||||
Identifier edgeID = BuiltinRegistries.BIOME.getId(edge);
|
||||
EndBiomes.LAND_BIOMES.removeMutableBiome(edgeID);
|
||||
EndBiomes.VOID_BIOMES.removeMutableBiome(edgeID);
|
||||
EndBiome edgeBiome = EndBiomes.getBiome(edgeID);
|
||||
endBiome.setEdge(edgeBiome);
|
||||
endBiome.setEdgeSize(32);
|
||||
}
|
||||
else {
|
||||
boolean isVoid = this.getAndExecuteRuntime(biomeClass, obj, "isVoid");
|
||||
if (isVoid) {
|
||||
EndBiomes.LAND_BIOMES.removeMutableBiome(biomeID);
|
||||
EndBiomes.VOID_BIOMES.addBiome(endBiome);
|
||||
}
|
||||
WeightedList<Identifier> subBiomes = this.getAndExecuteRuntime(biomeClass, obj, "getHills");
|
||||
if (subBiomes != null) {
|
||||
subBiomes.stream().collect(Collectors.toList()).forEach((id) -> {
|
||||
EndBiome subBiome = EndBiomes.getBiome(id);
|
||||
EndBiomes.LAND_BIOMES.removeMutableBiome(id);
|
||||
EndBiomes.VOID_BIOMES.removeMutableBiome(id);
|
||||
if (!endBiome.containsSubBiome(subBiome)) {
|
||||
EndBiomes.SUBBIOMES.add(subBiome);
|
||||
endBiome.addSubBiome(subBiome);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
package ru.betterend.integration.byg.biomes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
import net.minecraft.world.gen.GenerationStep.Feature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
|
@ -25,24 +32,17 @@ public class OldBulbisGardens extends EndBiome {
|
|||
Biome biome = Integrations.BYG.getBiome("bulbis_gardens");
|
||||
BiomeEffects effects = biome.getEffects();
|
||||
|
||||
Block ivis = Integrations.BYG.getBlock("ivis_phylium");
|
||||
Block origin = biome.getGenerationSettings().getSurfaceConfig().getTopMaterial().getBlock();
|
||||
BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens")
|
||||
.setFogColor(215, 132, 207)
|
||||
.setFogDensity(1.8F)
|
||||
.setWaterAndFogColor(40, 0, 56)
|
||||
.setFoliageColor(122, 17, 155)
|
||||
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
|
||||
.setSurface(Integrations.BYG.getBlock("ivis_phylium"))
|
||||
.setSurface(ivis, origin)
|
||||
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(BYGFeatures.OLD_BULBIS_TREE)
|
||||
.addFeature(Feature.VEGETAL_DECORATION, BYGFeatures.BULBIS_TREES)
|
||||
.addFeature(Feature.VEGETAL_DECORATION, BYGFeatures.PURPLE_BULBIS_TREES)
|
||||
.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS)
|
||||
.addFeature(BYGFeatures.IVIS_VINE)
|
||||
.addFeature(BYGFeatures.IVIS_SPROUT)
|
||||
.addFeature(BYGFeatures.BULBIS_ODDITY)
|
||||
.addFeature(BYGFeatures.PURPLE_BULBIS_ODDITY);
|
||||
.addFeature(BYGFeatures.OLD_BULBIS_TREE);
|
||||
|
||||
if (BetterEnd.isClient()) {
|
||||
SoundEvent loop = effects.getLoopSound().get();
|
||||
|
@ -59,6 +59,33 @@ public class OldBulbisGardens extends EndBiome {
|
|||
});
|
||||
}
|
||||
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> features = biome.getGenerationSettings().getFeatures();
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> vegetal = features.get(Feature.VEGETAL_DECORATION.ordinal());
|
||||
if (vegetal.size() > 2) {
|
||||
Supplier<ConfiguredFeature<?, ?>> getter;
|
||||
// Trees (first two features)
|
||||
// I couldn't process them with conditions, so that's why they are hardcoded (paulevs)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
getter = vegetal.get(i);
|
||||
ConfiguredFeature<?, ?> feature = getter.get();
|
||||
Identifier id = BetterEnd.makeID("obg_feature_" + i);
|
||||
feature = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(1));
|
||||
def.addFeature(Feature.VEGETAL_DECORATION, feature);
|
||||
}
|
||||
// Grasses and other features
|
||||
for (int i = 2; i < vegetal.size(); i++) {
|
||||
getter = vegetal.get(i);
|
||||
ConfiguredFeature<?, ?> feature = getter.get();
|
||||
def.addFeature(Feature.VEGETAL_DECORATION, feature);
|
||||
}
|
||||
}
|
||||
|
||||
def.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS)
|
||||
.addFeature(BYGFeatures.IVIS_VINE)
|
||||
.addFeature(BYGFeatures.IVIS_SPROUT);
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.integration.byg.features;
|
||||
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.BYGBlocks;
|
||||
import ru.betterend.world.features.EndFeature;
|
||||
|
@ -23,8 +22,8 @@ public class BYGFeatures {
|
|||
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 ConfiguredFeature<?,?> BULBIS_TREES = Integrations.BYG.getConfiguredFeature("rs_sparse_bulbis_tree");
|
||||
public static final ConfiguredFeature<?,?> PURPLE_BULBIS_TREES = Integrations.BYG.getConfiguredFeature("rs_sparse_purple_bulbis_tree");
|
||||
//public static final ConfiguredFeature<?,?> BULBIS_TREES = Integrations.BYG.getConfiguredFeature("rs_sparse_bulbis_tree");
|
||||
//public static final ConfiguredFeature<?,?> PURPLE_BULBIS_TREES = Integrations.BYG.getConfiguredFeature("rs_sparse_purple_bulbis_tree");
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,10 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
};
|
||||
|
||||
float size = MHelper.randRange(10, 20, random);
|
||||
float addSize = MHelper.randRange(1, 1.7F, random);
|
||||
float addRad = addSize * 0.5F + 0.5F;
|
||||
int count = (int) (size * 0.15F);
|
||||
size *= addSize;
|
||||
float var = MHelper.PI2 / (float) (count * 3);
|
||||
float start = MHelper.randRange(0, MHelper.PI2, random);
|
||||
SDF sdf = null;
|
||||
|
@ -65,10 +68,10 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
List<Vector3f> spline = SplineHelper.copySpline(SPLINE);
|
||||
float sizeXZ = (size + MHelper.randRange(0, size * 0.5F, random)) * 0.7F;
|
||||
SplineHelper.scale(spline, sizeXZ, sizeXZ * 1.5F + MHelper.randRange(0, size * 0.5F, random), sizeXZ);
|
||||
SplineHelper.offset(spline, new Vector3f((20 - size), 0, 0));
|
||||
SplineHelper.offset(spline, new Vector3f(size * random.nextFloat() * 0.3F, 0, 0));
|
||||
SplineHelper.rotateSpline(spline, angle);
|
||||
SplineHelper.offsetParts(spline, random, 1F, 0, 1F);//1.3F 0.8F
|
||||
SDF branch = SplineHelper.buildSDF(spline, 2.3F, 1.3F, (bpos) -> {
|
||||
SDF branch = SplineHelper.buildSDF(spline, 2.3F * addRad, 1.3F * addRad, (bpos) -> {
|
||||
return stem;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue