fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Add way to specify the PathNodeType for a block, add missing tests in content registries testmod.

Open devpelux opened this issue 2 years ago • 4 comments

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

devpelux avatar Sep 11 '22 15:09 devpelux

@kevinthegreat1 i've changed almost all files, please re-check again for grammar errors.

devpelux avatar Sep 12 '22 00:09 devpelux

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?

Technici4n avatar Sep 13 '22 22:09 Technici4n

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

devpelux avatar Sep 13 '22 23:09 devpelux

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).

devpelux avatar Sep 22 '22 19:09 devpelux

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. 👍

modmuss50 avatar Oct 18 '22 12:10 modmuss50