Dragon tree prototype (WIP)
This commit is contained in:
parent
30f7f53c7f
commit
3691e4b67e
21 changed files with 324 additions and 15 deletions
|
@ -11,6 +11,6 @@ public class BlockDragonTreeSapling extends BlockFeatureSapling {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Feature<?> getFeature() {
|
protected Feature<?> getFeature() {
|
||||||
return EndFeatures.PYTHADENDRON_TREE.getFeature();
|
return EndFeatures.DRAGON_TREE.getFeature();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
25
src/main/java/ru/betterend/blocks/BlockShadowGrass.java
Normal file
25
src/main/java/ru/betterend/blocks/BlockShadowGrass.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.MaterialColor;
|
||||||
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class BlockShadowGrass extends BlockTerrain {
|
||||||
|
public BlockShadowGrass() {
|
||||||
|
super(MaterialColor.BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||||
|
super.randomDisplayTick(state, world, pos, random);
|
||||||
|
if (random.nextInt(32) == 0) {
|
||||||
|
world.addParticle(ParticleTypes.SMOKE, (double) pos.getX() + random.nextDouble(), (double) pos.getY() + 1.1D, (double) pos.getZ() + random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package ru.betterend.blocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||||
|
@ -16,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.loot.context.LootContext;
|
import net.minecraft.loot.context.LootContext;
|
||||||
import net.minecraft.loot.context.LootContextParameters;
|
import net.minecraft.loot.context.LootContextParameters;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
@ -29,7 +31,7 @@ public class BlockTerrain extends BlockBase {
|
||||||
private Block pathBlock;
|
private Block pathBlock;
|
||||||
|
|
||||||
public BlockTerrain(MaterialColor color) {
|
public BlockTerrain(MaterialColor color) {
|
||||||
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color).sounds(BlockSounds.TERRAIN_SOUND));
|
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color).sounds(BlockSounds.TERRAIN_SOUND).ticksRandomly());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPathBlock(Block roadBlock) {
|
public void setPathBlock(Block roadBlock) {
|
||||||
|
@ -59,4 +61,11 @@ public class BlockTerrain extends BlockBase {
|
||||||
}
|
}
|
||||||
return Collections.singletonList(new ItemStack(Blocks.END_STONE));
|
return Collections.singletonList(new ItemStack(Blocks.END_STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||||
|
if (random.nextInt(16) == 0 && world.getBlockState(pos.up()).getMaterial().blocksLight()) {
|
||||||
|
world.setBlockState(pos, Blocks.END_STONE.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import ru.betterend.world.biome.BiomeFoggyMushroomland;
|
||||||
import ru.betterend.world.biome.BiomeMegalake;
|
import ru.betterend.world.biome.BiomeMegalake;
|
||||||
import ru.betterend.world.biome.BiomeMegalakeGrove;
|
import ru.betterend.world.biome.BiomeMegalakeGrove;
|
||||||
import ru.betterend.world.biome.BiomePaintedMountains;
|
import ru.betterend.world.biome.BiomePaintedMountains;
|
||||||
|
import ru.betterend.world.biome.BiomeShadowForest;
|
||||||
import ru.betterend.world.biome.EndBiome;
|
import ru.betterend.world.biome.EndBiome;
|
||||||
import ru.betterend.world.generator.BiomePicker;
|
import ru.betterend.world.generator.BiomePicker;
|
||||||
import ru.betterend.world.generator.BiomeType;
|
import ru.betterend.world.generator.BiomeType;
|
||||||
|
@ -58,6 +59,7 @@ public class EndBiomes {
|
||||||
public static final EndBiome MEGALAKE_GROVE = registerSubBiome(new BiomeMegalakeGrove(), MEGALAKE);
|
public static final EndBiome MEGALAKE_GROVE = registerSubBiome(new BiomeMegalakeGrove(), MEGALAKE);
|
||||||
public static final EndBiome CRYSTAL_MOUNTAINS = registerBiome(new BiomeCrystalMountains(), BiomeType.LAND);
|
public static final EndBiome CRYSTAL_MOUNTAINS = registerBiome(new BiomeCrystalMountains(), BiomeType.LAND);
|
||||||
public static final EndBiome PAINTED_MOUNTAINS = registerSubBiome(new BiomePaintedMountains(), DUST_WASTELANDS);
|
public static final EndBiome PAINTED_MOUNTAINS = registerSubBiome(new BiomePaintedMountains(), DUST_WASTELANDS);
|
||||||
|
public static final EndBiome SHADOW_FOREST = registerBiome(new BiomeShadowForest(), BiomeType.LAND);
|
||||||
|
|
||||||
public static void register() {}
|
public static void register() {}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import ru.betterend.blocks.BlockMossyGlowshroomSapling;
|
||||||
import ru.betterend.blocks.BlockOre;
|
import ru.betterend.blocks.BlockOre;
|
||||||
import ru.betterend.blocks.BlockPath;
|
import ru.betterend.blocks.BlockPath;
|
||||||
import ru.betterend.blocks.BlockPythadendronSapling;
|
import ru.betterend.blocks.BlockPythadendronSapling;
|
||||||
|
import ru.betterend.blocks.BlockShadowGrass;
|
||||||
import ru.betterend.blocks.BlockTerrain;
|
import ru.betterend.blocks.BlockTerrain;
|
||||||
import ru.betterend.blocks.BlockTerrainPlant;
|
import ru.betterend.blocks.BlockTerrainPlant;
|
||||||
import ru.betterend.blocks.BlockUmbrellaMoss;
|
import ru.betterend.blocks.BlockUmbrellaMoss;
|
||||||
|
@ -59,13 +60,15 @@ public class EndBlocks {
|
||||||
public static final Block CHORUS_NYLIUM = registerBlock("chorus_nylium", new BlockTerrain(MaterialColor.MAGENTA));
|
public static final Block CHORUS_NYLIUM = registerBlock("chorus_nylium", new BlockTerrain(MaterialColor.MAGENTA));
|
||||||
public static final Block CAVE_MOSS = registerBlock("cave_moss", new BlockTerrain(MaterialColor.PURPLE));
|
public static final Block CAVE_MOSS = registerBlock("cave_moss", new BlockTerrain(MaterialColor.PURPLE));
|
||||||
public static final Block CRYSTAL_MOSS = registerBlock("crystal_moss", new BlockTerrain(MaterialColor.PINK));
|
public static final Block CRYSTAL_MOSS = registerBlock("crystal_moss", new BlockTerrain(MaterialColor.PINK));
|
||||||
|
public static final Block SHADOW_GRASS = registerBlock("shadow_grass", new BlockShadowGrass());
|
||||||
|
|
||||||
// Roads //
|
// Roads //
|
||||||
public static final Block END_MYCELIUM_PATH = registerBlock("end_mycelium_path", new BlockPath(END_MYCELIUM));
|
public static final Block END_MYCELIUM_PATH = registerBlock("end_mycelium_path", new BlockPath(END_MYCELIUM));
|
||||||
public static final Block END_MOSS_PATH = registerBlock("end_moss_path", new BlockPath(END_MOSS));
|
public static final Block END_MOSS_PATH = registerBlock("end_moss_path", new BlockPath(END_MOSS));
|
||||||
public static final Block CHORUS_NYLIUM_PATH = registerBlock("chorus_nylium_path", new BlockPath(CHORUS_NYLIUM));
|
public static final Block CHORUS_NYLIUM_PATH = registerBlock("chorus_nylium_path", new BlockPath(CHORUS_NYLIUM));
|
||||||
public static final Block CAVE_MOSS_PATH = registerBlock("cave_moss_path", new BlockPath(CAVE_MOSS));
|
public static final Block CAVE_MOSS_PATH = registerBlock("cave_moss_path", new BlockPath(CAVE_MOSS));
|
||||||
public static final Block CRYSTAL_MOSS_PATH = registerBlock("crystal_moss_path", new BlockPath(CAVE_MOSS));
|
public static final Block CRYSTAL_MOSS_PATH = registerBlock("crystal_moss_path", new BlockPath(CRYSTAL_MOSS));
|
||||||
|
public static final Block SHADOW_GRASS_PATH = registerBlock("shadow_grass_path", new BlockPath(SHADOW_GRASS));
|
||||||
|
|
||||||
// Rocks //
|
// Rocks //
|
||||||
public static final StoneMaterial FLAVOLITE = new StoneMaterial("flavolite", MaterialColor.SAND);
|
public static final StoneMaterial FLAVOLITE = new StoneMaterial("flavolite", MaterialColor.SAND);
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||||
import ru.betterend.world.features.BlueVineFeature;
|
import ru.betterend.world.features.BlueVineFeature;
|
||||||
import ru.betterend.world.features.CavePlantFeature;
|
import ru.betterend.world.features.CavePlantFeature;
|
||||||
import ru.betterend.world.features.DoublePlantFeature;
|
import ru.betterend.world.features.DoublePlantFeature;
|
||||||
|
import ru.betterend.world.features.DragonTreeFeature;
|
||||||
import ru.betterend.world.features.EndFeature;
|
import ru.betterend.world.features.EndFeature;
|
||||||
import ru.betterend.world.features.EndLakeFeature;
|
import ru.betterend.world.features.EndLakeFeature;
|
||||||
import ru.betterend.world.features.EndLilyFeature;
|
import ru.betterend.world.features.EndLilyFeature;
|
||||||
|
@ -32,6 +33,7 @@ public class EndFeatures {
|
||||||
public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
|
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 PYTHADENDRON_TREE = new EndFeature("pythadendron_tree", new PythadendronTreeFeature(), 2);
|
||||||
public static final EndFeature LACUGROVE = new EndFeature("lacugrove", new LacugroveFeature(), 4);
|
public static final EndFeature LACUGROVE = new EndFeature("lacugrove", new LacugroveFeature(), 4);
|
||||||
|
public static final EndFeature DRAGON_TREE = new EndFeature("dragon_tree", new DragonTreeFeature(), 3);
|
||||||
|
|
||||||
// Bushes //
|
// Bushes //
|
||||||
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new PythadendronBushFeature(), 4);
|
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new PythadendronBushFeature(), 4);
|
||||||
|
|
|
@ -197,4 +197,15 @@ public class SplineHelper {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector3f getPos(List<Vector3f> spline, float index) {
|
||||||
|
int i = (int) index;
|
||||||
|
float delta = index - i;
|
||||||
|
Vector3f p1 = spline.get(i);
|
||||||
|
Vector3f p2 = spline.get(i + 1);
|
||||||
|
float x = MathHelper.lerp(delta, p1.getX(), p2.getX());
|
||||||
|
float y = MathHelper.lerp(delta, p1.getY(), p2.getY());
|
||||||
|
float z = MathHelper.lerp(delta, p1.getZ(), p2.getZ());
|
||||||
|
return new Vector3f(x, y, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
31
src/main/java/ru/betterend/util/sdf/primitive/SDFPie.java
Normal file
31
src/main/java/ru/betterend/util/sdf/primitive/SDFPie.java
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package ru.betterend.util.sdf.primitive;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
|
public class SDFPie extends SDFPrimitive {
|
||||||
|
private float sin;
|
||||||
|
private float cos;
|
||||||
|
private float radius;
|
||||||
|
|
||||||
|
public SDFPie setAngle(float angle) {
|
||||||
|
this.sin = (float) Math.sin(angle);
|
||||||
|
this.cos = (float) Math.cos(angle);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SDFPie setRadius(float radius) {
|
||||||
|
this.radius = radius;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getDistance(float x, float y, float z) {
|
||||||
|
float px = Math.abs(x);
|
||||||
|
float l = MHelper.length(px, y, z) - radius;
|
||||||
|
float m = MHelper.dot(px, z, sin, cos);
|
||||||
|
m = MathHelper.clamp(m, 0, radius);
|
||||||
|
m = MHelper.length(px - sin * m, z - cos * m);
|
||||||
|
return MHelper.max(l, m * (float) Math.signum(cos * px - sin * z));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package ru.betterend.world.biome;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||||
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
|
public class BiomeShadowForest extends EndBiome {
|
||||||
|
public BiomeShadowForest() {
|
||||||
|
super(new BiomeDefinition("shadow_forest")
|
||||||
|
.setFogColor(87, 26, 87)
|
||||||
|
.setFogDensity(1.5F)
|
||||||
|
.setPlantsColor(122, 45, 122)
|
||||||
|
.setSurface(EndBlocks.SHADOW_GRASS)
|
||||||
|
.setParticles(ParticleTypes.MYCELIUM, 0.01F)
|
||||||
|
//.setLoop(EndSounds.AMBIENT_CHORUS_FOREST)
|
||||||
|
//.setMusic(EndSounds.MUSIC_CHORUS_FOREST)
|
||||||
|
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||||
|
.addFeature(EndFeatures.DRAGON_TREE)
|
||||||
|
//.addFeature(EndFeatures.PYTHADENDRON_BUSH)
|
||||||
|
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
|
||||||
|
.addMobSpawn(EntityType.ENDERMAN, 80, 1, 4));
|
||||||
|
}
|
||||||
|
}
|
151
src/main/java/ru/betterend/world/features/DragonTreeFeature.java
Normal file
151
src/main/java/ru/betterend/world/features/DragonTreeFeature.java
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
package ru.betterend.world.features;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.LeavesBlock;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.client.util.math.Vector3f;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.StructureWorldAccess;
|
||||||
|
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||||
|
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||||
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
import ru.betterend.registry.EndTags;
|
||||||
|
import ru.betterend.util.MHelper;
|
||||||
|
import ru.betterend.util.SplineHelper;
|
||||||
|
import ru.betterend.util.sdf.PosInfo;
|
||||||
|
import ru.betterend.util.sdf.SDF;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFCoordModify;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFFlatWave;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFScale3D;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFSubtraction;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFTranslate;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFUnion;
|
||||||
|
import ru.betterend.util.sdf.primitive.SDFSphere;
|
||||||
|
|
||||||
|
public class DragonTreeFeature extends DefaultFeature {
|
||||||
|
private static final Function<BlockState, Boolean> REPLACE;
|
||||||
|
private static final Function<PosInfo, BlockState> POST;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||||
|
if (!world.getBlockState(pos.down()).getBlock().isIn(EndTags.END_GROUND)) return false;
|
||||||
|
|
||||||
|
float size = MHelper.randRange(15, 35, random);
|
||||||
|
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 6);
|
||||||
|
SplineHelper.offsetParts(spline, random, 1F, 0, 1F);
|
||||||
|
|
||||||
|
if (!SplineHelper.canGenerate(spline, pos, world, REPLACE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float radius = MHelper.randRange(6F, 8F, random);
|
||||||
|
radius *= (size - 15F) / 20F + 1F;
|
||||||
|
Vector3f top = spline.get(spline.size() - 1);
|
||||||
|
|
||||||
|
radius = size * MHelper.randRange(0.08F, 0.12F, random);
|
||||||
|
float radius2 = size / 15F;
|
||||||
|
SDF function = SplineHelper.buildSDF(spline, radius, radius2, (bpos) -> {
|
||||||
|
return EndBlocks.DRAGON_TREE.bark.getDefaultState();
|
||||||
|
});
|
||||||
|
|
||||||
|
int branches = (int) ((size - 10) * 0.25F + 5);
|
||||||
|
radius = size * MHelper.randRange(0.4F, 0.6F, random);
|
||||||
|
/*for (int i = 0; i < branches; i++) {
|
||||||
|
float angle = (float) i / (float) branches * MHelper.PI2;
|
||||||
|
float x2 = top.getX() + (float) Math.sin(angle) * radius;
|
||||||
|
float z2 = top.getZ() + (float) Math.cos(angle) * radius;
|
||||||
|
spline = SplineHelper.makeSpline(top.getX(), top.getY(), top.getZ(), x2, top.getY(), z2, 7);
|
||||||
|
SplineHelper.powerOffset(spline, radius * 0.5F, 3);
|
||||||
|
SplineHelper.fillSpline(spline, world, EndBlocks.DRAGON_TREE.bark.getDefaultState(), pos, (state) -> {
|
||||||
|
return state.getMaterial().isReplaceable() || state.isOf(EndBlocks.DRAGON_TREE_LEAVES);
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
|
||||||
|
BlockState leaves = EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1);
|
||||||
|
SDF leafCap = new SDFSphere().setRadius(radius + 3).setBlock(leaves);
|
||||||
|
leafCap = new SDFScale3D().setScale(1, 0.25F, 1).setSource(leafCap);
|
||||||
|
SDF sub = new SDFSphere().setRadius(radius * 2).setBlock(Blocks.AIR);
|
||||||
|
sub = new SDFTranslate().setTranslate(0, radius * 2 - 2F, 0).setSource(sub);
|
||||||
|
leafCap = new SDFSubtraction().setSourceA(leafCap).setSourceB(sub);
|
||||||
|
|
||||||
|
SDF branch = new SDFSphere().setRadius(1).setBlock(EndBlocks.DRAGON_TREE.bark);
|
||||||
|
branch = new SDFScale3D().setScale(1, 2F / radius, 1).setSource(branch);
|
||||||
|
branch = new SDFTranslate().setTranslate(0, -radius * 0.25F - 1F, 0).setSource(branch);
|
||||||
|
branch = new SDFFlatWave().setRaysCount(branches).setIntensity(radius).setSource(branch);
|
||||||
|
branch = new SDFCoordModify().setFunction((bpos) -> {
|
||||||
|
float dist = MHelper.length(bpos.getX(), bpos.getZ());
|
||||||
|
bpos.set(bpos.getX(), bpos.getY() - dist * 0.1F, bpos.getZ());
|
||||||
|
}).setSource(branch);
|
||||||
|
SDF center = new SDFSphere().setRadius(3).setBlock(EndBlocks.DRAGON_TREE.bark);
|
||||||
|
center = new SDFFlatWave().setRaysCount(branches).setIntensity(3).setSource(center);
|
||||||
|
branch = new SDFUnion().setSourceA(branch).setSourceB(center);
|
||||||
|
sub = new SDFSphere().setRadius(radius + 1).setBlock(leaves);
|
||||||
|
sub = new SDFScale3D().setScale(1, 0.25F, 1).setSource(sub);
|
||||||
|
branch = new SDFSubtraction().setSourceA(branch).setSourceB(sub);
|
||||||
|
|
||||||
|
leafCap = new SDFUnion().setSourceA(leafCap).setSourceB(branch);
|
||||||
|
|
||||||
|
OpenSimplexNoise noise = new OpenSimplexNoise(1234);
|
||||||
|
leafCap = new SDFCoordModify().setFunction((bpos) -> {
|
||||||
|
float dist = MHelper.length(bpos.getX(), bpos.getZ());
|
||||||
|
float y = bpos.getY() + (float) noise.eval(bpos.getX() * 0.1 + pos.getX(), bpos.getZ() * 0.1 + pos.getZ()) * dist * 0.3F + dist * 0.25F;
|
||||||
|
bpos.set(bpos.getX(), y, bpos.getZ());
|
||||||
|
}).setSource(leafCap);
|
||||||
|
|
||||||
|
SDF smallLeaf = leafCap;
|
||||||
|
leafCap = new SDFTranslate().setTranslate(top.getX(), top.getY() + radius * 0.25F + 1.5F, top.getZ()).setSource(leafCap);
|
||||||
|
function = new SDFUnion().setSourceA(function).setSourceB(leafCap);
|
||||||
|
|
||||||
|
/*branches = Math.round((size - 15) * 0.1F);
|
||||||
|
if (branches > 0) {
|
||||||
|
SDF pie = new SDFPie().setRadius(50).setAngle((float) Math.toRadians(135)).setBlock(leaves);
|
||||||
|
smallLeaf = new SDFIntersection().setSourceA(leafCap).setSourceB(pie);
|
||||||
|
|
||||||
|
for (int i = 0; i < branches; i++) {
|
||||||
|
float indexF = MHelper.randRange(3F, 5F, random);
|
||||||
|
Vector3f vec = SplineHelper.getPos(spline, indexF);
|
||||||
|
float scale = MHelper.randRange(0.3F, 0.6F, random);
|
||||||
|
SDF leaf = new SDFScale().setScale(scale).setSource(smallLeaf);
|
||||||
|
leaf = new SDFRotation().setRotation(Vector3f.POSITIVE_Y, MHelper.randRange(0, MHelper.PI2, random)).setSource(leaf);
|
||||||
|
leaf = new SDFTranslate().setTranslate(vec.getX(), vec.getY(), vec.getZ()).setSource(leaf);
|
||||||
|
function = new SDFUnion().setSourceA(function).setSourceB(leaf);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
function.setReplaceFunction(REPLACE);
|
||||||
|
function.setPostProcess(POST);
|
||||||
|
function.fillRecursiveIgnore(world, pos, (state) -> {
|
||||||
|
return EndBlocks.DRAGON_TREE.isTreeLog(state) || state.isOf(EndBlocks.DRAGON_TREE_LEAVES);
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
REPLACE = (state) -> {
|
||||||
|
if (state.isIn(EndTags.END_GROUND)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (state.getBlock() == EndBlocks.DRAGON_TREE_LEAVES) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (state.getMaterial().equals(Material.PLANT)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return state.getMaterial().isReplaceable();
|
||||||
|
};
|
||||||
|
|
||||||
|
POST = (info) -> {
|
||||||
|
if (EndBlocks.DRAGON_TREE.isTreeLog(info.getStateUp()) && EndBlocks.DRAGON_TREE.isTreeLog(info.getStateDown())) {
|
||||||
|
return EndBlocks.DRAGON_TREE.log.getDefaultState();
|
||||||
|
}
|
||||||
|
return info.getState();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,13 +45,7 @@ public class LacugroveFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||||
/*Vector3f center = null;
|
|
||||||
for (int i = 3; i < 6; i++) {
|
|
||||||
center = spline.get(i);
|
|
||||||
float radius = MathHelper.lerp((i - 3F) / 2F, 6.5F, 3.7F) + MHelper.randRange(-0.5F, 0.5F, random);
|
|
||||||
radius *= (size - 15F) / 20F + 1F;
|
|
||||||
leavesBall(world, pos.add(center.getX(), center.getY(), center.getZ()), radius, random, noise);
|
|
||||||
}*/
|
|
||||||
float radius = MHelper.randRange(6F, 8F, random);
|
float radius = MHelper.randRange(6F, 8F, random);
|
||||||
radius *= (size - 15F) / 20F + 1F;
|
radius *= (size - 15F) / 20F + 1F;
|
||||||
Vector3f center = spline.get(4);
|
Vector3f center = spline.get(4);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": [
|
||||||
|
{
|
||||||
|
"model": "betterend:block/shadow_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "betterend:block/shadow_grass",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "betterend:block/shadow_grass",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "betterend:block/shadow_grass",
|
||||||
|
"y": 270
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": [
|
||||||
|
{ "model": "betterend:block/shadow_grass_path" },
|
||||||
|
{ "model": "betterend:block/shadow_grass_path", "y": 90 },
|
||||||
|
{ "model": "betterend:block/shadow_grass_path", "y": 180 },
|
||||||
|
{ "model": "betterend:block/shadow_grass_path", "y": 270 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -250,9 +250,9 @@
|
||||||
"block.betterend.dragon_tree_planks": "Доски из драконова древа",
|
"block.betterend.dragon_tree_planks": "Доски из драконова древа",
|
||||||
"block.betterend.dragon_tree_plate": "Нажимная плита из драконова древа",
|
"block.betterend.dragon_tree_plate": "Нажимная плита из драконова древа",
|
||||||
"block.betterend.dragon_tree_sign": "Табличка из драконова древа",
|
"block.betterend.dragon_tree_sign": "Табличка из драконова древа",
|
||||||
"block.betterend.dragon_tree_slab": "",
|
"block.betterend.dragon_tree_slab": "Плита из драконова древа",
|
||||||
"block.betterend.dragon_tree_stairs": "",
|
"block.betterend.dragon_tree_stairs": "Ступени из драконова древа",
|
||||||
"block.betterend.dragon_tree_stripped_bark": "",
|
"block.betterend.dragon_tree_stripped_bark": "Обтёсанная кора драконова древа",
|
||||||
"block.betterend.dragon_tree_stripped_log": "",
|
"block.betterend.dragon_tree_stripped_log": "Обтёсанное бревно драконова древа",
|
||||||
"block.betterend.dragon_tree_trapdoor": ""
|
"block.betterend.dragon_tree_trapdoor": "Люк из драконова древа"
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube",
|
||||||
|
"textures": {
|
||||||
|
"down": "block/end_stone",
|
||||||
|
"east": "betterend:block/shadow_grass_side",
|
||||||
|
"north": "betterend:block/shadow_grass_side",
|
||||||
|
"particle": "betterend:block/shadow_grass_side",
|
||||||
|
"south": "betterend:block/shadow_grass_side",
|
||||||
|
"up": "betterend:block/shadow_grass_top",
|
||||||
|
"west": "betterend:block/shadow_grass_side"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{ "parent": "betterend:block/path",
|
||||||
|
"textures": {
|
||||||
|
"top": "betterend:block/shadow_grass_path_top",
|
||||||
|
"side": "betterend:block/shadow_grass_side",
|
||||||
|
"bottom": "block/end_stone"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betterend:block/shadow_grass"
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betterend:block/shadow_grass_path"
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Add table
Add a link
Reference in a new issue