Croptopia

Croptopia

30M Downloads

Make Tree Crops give drop directly to player

milkev opened this issue ยท 3 comments

commented

Make sure you are not opening a duplicate.

Description of your suggestion.

When harvesting tree crops, more often than not, they rise up above the tree, onto the top of it. it makes it a pain to go pick them up, and, atleast for me, has resulted in ignoring most of the tree crops.

it would be great if the harvested items dropped below the tree crop block, or if they were just given directly to the player. this would make harvesting from trees a lot less painful.

commented

yup, going to make them drop on the player instead of at the block location most likely.

commented

I'd rather suggest dropping the items with a direction. That way, for example, the harvest falls down, if the leaf block is used from below:

    @Override
    public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
        if (getAge(state) == getMaxAge()) {
            world.setBlockState(pos, this.withAge(0), 2);
            if (world instanceof ServerWorld) {
                getDroppedStacks(state, (ServerWorld)world, pos, null).forEach((stack) -> {
                    dropStack(world, pos, hit.getSide(), stack);
                });
                state.onStacksDropped((ServerWorld)world, pos, ItemStack.EMPTY);

                return ActionResult.CONSUME;
            }
            return ActionResult.SUCCESS ;
        }
        return ActionResult.PASS;
    }

Also, use ActionResult.SUCCESS on the client, so it shows the arm swing animation. (This should also be done in CroptopiaCropBlock.onUse)

commented

That's actually a really nice solution! it'll be added in 1.7.0