Biomes O' Plenty

Biomes O' Plenty

151M Downloads

Crash with Plant mega pack

sweetsosweet opened this issue ยท 10 comments

commented

Hiya, I'm getting a crash with the latest version of PMP and BOP for 1.8.9 here:

http://pastebin.com/4M9JsYuR

commented

Adubbz here is the code in PMP that is causing this:

@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this); }

My block extends BlockBush and implements IPlantable and IShearable. For this block IPlantable returns EnumPlantType.Plains or EnumPlantType.Desert only.

commented

I can see what the issue is, you're calling pos.down().getBlock(), but we're assuming the that's also the block you've supplied the pos argument for (canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)).

EDIT:
Nevermind what I said after this, was looking at our version of the method. From the Forge docs:

@param pos Block position in world

Which implies that you should be calling it as suggested above. Additionally, this appears to be how Forge itself uses the method. From BlockBush:

soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this);

commented

I think you need to reopen this issue. I have had 10paktimbits doing extensive testing and debugging. Much has been done i Plant Mega Pack, but the error still persists. I am also getting the same error from the mod ExtraFood. So, my best guess is that there is something wrong inside BoP's override of canSustainPlant.

See these forums posts for more info from PMP.
http://10paksmods.net/forum/showthread.php?tid=4&pid=897#pid897
http://10paksmods.net/forum/showthread.php?tid=4&pid=904#pid904

And my bug report of this from ExtraFood:
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2213570-1-7-10-1-8-9-extra-food?page=2#c27

commented

Adubbz this was fixed in PMP a while back. In my testing there is NOT an issue here at all with BoP or PMP.

spindisc this issue needs to be closed as far as BoP-PMP are concerned.

commented

Yeah, reading that forum thread that was my impression. At the end of the day, it's a simple issue with a simple fix, and neither BoP or PMP should be part of the problem anymore

commented

My apologies for the trouble here Adubbz.

commented

All good, you did nothing wrong and by the sounds of it got onto the problem pretty fast :)

commented

Thx :)

BoP is looking absolutely fantastic btw. Credit to you for the amount of work you've put into it.

commented

Thank you :)

commented

In the case of ExtraFood, they're doing something similar but not exactly the same. From here: https://github.com/TeamDmfMM/Extra-Food/blob/master1.8/src/main/java/dmf444/ExtraFood/Common/WorldGen/OliveWorldGenTrees.java#L92

Block block2 = world.getBlockState(new BlockPos(x, y - 1, z).down()).getBlock();
boolean isSoil = block2.canSustainPlant(world, pos.down(), EnumFacing.UP, (BlockSapling)Blocks.sapling);

should be

BlockPos soilPos= new BlockPos(x, y, z).down();
Block soilBlock = world.getBlockState(soilPos).getBlock();
boolean isSoil = soilBlock.canSustainPlant(world, soilPos, EnumFacing.UP, (BlockSapling)Blocks.sapling);

Now that may be wrong in the context of their code, but the simple fact is, everyone seems to be mismatching the arguments for this method. However Forge quite clearly shows how it should be done in their patches of classes such as BlockBushas mentioned in a previous comment. It's not up to us to account for every potential mistake people could make in calling the method the right way.

I understand that we show up in the stacktrace as the root cause of this, but that doesn't necessarily mean we're at fault. If someone has a solid example of why we are, then i'd be happy to listen to whatever they have to say about the matter.