Canvas shaders & lake

This commit is contained in:
paulevsGitch 2020-12-20 14:58:10 +03:00
parent a5ba8a3985
commit 7b4965dde1
19 changed files with 94 additions and 12 deletions

View file

@ -1,5 +1,6 @@
package ru.betterend.integration.byg;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import ru.betterend.integration.Integrations;
import ru.betterend.world.features.EndFeature;
import ru.betterend.world.features.SinglePlantFeature;
@ -9,10 +10,15 @@ 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), 9);
public static final EndFeature IVIS_SPROUT = new EndFeature("ivis_sprout", new SinglePlantFeature(Integrations.BYG.getBlock("ivis_sprout"), 6), 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 BULBIS_ODDITY = new EndFeature("bulbis_oddity", new SinglePlantFeature(Integrations.BYG.getBlock("bulbis_oddity"), 4), 5);
public static final EndFeature PURPLE_BULBIS_ODDITY = new EndFeature("purple_bulbis_oddity", new SinglePlantFeature(Integrations.BYG.getBlock("purple_bulbis_oddity"), 4), 5);
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() {}
}

View file

@ -1,6 +1,7 @@
package ru.betterend.integration.byg;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.world.gen.GenerationStep.Feature;
import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndFeatures;
import ru.betterend.world.biome.BiomeDefinition;
@ -14,11 +15,16 @@ public class OldBulbisGardens extends EndBiome {
.setWaterAndFogColor(40, 0, 56)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
.setSurface(Integrations.BYG.getBlock("ivis_phylium"))
.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.IVIS_SPROUT)
.addFeature(BYGFeatures.BULBIS_ODDITY)
.addFeature(BYGFeatures.PURPLE_BULBIS_ODDITY));
}
}

View file

@ -30,7 +30,6 @@ import ru.betterend.util.sdf.primitive.SDFSphere;
import ru.betterend.world.features.DefaultFeature;
public class OldBulbisTreeFeature extends DefaultFeature {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise("OldBulbisTreeFeature".hashCode());
private static final List<Vector3f> SPLINE;
private static final List<Vector3f> ROOT;
private static final List<Vector3f> LEAF;
@ -75,7 +74,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
Vector3f vec = spline.get(spline.size() - 1);
float radius = (size + MHelper.randRange(0, size * 0.5F, random)) * 0.35F;
bigSphere(world, pos.add(vec.getX(), vec.getY(), vec.getZ()), radius, cap, glow, wood, replacement);
bigSphere(world, pos.add(vec.getX(), vec.getY(), vec.getZ()), radius, cap, glow, wood, replacement, random);
vec = SplineHelper.getPos(spline, 0.3F);
makeRoots(world, pos.add(vec.getX(), vec.getY(), vec.getZ()), size * 0.4F + 5, random, wood, replacement);
@ -93,17 +92,18 @@ public class OldBulbisTreeFeature extends DefaultFeature {
return true;
}
private void bigSphere(StructureWorldAccess world, BlockPos pos, float radius, BlockState cap, BlockState glow, BlockState wood, Function<BlockState, Boolean> replacement) {
private void bigSphere(StructureWorldAccess 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.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1);
return (float) noise.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1);
}).setSource(sphereInner);
SDF sphereGlow = new SDFSphere().setRadius(radius * 0.6F).setBlock(glow);
sphereGlow = new SDFDisplacement().setFunction((vec) -> {
return (float) NOISE.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1) * 2F;
return (float) noise.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1) * 2F;
}).setSource(sphereGlow);
sphereGlow = new SDFSubtraction().setSourceA(sphereGlow).setSourceB(sphereInner);