Fixes
This commit is contained in:
parent
9281fabd5f
commit
d87b98fcd7
5 changed files with 42 additions and 13 deletions
|
@ -14,11 +14,20 @@ import ru.betterend.interfaces.Patterned;
|
|||
|
||||
public class BlockLeaves extends LeavesBlock implements Patterned, IRenderTypeable {
|
||||
public BlockLeaves(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).materialColor(color));
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
||||
.allowsSpawning((state, world, pos, type) -> { return false; })
|
||||
.suffocates((state, world, pos) -> { return false; })
|
||||
.blockVision((state, world, pos) -> { return false; })
|
||||
.materialColor(color));
|
||||
}
|
||||
|
||||
public BlockLeaves(MaterialColor color, int light) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).materialColor(color).luminance(light));
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
||||
.allowsSpawning((state, world, pos, type) -> { return false; })
|
||||
.suffocates((state, world, pos) -> { return false; })
|
||||
.blockVision((state, world, pos) -> { return false; })
|
||||
.materialColor(color)
|
||||
.luminance(light));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FallingBlock;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
|
@ -286,4 +287,31 @@ public class BlocksHelper {
|
|||
public static Direction randomHorizontal(Random random) {
|
||||
return HORIZONTAL[random.nextInt(4)];
|
||||
}
|
||||
|
||||
public static BlockState getLeavesState(BlockState state, WorldAccess world, BlockPos pos) {
|
||||
int i = 7;
|
||||
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
||||
Direction[] var5 = Direction.values();
|
||||
int var6 = var5.length;
|
||||
|
||||
for (int var7 = 0; var7 < var6; ++var7) {
|
||||
Direction direction = var5[var7];
|
||||
mutable.set(pos, direction);
|
||||
i = Math.min(i, getDistanceFromLog(world.getBlockState(mutable)) + 1);
|
||||
if (i == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (BlockState) state.with(LeavesBlock.DISTANCE, i);
|
||||
}
|
||||
|
||||
private static int getDistanceFromLog(BlockState state) {
|
||||
if (BlockTags.LOGS.contains(state.getBlock())) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return state.getBlock() instanceof LeavesBlock ? (Integer) state.get(LeavesBlock.DISTANCE) : 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DragonTreeBushFeature extends DefaultFeature {
|
|||
BlockState leaves = EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1);
|
||||
float radius = MHelper.randRange(1.8F, 4.5F, random);
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
|
||||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 6));
|
||||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
|
||||
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
|
||||
|
|
|
@ -111,7 +111,7 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
private void leavesBall(StructureWorldAccess world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 6));
|
||||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
|
||||
SDF sub = new SDFScale().setScale(5).setSource(sphere);
|
||||
sub = new SDFTranslate().setTranslate(0, -radius * 5, 0).setSource(sub);
|
||||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub);
|
||||
|
|
|
@ -124,15 +124,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
|
|||
}
|
||||
return info.getState();
|
||||
});
|
||||
sphere.fillRecursiveIgnore(world, pos.up(), IGNORE);
|
||||
|
||||
/*if (radius > 5) {
|
||||
int count = (int) (radius * 2.5F);
|
||||
for (int i = 0; i < count; i++) {
|
||||
BlockPos p = pos.add(random.nextGaussian() * 1.5, random.nextGaussian() * 1.5, random.nextGaussian() * 1.5);
|
||||
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.PYTHADENDRON.bark);
|
||||
}
|
||||
}*/
|
||||
sphere.fillRecursiveIgnore(world, pos, IGNORE);
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue