gbl / Beenfo

A small Minecraft mod that shows information about the content of bee nests and hives.
MIT License
20 stars 8 forks source link

Suggestion Forge 1.16.1 | Compatibility with Productive Bees #8

Closed plenet10 closed 4 years ago

plenet10 commented 4 years ago

Hi,

I have a server on forge version 32.0.98 and in my server logs every time I click on a beehive/Nest. I get a small error that the mod Beenfo cant access the data in Hive/Nest. I was wondering if this is an issue on the side of Productive Bees or on the side of Beenfo. Perhaps compatibility can be added? If more info is needed please ask.

Link To Pastbin

gbl commented 4 years ago

It seems like, with Productive Bees, not all hives have a honey level, but the Productive Bees gives will still "look like" normal hives to code. One of the commits to Productive bees explicitly states "Removed honey level state from solitary nests". Beenfo recognizes those hives, tries to pull the honey level from them, and fails, which results in that error message.

Cannot get property IntegerProperty{name=honey_level, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5]} as it does not exist in Block{productivebees:oak_wood_nest}

I guess I can add an extra check to make sure hives have that property, and set the honey level to 0 if they don't.

However, from looking at the source code of Productive Bees, it seems like that mod adds its own tooltip to nest/hive items, and opens its own GUI when you right click a hive with something else than shears/bottles. So, does it even make sense to use Beenfo together with that mod?

JaisDK commented 4 years ago

You can replace the instanceof BeehiveTileEntity check with a blockstate.hasProperty check so you don't show anything for blocks that don't have the state and you will be able to support non-beehive blocks having a honey level.

gbl commented 4 years ago

Version 1.1.2 which I just uploaded has the extra has check and assumes there's no honey when the property is missing.