fabric
fabric copied to clipboard
Add way to specify the PathNodeType for a block, add missing tests in content registries testmod.
This is the same as https://github.com/FabricMC/fabric/pull/2437 See discussion in https://github.com/FabricMC/fabric/pull/2437
- [x] ~Lithium causes crash because overwrites the mixin.~ (fixed on fabric side by lowering mixin priority to 999, needs an update on lithium side to remove the overwrite mixin (see PR #392)
- [x] Separate advanced (with world and pos) from main registry, and add a way to check if a block is registered with advanced, or simple, node type customization (this is useful for performance mods).
Summary
This pr adds a way to specify that a specific block will cause damage, and entities should avoid that block. In vanilla this is done by getting the node type for the block while calculating the path for the entity (every block is a node).
You can also specify what an entity will think aboud the block when finds it in a neighbor position in his path, while traveling the world terrain.
Testing
Dead Bush is marked as dangerous, with the same value as berry bush, every entity (except foxes and bees) avoid it.
https://user-images.githubusercontent.com/32025549/182221967-e24de458-94d0-47d3-8ca9-6e513223cdfb.mp4
@kevinthegreat1 i've changed almost all files, please re-check again for grammar errors.
Pepper commented the following on Discord:
Will a method with BlockPos and level be added? I read that not passing those allows the type to be cached, which is true, but what if that is not enough context? Both paths should exist.
Thoughts?
I have an idea about this, i will push for review tomorrow.
- [x] ~Will a method with BlockPos and level be added?~ reworked including this too
Brief resume of the last changes (20 September)
I've used the previous solution (with a registry instead of injected interfaces), but now there are two registration methods (for dynamic and static registration) + some new methods to check if a block is registered and if it is registered as static or dynamic.
I've also reverted by using dead bush for testing (this is only a detail).
Thanks a lot for this @devpelux and especially for putting in the effort to sort out the issues we found last min when we first merged this. 👍