squeek502 / WailaHarvestability

Minecraft mod that adds required harvest level and the effective tool to Waila tooltips of harvestable blocks
The Unlicense
17 stars 21 forks source link

Camouflaged blocks give an <Error> #45

Closed Darkhax closed 8 years ago

Darkhax commented 8 years ago

My mod Dark Utilities has several blocks which can be camouflaged to look like other blocks. To help maintain the illusion while Waila is installed, I override the getWailaStack method to return the held camouflage block. When Waila Harvestability is installed, this will cause the mod to throw an exception which is caught by Waila. The following is the exception that is caught.

[19:57:59] [Client thread/WARN] [Waila]: net.minecraft.block.state.BlockState$StateImplementation.getValue:137
[19:57:59] [Client thread/WARN] [Waila]: net.minecraft.block.BlockStone.getMetaFromState:89
[19:57:59] [Client thread/WARN] [Waila]: net.minecraft.block.Block.getHarvestTool:2300
[19:57:59] [Client thread/WARN] [Waila]: net.minecraftforge.common.ForgeHooks.canHarvestBlock:136
[19:57:59] [Client thread/WARN] [Waila]: squeek.wailaharvestability.WailaHandler.getHarvestability:123
[19:57:59] [Client thread/WARN] [Waila]: Catched unhandled exception : [class squeek.wailaharvestability.WailaHandler] java.lang.IllegalArgumentException: Cannot get property PropertyEnum{name=variant, clazz=class net.minecraft.block.BlockStone$EnumType, values=[stone, granite, smooth_granite, diorite, smooth_diorite, andesite, smooth_andesite]} as it does not exist in ExtendedBlockState{block=darkutils:sneaky_ghost, properties=[]}
squeek502 commented 8 years ago

Hmm... looks like ForgeHooks.canHarvestBlock is weird in 1.8.9, since it now takes the position rather than meta and does a weird mixture of using the passed in Block and the world.getBlockState(pos).getBlock(). Would probably be worth sending a PR to Forge for an overloaded ForgeHooks.canHarvestBlock method that takes an IBlockState rather than IBlockAccess/BlockPos.

squeek502 commented 8 years ago

Closed by e626a16