I want to make an item that will cut the tree completely, without clinging to the structure of the trees that are nearby. I tried to do it starting from the fabric manual, but a specific tree generation algorithm is already written there. Perhaps you have suggestions, or solutions to this problem.
public static List<BlockPos> structureTree(World world, PlayerEntity playerEntity) {
ArrayList<BlockPos> potentialBrokenBlocks = new ArrayList<>();
Vec3d cameraPos = playerEntity.getCameraPosVec(1);
Vec3d rotation = playerEntity.getRotationVec(1);
Vec3d combined = cameraPos.add(rotation.x * 4.5F, rotation.y * 4.5F, rotation.z * 4.5F);
BlockHitResult blockHitResult = world.raycast(new RaycastContext(cameraPos, combined, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, playerEntity));
if (blockHitResult.getType() == HitResult.Type.BLOCK) {
ArrayList<Vec3i> positions = new ArrayList<>();
for (//HERE I AM TRYING TO READ THE STRUCTURE OF THE WOOD//) {
positions.add(//HERE I AM TRYING TO ADD THE COORDINATES OF THE TREE STRUCTURE//);
}
for (Vec3i pos : positions) {
potentialBrokenBlocks.add(blockHitResult.getBlockPos().add(pos));
}
}
return potentialBrokenBlocks;
}
I want to make an item that will cut the tree completely, without clinging to the structure of the trees that are nearby. I tried to do it starting from the fabric manual, but a specific tree generation algorithm is already written there. Perhaps you have suggestions, or solutions to this problem.