baritone icon indicating copy to clipboard operation
baritone copied to clipboard

Detect when blocks are clickable

Open ZacSharp opened this issue 9 months ago • 0 comments

This currently uses uncached reflection on the pathing thread, and I'd like to hear some other opinions on possible solutions.

The obvious solution would be a Reference2BoolOpenHashMap<Class<?>>, but due to not wanting to synchronize things that cache would have to live in CalculationContext despite caching static data. Instead we could use mixin to move the cache to a final field on Block instances, which has the only drawback of caching per Block instance, not subclass (and adding a public method to an mc class). Caching per subclass should be possible by using a custom transformer to directly write the value into the bytecode of the getter method, but that's clearly overkill. Using mixin to do this is probably not possible.

ZacSharp avatar Apr 13 '25 13:04 ZacSharp