Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Fix incorrect isInteractable() materials

Open Machine-Maker opened this issue 2 years ago • 3 comments

Due to an incorrect PerMaterialTest, all stairs were reporting as "interactable", when they are not.

This PR, updates the check in Material and fixes the test to accurately test interactability.

Machine-Maker avatar May 18 '23 19:05 Machine-Maker

This behavior has been documented, so the javadoc should be updated if this behavior is no longer intended

Lulu13022002 avatar May 18 '23 20:05 Lulu13022002

Oh I didn't see that it was documented... that kinda complicates things? Based on the convo I just had on discord, I'm not sure what this method's purpose is anymore. It doesn't cover things that a reasonable person would think, and then has false positives.

Machine-Maker avatar May 18 '23 20:05 Machine-Maker

The way I see it - the method should return true for blocks that are making a player raise their hand upon interacting with. And the rest of blocks seems to be this way (well, maybe aside of MOVING_PISTON mentioned in javadocs, since player can't do anything with it). So, as for me, stairs being interactable is rather an unexpected behavior.

imDaniX avatar May 22 '23 11:05 imDaniX

Changed this to just deprecate Material#isInteractable. The method is not really a useful way to learn anything about interactions with plenty of incorrect Material returning true, and plenty not returning true when it would be expected that it does.

Interactions are dependent upon world state when the interaction occurs.

Machine-Maker avatar Jul 22 '23 20:07 Machine-Maker