Capsacis tree enhancements
|
@ -13,11 +13,16 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class CapsacisCapBlock extends BaseBlock {
|
||||
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
||||
public static final IntProperty COLOR = BlockProperties.COLOR;
|
||||
|
||||
public CapsacisCapBlock(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(color));
|
||||
public CapsacisCapBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(MaterialColor.MAGENTA));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(COLOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,9 +32,4 @@ public class CapsacisCapBlock extends BaseBlock {
|
|||
double pz = ctx.getBlockPos().getZ() * 0.1;
|
||||
return this.getDefaultState().with(COLOR, MHelper.floor(NOISE.eval(px, py, pz) * 3.5 + 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(COLOR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public class EndBiomes {
|
|||
public static final EndBiome BLOSSOMING_SPIRES = registerBiome(new BiomeBlossomingSpires(), BiomeType.LAND);
|
||||
public static final EndBiome SULPHUR_SPRINGS = registerBiome(new BiomeSulphurSprings(), BiomeType.LAND);
|
||||
public static final EndBiome UMBRELLA_JUNGLE = registerBiome(new BiomeUmbrellaJungle(), BiomeType.LAND);
|
||||
public static final EndBiome CAPSACIS_FOREST = registerBiome(new CapsacisForestBiome(), BiomeType.LAND);
|
||||
public static final EndBiome CAPSACIS_FOREST = registerSubBiome(new CapsacisForestBiome(), CHORUS_FOREST);
|
||||
//public static final EndBiome HANGING_GARDENS = registerBiome(new HangingGardensBiome(), BiomeType.LAND);
|
||||
|
||||
// Better End Void
|
||||
|
|
|
@ -195,9 +195,7 @@ public class EndBlocks {
|
|||
|
||||
// Tree from original concept (+ modifications)
|
||||
public static final Block CAPSACIS_SAPLING = registerBlock("capsacis_sapling", new UmbrellaTreeSaplingBlock());
|
||||
public static final Block CAPSACIS_CAP_BLACK = registerBlock("capsacis_cap_black", new CapsacisCapBlock(MaterialColor.BLACK));
|
||||
public static final Block CAPSACIS_CAP_WHITE = registerBlock("capsacis_cap_white", new CapsacisCapBlock(MaterialColor.WHITE));
|
||||
public static final Block CAPSACIS_CAP_PURPLE = registerBlock("capsacis_cap_purple", new CapsacisCapBlock(MaterialColor.MAGENTA));
|
||||
public static final Block CAPSACIS_CAP = registerBlock("capsacis_cap", new CapsacisCapBlock());
|
||||
public static final WoodenMaterial CAPSACIS = new WoodenMaterial("capsacis", MaterialColor.PURPLE, MaterialColor.LIGHT_BLUE);
|
||||
|
||||
// Small ecosystem tree
|
||||
|
|
|
@ -64,10 +64,7 @@ public class EndFeatures {
|
|||
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 CAPSACIS = new EndFeature("capsacis", new CapsacisTreeFeature((random) -> {
|
||||
int state = random.nextInt(3);
|
||||
return state == 0 ? EndBlocks.CAPSACIS_CAP_BLACK.getDefaultState() : state == 1 ? EndBlocks.CAPSACIS_CAP_PURPLE.getDefaultState() : EndBlocks.CAPSACIS_CAP_WHITE.getDefaultState();
|
||||
}), 1);
|
||||
public static final EndFeature CAPSACIS = new EndFeature("capsacis", new CapsacisTreeFeature(), 3);
|
||||
|
||||
// Bushes //
|
||||
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new BushFeature(EndBlocks.PYTHADENDRON_LEAVES, EndBlocks.PYTHADENDRON.bark), 4);
|
||||
|
|
|
@ -8,13 +8,17 @@ import ru.betterend.registry.EndSounds;
|
|||
public class CapsacisForestBiome extends EndBiome {
|
||||
public CapsacisForestBiome() {
|
||||
super(new BiomeDefinition("capsacis_forest")
|
||||
.setSurface(EndBlocks.SHADOW_GRASS, EndBlocks.CHORUS_NYLIUM)
|
||||
.setSurface(EndBlocks.CHORUS_NYLIUM)
|
||||
.setMusic(EndSounds.MUSIC_FOREST)
|
||||
.setWaterAndFogColor(84, 61, 127)
|
||||
.setFoliageColor(71, 45, 120)
|
||||
.setFogColor(78, 71, 92)
|
||||
.setFogDensity(1.5F)
|
||||
.addFeature(EndFeatures.CAPSACIS)
|
||||
.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addFeature(EndFeatures.TAIL_MOSS_WOOD)
|
||||
.addFeature(EndFeatures.TAIL_MOSS)
|
||||
.addFeature(EndFeatures.CHORUS_GRASS)
|
||||
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,18 @@ import com.google.common.collect.Lists;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
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.SDF;
|
||||
import ru.betterend.util.sdf.operator.SDFFlatWave;
|
||||
import ru.betterend.util.sdf.operator.SDFScale;
|
||||
import ru.betterend.util.sdf.operator.SDFSmoothUnion;
|
||||
import ru.betterend.util.sdf.operator.SDFTranslate;
|
||||
import ru.betterend.util.sdf.operator.SDFUnion;
|
||||
|
@ -28,12 +31,6 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
public class CapsacisTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final List<Vector3f> ROOT;
|
||||
|
||||
private final Function<Random, BlockState> capFunction;
|
||||
|
||||
public CapsacisTreeFeature(Function<Random, BlockState> capFunction) {
|
||||
this.capFunction = capFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||
|
@ -49,30 +46,41 @@ public class CapsacisTreeFeature extends DefaultFeature {
|
|||
|
||||
BlockState woodState = EndBlocks.CAPSACIS.bark.getDefaultState();
|
||||
BlockState logState = EndBlocks.CAPSACIS.log.getDefaultState();
|
||||
BlockState capState = capFunction.apply(random);
|
||||
BlockState capState = EndBlocks.CAPSACIS_CAP.getDefaultState();
|
||||
|
||||
SplineHelper.offsetParts(spline, random, 0.5F, 0, 0.5F);
|
||||
SDF sdf = SplineHelper.buildSDF(spline, 2.5F, 0.8F, (bpos) -> {
|
||||
return woodState;
|
||||
});
|
||||
|
||||
SDF cap = makeCap(height * 0.2F, height * 0.25F, random, capState);
|
||||
final float scale = config == null ? 1 : MHelper.randRange(1, 3, random);
|
||||
final float offset = height * 0.2F;
|
||||
final float radius = height * 0.25F;
|
||||
final float heightScale = radius * 2 * scale;
|
||||
final int count = MHelper.randRange(5, 7, random);
|
||||
final float angle = random.nextFloat() * MHelper.PI2;
|
||||
SDF cap = makeCap(offset, radius, count, angle, capState);
|
||||
|
||||
sdf = new SDFUnion().setSourceA(sdf).setSourceB(cap);
|
||||
sdf = new SDFScale().setScale(scale).setSource(sdf);
|
||||
makeRoots(world, center, height * 0.4F, random, woodState);
|
||||
sdf.addPostProcess((info) -> {
|
||||
if (EndBlocks.CAPSACIS.isTreeLog(info.getStateUp()) && EndBlocks.CAPSACIS.isTreeLog(info.getStateDown())) {
|
||||
return logState;
|
||||
}
|
||||
else if (info.getState().equals(capState)) {
|
||||
double off = Math.cos(Math.atan2(info.getPos().getX() - pos.getX(), info.getPos().getZ() - pos.getZ()) * count + angle) * 2;
|
||||
int color = (int) ((info.getPos().getY() - pos.getY() - radius) / heightScale * 7 + off);
|
||||
color = 7 - MathHelper.clamp(color, 0, 7);
|
||||
return info.getState().with(BlockProperties.COLOR, color);
|
||||
}
|
||||
return info.getState();
|
||||
}).fillRecursive(world, center);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private SDF makeCap(float offset, float radius, Random random, BlockState capState) {
|
||||
float angle = random.nextFloat() * MHelper.PI2;
|
||||
int count = MHelper.randRange(5, 7, random);
|
||||
private SDF makeCap(float offset, float radius, int count, float angle, BlockState capState) {
|
||||
SDF cap = new SDFSphere().setRadius(radius).setBlock(capState);
|
||||
SDF cone = new SDFCappedCone().setRadius1(radius).setRadius2(radius * 0.4F).setHeight(radius * 0.3F).setBlock(capState);
|
||||
cone = new SDFTranslate().setTranslate(0, radius * 0.3F, 0).setSource(cone);
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"variants": {
|
||||
"axis=x": [
|
||||
{ "model": "betterend:block/capsacis_bark_1", "x": 90, "y": 90 },
|
||||
{ "model": "betterend:block/capsacis_bark_2", "x": 90, "y": 90 },
|
||||
{ "model": "betterend:block/capsacis_bark_3", "x": 90, "y": 90 }
|
||||
],
|
||||
"axis=y": [
|
||||
{ "model": "betterend:block/capsacis_bark_1" },
|
||||
{ "model": "betterend:block/capsacis_bark_2" },
|
||||
{ "model": "betterend:block/capsacis_bark_3" }
|
||||
],
|
||||
"axis=z": [
|
||||
{ "model": "betterend:block/capsacis_bark_1", "x": 90 },
|
||||
{ "model": "betterend:block/capsacis_bark_2", "x": 90 },
|
||||
{ "model": "betterend:block/capsacis_bark_3", "x": 90 }
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"variants": {
|
||||
"color=0": { "model": "betterend:block/capsacis_cap_0" },
|
||||
"color=1": { "model": "betterend:block/capsacis_cap_1" },
|
||||
"color=2": { "model": "betterend:block/capsacis_cap_2" },
|
||||
"color=3": { "model": "betterend:block/capsacis_cap_3" },
|
||||
"color=4": { "model": "betterend:block/capsacis_cap_4" },
|
||||
"color=5": { "model": "betterend:block/capsacis_cap_5" },
|
||||
"color=6": { "model": "betterend:block/capsacis_cap_6" },
|
||||
"color=7": { "model": "betterend:block/capsacis_cap_7" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"variants": {
|
||||
"axis=x": [
|
||||
{ "model": "betterend:block/capsacis_log_1", "x": 90, "y": 90 },
|
||||
{ "model": "betterend:block/capsacis_log_2", "x": 90, "y": 90 },
|
||||
{ "model": "betterend:block/capsacis_log_3", "x": 90, "y": 90 }
|
||||
],
|
||||
"axis=y": [
|
||||
{ "model": "betterend:block/capsacis_log_1" },
|
||||
{ "model": "betterend:block/capsacis_log_2" },
|
||||
{ "model": "betterend:block/capsacis_log_3" }
|
||||
],
|
||||
"axis=z": [
|
||||
{ "model": "betterend:block/capsacis_log_1", "x": 90 },
|
||||
{ "model": "betterend:block/capsacis_log_2", "x": 90 },
|
||||
{ "model": "betterend:block/capsacis_log_3", "x": 90 }
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_log_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_log_side_2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_log_side_3"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_3"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_4"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_5"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_6"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/capsacis_cap_7"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_column",
|
||||
"textures": {
|
||||
"end": "betterend:block/capsacis_log_top",
|
||||
"side": "betterend:block/capsacis_log_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_column",
|
||||
"textures": {
|
||||
"end": "betterend:block/capsacis_log_top",
|
||||
"side": "betterend:block/capsacis_log_side_2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_column",
|
||||
"textures": {
|
||||
"end": "betterend:block/capsacis_log_top",
|
||||
"side": "betterend:block/capsacis_log_side_3"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 526 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 1.7 KiB |