Tenanea leaves and fixes

This commit is contained in:
paulevsGitch 2020-11-26 15:40:46 +03:00
parent 5ee7a94ef6
commit b28cb6449c
8 changed files with 37 additions and 24 deletions

View file

@ -60,7 +60,6 @@ public class BlockFur extends BlockBaseNotFull implements IRenderTypeable {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.WET_GRASS)
.luminance(15)
.breakByHand(true)
.noCollision());
this.drop = drop;
@ -98,7 +97,7 @@ public class BlockFur extends BlockBaseNotFull implements IRenderTypeable {
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction direction = (Direction) state.get(FACING);
BlockPos blockPos = pos.offset(direction.getOpposite());
return sideCoversSmallSquare(world, blockPos, direction) || world.getBlockState(pos).isIn(BlockTags.LEAVES);
return sideCoversSmallSquare(world, blockPos, direction) || world.getBlockState(blockPos).isIn(BlockTags.LEAVES);
}
@Override

View file

@ -38,6 +38,7 @@ public class TenaneaFeature extends DefaultFeature {
private static final Function<BlockState, Boolean> REPLACE;
private static final Function<BlockState, Boolean> IGNORE;
private static final List<Vector3f> SPLINE;
private static final Direction[] DIRECTIONS = Direction.values();
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
@ -82,16 +83,16 @@ public class TenaneaFeature extends DefaultFeature {
}
}
BlockState top = EndBlocks.TENANEA_FLOWERS.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP);
BlockState middle = EndBlocks.TENANEA_FLOWERS.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE);
BlockState bottom = EndBlocks.TENANEA_FLOWERS.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM);
BlockState outer = EndBlocks.TENANEA_OUTER_LEAVES.getDefaultState();
List<BlockPos> support = Lists.newArrayList();
sphere.setPostProcess((info) -> {
if (info.getStateDown().isAir()) {
if (random.nextBoolean()) {
support.add(info.getPos().toImmutable());
}
else {
info.setState(info.getPos().down(), outer.with(BlockFur.FACING, Direction.DOWN));
}
if (random.nextBoolean() && info.getStateDown().isAir()) {
BlockPos d = info.getPos().down();
support.add(d);
}
if (random.nextInt(5) == 0) {
for (Direction dir: Direction.values()) {
@ -103,14 +104,14 @@ public class TenaneaFeature extends DefaultFeature {
info.setState(EndBlocks.TENANEA.bark.getDefaultState());
}
if (info.getState().isOf(EndBlocks.TENANEA_LEAVES)) {
for (Direction d: BlocksHelper.HORIZONTAL) {
if (info.getState(d).isAir()) {
info.setState(info.getPos().offset(d), outer.with(BlockFur.FACING, Direction.DOWN));
}
MHelper.shuffle(DIRECTIONS, random);
for (Direction d: DIRECTIONS) {
if (info.getState(d).isAir()) {
info.setBlockPos(info.getPos().offset(d), outer.with(BlockFur.FACING, d));
}
}
else if (EndBlocks.TENANEA.isTreeLog(info.getState())) {
if (EndBlocks.TENANEA.isTreeLog(info.getState())) {
for (int x = -6; x < 7; x++) {
int ax = Math.abs(x);
mut.setX(x + info.getPos().getX());
@ -137,16 +138,11 @@ public class TenaneaFeature extends DefaultFeature {
return info.getState();
});
sphere.fillRecursiveIgnore(world, pos, IGNORE);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.TENANEA.bark);
BlockState top = EndBlocks.TENANEA_FLOWERS.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP);
BlockState middle = EndBlocks.TENANEA_FLOWERS.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE);
BlockState bottom = EndBlocks.TENANEA_FLOWERS.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM);
support.forEach((bpos) -> {
int count = MHelper.randRange(5, 9, random);
mut.set(bpos).move(Direction.DOWN);
int count = MHelper.randRange(3, 8, random);
mut.set(bpos);
BlocksHelper.setWithoutUpdate(world, mut, top);
for (int i = 1; i < count; i++) {
mut.setY(mut.getY() - 1);

View file

@ -332,5 +332,6 @@
"block.betterend.amber_ore": "Amber Ore",
"item.betterend.amber_gem": "Amber Gem",
"item.betterend.raw_amber": "Raw Amber",
"block.betterend.tenanea_flowers": "Tenanea Flowers"
"block.betterend.tenanea_flowers": "Tenanea Flowers",
"block.betterend.tenanea_outer_leaves": "Tenanea Outer Leaves"
}

View file

@ -334,5 +334,6 @@
"block.betterend.amber_ore": "Янтарная руда",
"item.betterend.amber_gem": "Огранённый янтарь",
"item.betterend.raw_amber": "Необработанный янтарь",
"block.betterend.tenanea_flowers": "Цветы тенанеи"
"block.betterend.tenanea_flowers": "Цветы тенанеи",
"block.betterend.tenanea_outer_leaves": "Внешние листья тенанеи"
}

View file

@ -0,0 +1,3 @@
{
"defaultMaterial": "betterend:leaves_noshade"
}

View file

@ -0,0 +1,3 @@
{
"defaultMaterial": "betterend:leaves_noshade"
}

View file

@ -0,0 +1,10 @@
{
"layers": [
{
"vertexSource": "betterend:shaders/material/wave.vert",
"fragmentSource": "canvas:shaders/material/default.frag",
"disableAo": true,
"disableDiffuse": true
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After