steve4744/WhatIsThis

Some visual improvement suggestions

Closed this issue · 3 comments

I have a couple suggestions on how to improve the information displayed.

1: Display possible drops and their chances based on the loot table.

Gravel for instance when you look at it, only shows the drops as gravel x1, yet there is a 10%-100% chance to drop 0-1 flint depending on fortune level.
Copper Ore seems to show a different value between 2-5 each time you look at it, but the chances are 2-5 without Fortune even taken into account.

Not sure how difficult taking enchantments into account would be for displaying this, but at least displaying the base chances from the loot table would be nice. eg 0-1 for flint from gravel, 2-5 raw copper from copper ore.

Edit: Appears this works with some things, and others it is hit or miss, or doesn't behave right, so maybe is more of a bug. Looking at crops in a village just now, the drops displayed correctly.
Looking at a melon while moving, the drops number would change based on my movement. Actually so do crops...and so does a block of gravel cycle between showing flint and not.

2: Break/Harvest tool capability/requirements.

Showing in color if the tool or lack thereof in hand is suitable to break the block. eg; when using the Boss Bar the bar is green, if you had a tool or no tool that would result in no drop, have the bar be red. Green/Red text for drops in whichever display mode, to show drops or not.
This could also extend to showing in scoreboard/chat with drops, to list the appropriate tool to use if possible. eg; When looking at Obsidian, you need at least a Diamond Pickaxe.

Where the number of drops are variable, for example with Copper Ore, the plugin displays the value returned by getDrops which is the number raw copper items that would have been dropped if the block had been broken at that time. Each time you target the Copper Ore it will return a different number between 2 and 5 depending on that returned by getDrops.

Gravel will normally drop itself, occasionally a flint, so targeting gravel will normally show '1 x gravel' but will occasionally show '1 x flint' as is returned by getDrops.

This was by design rather than a bug, as the alternative would require storing each block (that has a range of drops) with the corresponding range (2-5, for example) and referencing that each time.

This is actually what happens in the cases where the range of drops starts at zero. A melon stem can drop 0-3 seeds, so to avoid it sometimes displaying 0 drops, it always displays the range 0-3.

I'll have a look at changing this so the range is displayed rather than the random amount.

I'm no dev, so I have no idea if I'm correct in looking at the bukkit javadocs, but appears there is a getLootTable method. Maybe that can be checked and cached?
It's just really odd seeing it change constantly as you move back and forth from the block, and if it does work that way based on getDrops, then players can likely game it for drops if they figure that out too.

Thanks for the suggestions. Displaying the fixed range of drops is probably more useful than the random amounts, and was implemented in 11f5640.
The other suggestions are really outside the scope of this plugin, the main purpose of which is to display the name of the block (and optionally its drops) as quickly as possible without impacting server performance. The forge mods which do a similar role run client side so can do a lot more than Bukkit plugins which run server side.