SantacreeperLP Posted May 23, 2014 Posted May 23, 2014 Hey I'm updating my mod to 1.7.2 and I've get an error: Block localBlock = Block.blocksList[id]; But how can I write it in 1.7.2? Can you give me an short example? ~Santa Quote
SantacreeperLP Posted May 23, 2014 Author Posted May 23, 2014 I know this, but blockList isn't there anymore. Quote
SantacreeperLP Posted May 23, 2014 Author Posted May 23, 2014 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; } Quote
SanAndreaP Posted May 23, 2014 Posted May 23, 2014 localBlock is never assigned to a value. Remove the definition of it and rename the id variable to localBlock Quote 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.
Recommended Posts
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.