Plants rebalance, umbrella tree clusters

This commit is contained in:
paulevsGitch 2020-12-24 21:02:16 +03:00
parent a9ea7a1448
commit eb1ae97c50
21 changed files with 142 additions and 13 deletions

View file

@ -21,7 +21,7 @@ public class BlockTwistedUmbrellaMoss extends BlockPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
return state.isOf(EndBlocks.END_MOSS) || state.isOf(EndBlocks.END_MYCELIUM) || state.isOf(EndBlocks.JUNGLE_MOSS);
}
@Environment(EnvType.CLIENT)

View file

@ -23,6 +23,6 @@ public class BlockTwistedUmbrellaMossTall extends BlockDoublePlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
return state.isOf(EndBlocks.END_MOSS) || state.isOf(EndBlocks.END_MYCELIUM) || state.isOf(EndBlocks.JUNGLE_MOSS);
}
}

View file

@ -21,7 +21,7 @@ public class BlockUmbrellaMoss extends BlockPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
return state.isOf(EndBlocks.END_MOSS) || state.isOf(EndBlocks.END_MYCELIUM) || state.isOf(EndBlocks.JUNGLE_MOSS);
}
@Environment(EnvType.CLIENT)

View file

@ -23,6 +23,6 @@ public class BlockUmbrellaMossTall extends BlockDoublePlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
return state.isOf(EndBlocks.END_MOSS) || state.isOf(EndBlocks.END_MYCELIUM) || state.isOf(EndBlocks.JUNGLE_MOSS);
}
}

View file

@ -0,0 +1,26 @@
package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.MaterialColor;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import ru.betterend.blocks.basis.BlockBase;
public class BlockUmbrellaTreeCluster extends BlockBase {
public static final BooleanProperty NATURAL = BooleanProperty.of("natural");
public BlockUmbrellaTreeCluster() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK)
.materialColor(MaterialColor.PURPLE)
.luminance(15));
setDefaultState(stateManager.getDefaultState().with(NATURAL, false));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(NATURAL);
}
}

View file

@ -0,0 +1,39 @@
package ru.betterend.blocks;
import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.MaterialColor;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class BlockUmbrellaTreeClusterEmpty extends BlockBase {
public static final BooleanProperty NATURAL = BooleanProperty.of("natural");
public BlockUmbrellaTreeClusterEmpty() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK)
.materialColor(MaterialColor.PURPLE)
.ticksRandomly());
setDefaultState(stateManager.getDefaultState().with(NATURAL, false));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(NATURAL);
}
@Override
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (state.get(NATURAL) && random.nextInt(16) == 0) {
BlocksHelper.setWithUpdate(world, pos, EndBlocks.UMBRELLA_TREE_CLUSTER.getDefaultState().with(BlockUmbrellaTreeCluster.NATURAL, true));
}
}
}

View file

@ -67,6 +67,8 @@ import ru.betterend.blocks.BlockTwistedUmbrellaMoss;
import ru.betterend.blocks.BlockTwistedUmbrellaMossTall;
import ru.betterend.blocks.BlockUmbrellaMoss;
import ru.betterend.blocks.BlockUmbrellaMossTall;
import ru.betterend.blocks.BlockUmbrellaTreeCluster;
import ru.betterend.blocks.BlockUmbrellaTreeClusterEmpty;
import ru.betterend.blocks.BlockUmbrellaTreeMembrane;
import ru.betterend.blocks.BlockVentBubbleColumn;
import ru.betterend.blocks.EndPortalBlock;
@ -105,6 +107,7 @@ public class EndBlocks {
public static final Block SHADOW_GRASS = registerBlock("shadow_grass", new BlockShadowGrass());
public static final Block PINK_MOSS = registerBlock("pink_moss", new BlockTerrain(MaterialColor.PINK));
public static final Block AMBER_MOSS = registerBlock("amber_moss", new BlockTerrain(MaterialColor.ORANGE));
public static final Block JUNGLE_MOSS = registerBlock("jungle_moss", new BlockTerrain(MaterialColor.ORANGE));
// Roads //
public static final Block END_MYCELIUM_PATH = registerBlock("end_mycelium_path", new BlockPath(END_MYCELIUM));
@ -115,6 +118,7 @@ public class EndBlocks {
public static final Block SHADOW_GRASS_PATH = registerBlock("shadow_grass_path", new BlockPath(SHADOW_GRASS));
public static final Block PINK_MOSS_PATH = registerBlock("pink_moss_path", new BlockPath(PINK_MOSS));
public static final Block AMBER_MOSS_PATH = registerBlock("amber_moss_path", new BlockPath(AMBER_MOSS));
public static final Block JUNGLE_MOSS_PATH = registerBlock("jungle_moss_path", new BlockPath(JUNGLE_MOSS));
// Rocks //
public static final StoneMaterial FLAVOLITE = new StoneMaterial("flavolite", MaterialColor.SAND);
@ -238,6 +242,9 @@ public class EndBlocks {
// Crops //
public static final Block SHADOW_BERRY = registerBlock("shadow_berry", new BlockShadowBerry());
public static final Block UMBRELLA_TREE_CLUSTER = registerBlock("umbrella_tree_cluster", new BlockUmbrellaTreeCluster());
public static final Block UMBRELLA_TREE_CLUSTER_EMPTY = registerBlock("umbrella_tree_cluster_empty", new BlockUmbrellaTreeClusterEmpty());
// Vines //
public static final Block DENSE_VINE = registerBlock("dense_vine", new BlockVine(15, true));
public static final Block TWISTED_VINE = registerBlock("twisted_vine", new BlockVine());

View file

@ -79,7 +79,7 @@ public class EndFeatures {
public static final EndFeature AMBER_GRASS = new EndFeature("amber_grass", new SinglePlantFeature(EndBlocks.AMBER_GRASS, 6), 9);
public static final EndFeature LANCELEAF = new EndFeature("lanceleaf", new LanceleafFeature(), 3);
public static final EndFeature GLOW_PILLAR = new EndFeature("glow_pillar", new GlowPillarFeature(), 1);
public static final EndFeature TWISTED_UMBRELLA_MOSS = new EndFeature("twisted_umbrella_moss", new DoublePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS_TALL, 9), 6);
public static final EndFeature TWISTED_UMBRELLA_MOSS = new EndFeature("twisted_umbrella_moss", new DoublePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS_TALL, 6), 5);
// Vines //
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);

View file

@ -10,10 +10,9 @@ public class BiomeUmbrellaJungle extends EndBiome {
.setWaterAndFogColor(119, 198, 253)
.setFoliageColor(27, 183, 194)
.setFogDensity(2.3F)
.setSurface(EndBlocks.END_MOSS)
.setSurface(EndBlocks.JUNGLE_MOSS)
.addFeature(EndFeatures.UMBRELLA_TREE)
.addFeature(EndFeatures.TWISTED_UMBRELLA_MOSS)
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.END_LAKE));
}
}

View file

@ -15,6 +15,7 @@ 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.BlockUmbrellaTreeCluster;
import ru.betterend.blocks.BlockUmbrellaTreeMembrane;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
@ -44,7 +45,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
BlockState wood = EndBlocks.UMBRELLA_TREE.bark.getDefaultState();
BlockState membrane = EndBlocks.UMBRELLA_TREE_MEMBRANE.getDefaultState().with(BlockUmbrellaTreeMembrane.COLOR, 1);
BlockState center = EndBlocks.UMBRELLA_TREE_MEMBRANE.getDefaultState().with(BlockUmbrellaTreeMembrane.COLOR, 0);
BlockState fruit = EndBlocks.GLOWING_PILLAR_LUMINOPHOR.getDefaultState();
BlockState fruit = EndBlocks.UMBRELLA_TREE_CLUSTER.getDefaultState().with(BlockUmbrellaTreeCluster.NATURAL, true);
float size = MHelper.randRange(10, 20, random);
int count = (int) (size * 0.15F);
@ -55,7 +56,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
float scale = 1;
if (config != null) {
scale = MHelper.randRange(1F, 2F, random);
scale = MHelper.randRange(1F, 1.7F, random);
}
for (int i = 0; i < count; i++) {
@ -68,7 +69,8 @@ public class UmbrellaTreeFeature extends DefaultFeature {
SplineHelper.offsetParts(spline, random, 0.5F, 0, 0.5F);
if (SplineHelper.canGenerate(spline, pos, world, REPLACE)) {
SDF branch = SplineHelper.buildSDF(spline, 1.2F * scale, 0.8F * scale, (bpos) -> {
float rScale = (scale - 1) * 0.4F + 1;
SDF branch = SplineHelper.buildSDF(spline, 1.2F * rScale, 0.8F * rScale, (bpos) -> {
return wood;
});
@ -118,11 +120,11 @@ public class UmbrellaTreeFeature extends DefaultFeature {
}
return info.getState();
}).fillRecursive(world, pos);
makeRoots(world, pos.add(0, 2, 0), (size * 0.3F + 3) * scale, random, wood);
makeRoots(world, pos, (size * 0.5F + 3) * scale, random, wood);
for (Center c: centers) {
if (!world.getBlockState(new BlockPos(c.px, c.py, c.pz)).isAir()) {
count = random.nextInt(4);
count = MHelper.floor(MHelper.randRange(1F, 5F, random) * scale);
float startAngle = random.nextFloat() * MHelper.PI2;
for (int i = 0; i < count; i++) {
float angle = (float) i / count * MHelper.PI2 + startAngle;
@ -175,7 +177,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
private void makeFruits(StructureWorldAccess world, double px, double py, double pz, Random random, BlockState fruit, float scale) {
Mutable mut = new Mutable();
int length = MHelper.floor(MHelper.randRange(1F, 3F, random) * scale + 0.5F);
int length = MHelper.floor(MHelper.randRange(1F, 5F, random) * scale + 0.5F);
for (int i = 0; i < length; i++) {
mut.setY(MHelper.floor(py - i));
//mut.setX(MHelper.floor(px));

View file

@ -0,0 +1,21 @@
{
"variants": {
"": [
{
"model": "betterend:block/jungle_moss"
},
{
"model": "betterend:block/jungle_moss",
"y": 90
},
{
"model": "betterend:block/jungle_moss",
"y": 180
},
{
"model": "betterend:block/jungle_moss",
"y": 270
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"variants": {
"": [
{ "model": "betterend:block/jungle_moss_path" },
{ "model": "betterend:block/jungle_moss_path", "y": 90 },
{ "model": "betterend:block/jungle_moss_path", "y": 180 },
{ "model": "betterend:block/jungle_moss_path", "y": 270 }
]
}
}

View file

@ -0,0 +1,12 @@
{
"parent": "block/cube",
"textures": {
"down": "block/end_stone",
"east": "betterend:block/jungle_moss_side",
"north": "betterend:block/jungle_moss_side",
"particle": "betterend:block/jungle_moss_side",
"south": "betterend:block/jungle_moss_side",
"up": "betterend:block/jungle_moss_top",
"west": "betterend:block/jungle_moss_side"
}
}

View file

@ -0,0 +1,7 @@
{ "parent": "betterend:block/path",
"textures": {
"top": "betterend:block/jungle_moss_path_top",
"side": "betterend:block/jungle_moss_side",
"bottom": "block/end_stone"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/jungle_moss"
}

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/jungle_moss_path"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B