Jump to content

[1.7.2] Block.blocksList [Update 1.6.4->1.7.2] Question


Recommended Posts

ok, you've right :) here's my code:

public boolean recurseCrops(ItemStack stack, World w, int x, int y, int z, EntityPlayer player)


        boolean used = false;

        for (int i = -rWheat; i <= rWheat; i++)

            for (int j = -rWheat; j <= rWheat; j++)


                int localX = x + i;

                int localY = y;

                int localZ = z + j;

                Block id = w.getBlock(localX, localY, localZ);

                int meta = w.getBlockMetadata(localX, localY, localZ);

                Block localBlock;

                if (localBlock != null && (localBlock instanceof BlockFlower || localBlock instanceof IPlantable))


                    if (localBlock.canHarvestBlock(player, meta))

                        localBlock.harvestBlock(w, player, localX, localY, localZ, meta);

                    w.setBlock(localX, localY, localZ, Blocks.air, 0, 3);

                    used = true;



        if (used)

            stack.damageItem(1, player);

        return used;


Link to comment
Share on other sites

localBlock is never assigned to a value. Remove the definition of it and rename the id variable to localBlock

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.