Removed color provider
This commit is contained in:
parent
2c8862a37b
commit
4040597a6d
475 changed files with 5411 additions and 7521 deletions
|
@ -8,9 +8,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class BYGBlocks {
|
||||
public static final Block IVIS_MOSS = EndBlocks.registerBlock("ivis_moss", new EndWallPlantBlock());
|
||||
public static final Block NIGHTSHADE_MOSS = EndBlocks.registerBlock("nightshade_moss", new EndWallPlantBlock());
|
||||
|
||||
|
||||
public static final Block IVIS_VINE = EndBlocks.registerBlock("ivis_vine", new BaseVineBlock());
|
||||
|
||||
|
||||
public static void register() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
|
|||
public BYGIntegration() {
|
||||
super("byg");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Block block = Integrations.BYG.getBlock("ivis_phylium");
|
||||
|
@ -34,14 +34,14 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
|
|||
BYGFeatures.register();
|
||||
BYGBiomes.register();
|
||||
}
|
||||
|
||||
|
||||
@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");
|
||||
|
|
|
@ -9,11 +9,11 @@ public class BYGBiomes {
|
|||
public static final EndBiome OLD_BULBIS_GARDENS = EndBiomes.registerSubBiomeIntegration(new OldBulbisGardens());
|
||||
public static final EndBiome NIGHTSHADE_REDWOODS = EndBiomes.registerSubBiomeIntegration(new NightshadeRedwoods());
|
||||
//public static final EndBiome ETHERIAL_GROVE = EndBiomes.registerSubBiomeIntegration(new EterialGrove());
|
||||
|
||||
|
||||
public static void register() {
|
||||
System.out.println("Registered " + OLD_BULBIS_GARDENS);
|
||||
}
|
||||
|
||||
|
||||
public static void addBiomes() {
|
||||
EndBiomes.addSubBiomeIntegration(OLD_BULBIS_GARDENS, Integrations.BYG.getID("bulbis_gardens"));
|
||||
EndBiomes.addSubBiomeIntegration(NIGHTSHADE_REDWOODS, Integrations.BYG.getID("nightshade_forest"));
|
||||
|
|
|
@ -21,25 +21,13 @@ public class NightshadeRedwoods extends EndBiome {
|
|||
public NightshadeRedwoods() {
|
||||
super(makeDef());
|
||||
}
|
||||
|
||||
|
||||
private static BCLBiomeDef makeDef() {
|
||||
Biome biome = Integrations.BYG.getBiome("nightshade_forest");
|
||||
BiomeSpecialEffects effects = biome.getSpecialEffects();
|
||||
|
||||
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods"))
|
||||
.setFogColor(140, 108, 47)
|
||||
.setFogDensity(1.5F)
|
||||
.setWaterAndFogColor(55, 70, 186)
|
||||
.setFoliageColor(122, 17, 155)
|
||||
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
|
||||
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get())
|
||||
.setGrassColor(48, 13, 89)
|
||||
.setPlantsColor(200, 125, 9)
|
||||
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_MOSS);
|
||||
|
||||
|
||||
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods")).setFogColor(140, 108, 47).setFogDensity(1.5F).setWaterAndFogColor(55, 70, 186).setFoliageColor(122, 17, 155).setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(biome.getGenerationSettings().getSurfaceBuilder().get()).setGrassColor(48, 13, 89).setPlantsColor(200, 125, 9).addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE).addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD).addFeature(BYGFeatures.NIGHTSHADE_MOSS);
|
||||
|
||||
if (BCLib.isClient()) {
|
||||
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
|
||||
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
|
||||
|
@ -52,14 +40,14 @@ public class NightshadeRedwoods extends EndBiome {
|
|||
def.addFeature(Decoration.VEGETAL_DECORATION, feature.get());
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
for (MobCategory group : MobCategory.values()) {
|
||||
List<SpawnerData> list = biome.getMobSettings().getMobs(group).unwrap();
|
||||
list.forEach((entry) -> {
|
||||
def.addMobSpawn(entry);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.function.Supplier;
|
|||
|
||||
class FeaturesAccesor extends Features {
|
||||
static ConfiguredDecorator<?> shadowHEIGHTMAP_SQUARE;
|
||||
|
||||
|
||||
static {
|
||||
shadowHEIGHTMAP_SQUARE = Decorators.HEIGHTMAP_SQUARE;
|
||||
}
|
||||
|
@ -37,23 +37,15 @@ public class OldBulbisGardens extends EndBiome {
|
|||
public OldBulbisGardens() {
|
||||
super(makeDef());
|
||||
}
|
||||
|
||||
|
||||
private static BCLBiomeDef makeDef() {
|
||||
Biome biome = Integrations.BYG.getBiome("bulbis_gardens");
|
||||
BiomeSpecialEffects effects = biome.getSpecialEffects();
|
||||
|
||||
|
||||
Block ivis = Integrations.BYG.getBlock("ivis_phylium");
|
||||
Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock();
|
||||
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens"))
|
||||
.setFogColor(215, 132, 207)
|
||||
.setFogDensity(1.8F)
|
||||
.setWaterAndFogColor(40, 0, 56)
|
||||
.setFoliageColor(122, 17, 155)
|
||||
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
|
||||
.setSurface(ivis, origin)
|
||||
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(BYGFeatures.OLD_BULBIS_TREE);
|
||||
|
||||
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens")).setFogColor(215, 132, 207).setFogDensity(1.8F).setWaterAndFogColor(40, 0, 56).setFoliageColor(122, 17, 155).setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(ivis, origin).addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.OLD_BULBIS_TREE);
|
||||
|
||||
if (BCLib.isClient()) {
|
||||
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
|
||||
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
|
||||
|
@ -61,14 +53,14 @@ public class OldBulbisGardens extends EndBiome {
|
|||
SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent();
|
||||
def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood);
|
||||
}
|
||||
|
||||
|
||||
for (MobCategory group : MobCategory.values()) {
|
||||
List<SpawnerData> list = biome.getMobSettings().getMobs(group).unwrap();
|
||||
list.forEach((entry) -> {
|
||||
def.addMobSpawn(entry);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> features = biome.getGenerationSettings().features();
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> vegetal = features.get(Decoration.VEGETAL_DECORATION.ordinal());
|
||||
if (vegetal.size() > 2) {
|
||||
|
@ -89,13 +81,9 @@ public class OldBulbisGardens extends EndBiome {
|
|||
def.addFeature(Decoration.VEGETAL_DECORATION, feature);
|
||||
}
|
||||
}
|
||||
|
||||
def.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS)
|
||||
.addFeature(BYGFeatures.IVIS_VINE)
|
||||
.addFeature(BYGFeatures.IVIS_SPROUT);
|
||||
|
||||
|
||||
def.addFeature(EndFeatures.PURPLE_POLYPORE).addFeature(BYGFeatures.IVIS_MOSS_WOOD).addFeature(BYGFeatures.IVIS_MOSS).addFeature(BYGFeatures.IVIS_VINE).addFeature(BYGFeatures.IVIS_SPROUT);
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ public class BYGFeatures {
|
|||
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 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);
|
||||
}
|
||||
|
|
|
@ -24,24 +24,22 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("ether_log");
|
||||
BlockState wood = Integrations.BYG.getDefaultState("ether_wood");
|
||||
Function<BlockPos, BlockState> splinePlacer = (bpos) -> {
|
||||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
|
||||
};
|
||||
|
||||
|
||||
int height = MHelper.randRange(40, 60, random);
|
||||
List<Vector3f> trunk = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, height / 4);
|
||||
SplineHelper.offsetParts(trunk, random, 2F, 0, 2F);
|
||||
SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer);
|
||||
|
||||
|
||||
int count = height / 15;
|
||||
for (int i = 1; i < count; i++) {
|
||||
float splinePos = (float) i / (float) count;
|
||||
|
@ -57,22 +55,21 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
List<Vector3f> br = SplineHelper.copySpline(branch);
|
||||
SplineHelper.offsetParts(br, random, 0, 1, 1);
|
||||
SplineHelper.rotateSpline(br, angle);
|
||||
|
||||
|
||||
SplineHelper.offset(br, start);
|
||||
SplineHelper.fillSpline(br, world, wood, pos, replace);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sdf.setReplaceFunction((state) -> {
|
||||
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
|
||||
}).addPostProcess((info) -> {
|
||||
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
|
||||
return wood;
|
||||
}
|
||||
return info.getState();
|
||||
}).fillRecursive(world, pos);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,26 +32,24 @@ import java.util.Random;
|
|||
|
||||
public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
||||
private static final List<Vector3f> BRANCH;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
|
||||
BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood");
|
||||
BlockState leaves = Integrations.BYG.getDefaultState("nightshade_leaves");
|
||||
BlockState leaves_flower = Integrations.BYG.getDefaultState("flowering_nightshade_leaves");
|
||||
|
||||
|
||||
Function<BlockPos, BlockState> splinePlacer = (bpos) -> {
|
||||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
|
||||
};
|
||||
Function<PosInfo, BlockState> post = (info) -> {
|
||||
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
|
||||
|
@ -62,15 +60,15 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
Function<BlockState, Boolean> ignore = (state) -> {
|
||||
return state.equals(log) || state.equals(wood);
|
||||
};
|
||||
|
||||
|
||||
int height = MHelper.randRange(40, 60, random);
|
||||
List<Vector3f> trunk = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, height / 4);
|
||||
SplineHelper.offsetParts(trunk, random, 0.8F, 0, 0.8F);
|
||||
|
||||
|
||||
if (!SplineHelper.canGenerate(trunk, pos, world, replace)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int count = height >> 2;
|
||||
float start = trunk.size() / 3F;
|
||||
float delta = trunk.size() * 0.6F;
|
||||
|
@ -89,11 +87,10 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
SplineHelper.offset(branch, offset);
|
||||
SplineHelper.fillSpline(branch, world, wood, pos, replace);
|
||||
}
|
||||
|
||||
|
||||
SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer);
|
||||
SDF roots = new SDFSphere().setRadius(2F).setBlock(log);
|
||||
roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random))
|
||||
.setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
|
||||
roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random)).setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
|
||||
sdf = new SDFSmoothUnion().setRadius(2F).setSourceA(sdf).setSourceB(roots);
|
||||
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
|
||||
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F);
|
||||
|
@ -101,7 +98,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
|
||||
}
|
||||
|
||||
|
||||
for (int y = 0; y < 16; y++) {
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
if (world.isEmptyBlock(p)) {
|
||||
|
@ -123,7 +120,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
Function<PosInfo, BlockState> leavesPost1 = (info) -> {
|
||||
if (info.getState().equals(log) || info.getState().equals(wood)) {
|
||||
|
@ -173,19 +170,17 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
}
|
||||
return info.getState();
|
||||
};
|
||||
|
||||
|
||||
SDF canopy = new SDFCappedCone().setRadius1(12F).setRadius2(1f).setHeight(height * 0.3F).setBlock(leaves);
|
||||
canopy = new SDFDisplacement().setFunction((vec) -> {
|
||||
return MHelper.randRange(-3F, 3F, random);
|
||||
}).setSource(canopy);
|
||||
canopy.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world,
|
||||
pos.offset(0, height * 0.75, 0), ignore);
|
||||
|
||||
canopy.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world, pos.offset(0, height * 0.75, 0), ignore);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0), new Vector3f(0.25F, 0.1F, 0), new Vector3f(0.40F, 0.2F, 0),
|
||||
new Vector3f(0.50F, 0.4F, 0), new Vector3f(0.55F, 0.6F, 0));
|
||||
BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0), new Vector3f(0.25F, 0.1F, 0), new Vector3f(0.40F, 0.2F, 0), new Vector3f(0.50F, 0.4F, 0), new Vector3f(0.55F, 0.6F, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,31 +33,27 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
private static final List<Vector3f> LEAF;
|
||||
private static final List<Vector3f> SIDE;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN))
|
||||
return false;
|
||||
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
|
||||
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN)) return false;
|
||||
|
||||
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
|
||||
BlockState wood = Integrations.BYG.getDefaultState("bulbis_wood");
|
||||
BlockState cap = Integrations.BYG
|
||||
.getDefaultState(random.nextBoolean() ? "bulbis_shell" : "purple_bulbis_shell");
|
||||
BlockState cap = Integrations.BYG.getDefaultState(random.nextBoolean() ? "bulbis_shell" : "purple_bulbis_shell");
|
||||
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
|
||||
|
||||
|
||||
Function<BlockState, Boolean> replacement = (state) -> {
|
||||
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND)
|
||||
|| state.getMaterial().equals(Material.PLANT)) {
|
||||
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)) {
|
||||
return true;
|
||||
}
|
||||
return state.getMaterial().isReplaceable();
|
||||
};
|
||||
|
||||
|
||||
float size = MHelper.randRange(10, 20, random);
|
||||
float addSize = MHelper.randRange(1, 1.7F, random);
|
||||
float addRad = addSize * 0.5F + 0.5F;
|
||||
|
@ -80,50 +76,48 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SDF branch = SplineHelper.buildSDF(spline, 2.3F * addRad, 1.3F * addRad, (bpos) -> {
|
||||
return stem;
|
||||
});
|
||||
|
||||
|
||||
Vector3f vec = spline.get(spline.size() - 1);
|
||||
float radius = (size + MHelper.randRange(0, size * 0.5F, random)) * 0.35F;
|
||||
bigSphere(world, pos.offset(vec.x(), vec.y(), vec.z()), radius, cap, glow, wood, replacement, random);
|
||||
vec = SplineHelper.getPos(spline, 0.3F);
|
||||
makeRoots(world, pos.offset(vec.x(), vec.y(), vec.z()), size * 0.4F + 5, random, wood, replacement);
|
||||
|
||||
|
||||
sdf = (sdf == null) ? branch : new SDFUnion().setSourceA(sdf).setSourceB(branch);
|
||||
}
|
||||
|
||||
|
||||
sdf.setReplaceFunction(replacement).addPostProcess((info) -> {
|
||||
if (info.getState().equals(stem)
|
||||
&& (!info.getStateUp().equals(stem) || !info.getStateDown().equals(stem))) {
|
||||
if (info.getState().equals(stem) && (!info.getStateUp().equals(stem) || !info.getStateDown().equals(stem))) {
|
||||
return wood;
|
||||
}
|
||||
return info.getState();
|
||||
}).fillArea(world, pos, limits);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow,
|
||||
BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
|
||||
|
||||
private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow, BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(cap);
|
||||
|
||||
|
||||
SDF sphereInner = new SDFSphere().setRadius(radius * 0.53F).setBlock(Blocks.AIR);
|
||||
sphereInner = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1);
|
||||
}).setSource(sphereInner);
|
||||
|
||||
|
||||
SDF sphereGlow = new SDFSphere().setRadius(radius * 0.6F).setBlock(glow);
|
||||
sphereGlow = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1) * 2F;
|
||||
}).setSource(sphereGlow);
|
||||
sphereGlow = new SDFSubtraction().setSourceA(sphereGlow).setSourceB(sphereInner);
|
||||
|
||||
|
||||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sphereGlow);
|
||||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sphereInner);
|
||||
|
||||
|
||||
float offsetY = radius * 1.7F;
|
||||
sphere = new SDFUnion().setSourceA(sphere).setSourceB(sphereGlow);
|
||||
sphere = new SDFTranslate().setTranslate(0, offsetY, 0).setSource(sphere);
|
||||
|
||||
|
||||
int leafCount = (int) (radius * 0.5F) + 2;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float angle = (float) i / 4 * MHelper.PI2;
|
||||
|
@ -131,13 +125,13 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SplineHelper.rotateSpline(spline, angle);
|
||||
SplineHelper.scale(spline, radius * 1.4F);
|
||||
SplineHelper.fillSplineForce(spline, world, wood, pos, replacement);
|
||||
|
||||
|
||||
for (int j = 0; j < leafCount; j++) {
|
||||
float delta = ((float) j / (float) (leafCount - 1));
|
||||
float scale = (float) Math.sin(delta * Math.PI) * 0.8F + 0.2F;
|
||||
float index = Mth.lerp(delta, 1F, 3.9F);
|
||||
Vector3f point = SplineHelper.getPos(spline, index);
|
||||
|
||||
|
||||
List<Vector3f> side = SplineHelper.copySpline(SIDE);
|
||||
SplineHelper.rotateSpline(side, angle);
|
||||
SplineHelper.scale(side, scale * radius);
|
||||
|
@ -145,17 +139,16 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SplineHelper.fillSplineForce(side, world, wood, p, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sphere.fillArea(world, pos, new AABB(pos.above((int) offsetY)).inflate(radius * 1.3F));
|
||||
}
|
||||
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood,
|
||||
Function<BlockState, Boolean> replacement) {
|
||||
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood, Function<BlockState, Boolean> replacement) {
|
||||
int count = (int) (radius * 1.5F);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2;
|
||||
float scale = radius * MHelper.randRange(0.85F, 1.15F, random);
|
||||
|
||||
|
||||
List<Vector3f> branch = SplineHelper.copySpline(ROOT);
|
||||
SplineHelper.rotateSpline(branch, angle);
|
||||
SplineHelper.scale(branch, scale);
|
||||
|
@ -165,20 +158,15 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
SPLINE = Lists.newArrayList(new Vector3f(0.00F, 0.00F, 0.00F), new Vector3f(0.10F, 0.35F, 0.00F),
|
||||
new Vector3f(0.20F, 0.50F, 0.00F), new Vector3f(0.30F, 0.55F, 0.00F), new Vector3f(0.42F, 0.70F, 0.00F),
|
||||
new Vector3f(0.50F, 1.00F, 0.00F));
|
||||
|
||||
ROOT = Lists.newArrayList(new Vector3f(0F, 1F, 0), new Vector3f(0.1F, 0.70F, 0), new Vector3f(0.3F, 0.30F, 0),
|
||||
new Vector3f(0.7F, 0.05F, 0), new Vector3f(0.8F, -0.20F, 0));
|
||||
SPLINE = Lists.newArrayList(new Vector3f(0.00F, 0.00F, 0.00F), new Vector3f(0.10F, 0.35F, 0.00F), new Vector3f(0.20F, 0.50F, 0.00F), new Vector3f(0.30F, 0.55F, 0.00F), new Vector3f(0.42F, 0.70F, 0.00F), new Vector3f(0.50F, 1.00F, 0.00F));
|
||||
|
||||
ROOT = Lists.newArrayList(new Vector3f(0F, 1F, 0), new Vector3f(0.1F, 0.70F, 0), new Vector3f(0.3F, 0.30F, 0), new Vector3f(0.7F, 0.05F, 0), new Vector3f(0.8F, -0.20F, 0));
|
||||
SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0));
|
||||
|
||||
LEAF = Lists.newArrayList(new Vector3f(0.00F, 0.0F, 0), new Vector3f(0.10F, 0.4F, 0),
|
||||
new Vector3f(0.40F, 0.8F, 0), new Vector3f(0.75F, 0.9F, 0), new Vector3f(1.00F, 0.8F, 0));
|
||||
|
||||
SIDE = Lists.newArrayList(new Vector3f(0, -0.3F, -0.5F), new Vector3f(0, -0.1F, -0.3F),
|
||||
new Vector3f(0, 0.0F, 0.0F), new Vector3f(0, -0.1F, 0.3F), new Vector3f(0, -0.3F, 0.5F));
|
||||
|
||||
LEAF = Lists.newArrayList(new Vector3f(0.00F, 0.0F, 0), new Vector3f(0.10F, 0.4F, 0), new Vector3f(0.40F, 0.8F, 0), new Vector3f(0.75F, 0.9F, 0), new Vector3f(1.00F, 0.8F, 0));
|
||||
|
||||
SIDE = Lists.newArrayList(new Vector3f(0, -0.3F, -0.5F), new Vector3f(0, -0.1F, -0.3F), new Vector3f(0, 0.0F, 0.0F), new Vector3f(0, -0.1F, 0.3F), new Vector3f(0, -0.3F, 0.5F));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue