Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.19.3] BlockState$getBlockPathType does not get pathfinding mob passed in #9283

Closed
TelepathicGrunt opened this issue Jan 2, 2023 · 5 comments
Labels
1.19 Bug This request reports or fixes a new or existing bug.

Comments

@TelepathicGrunt
Copy link
Contributor

TelepathicGrunt commented Jan 2, 2023

Forge adds IForgeBlockgetBlockPathType method to allow mods to have their block change their pathfinding type based on conditions when a mob attempts to pathfind through it. One extremely useful use case is a block that lets certain entities pathfind through but not others.
image

The issue is in the static WalkNodeEvaluator$getBlockPathTypeRaw method where Forge patched in the Forge method, null is passed in for the mob. Rendering the mob parameter completely useless.
image

To fix this will require a breaking change that could be potentially affects quite a number of mods calling getBlockPathTypeRaw. It is a tricky spot. But as of right now, there's no way for a mod to be able to block the pathfinding of certain mobs through their block and allow other mobs which seems to be one of the main points of this Forge method and probably should be restored before the Recommended Build is created. Or overload methods could be made instead and deprecate vanilla methods (suggested by someone)

@TelepathicGrunt TelepathicGrunt added the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Jan 2, 2023
@sciwhiz12 sciwhiz12 added Bug This request reports or fixes a new or existing bug. 1.19 labels Jan 3, 2023
@KaBob799
Copy link

Wasted a bit of dev time trying to use this feature only to realize it doesn't even work. Very frustrating. Maybe it could be fixed in 1.19.4?

@LexManos
Copy link
Member

So taking a look into this, just for the first two levels of calls it would require us making16 new methods that take in the mob. A lot of the pathfinding was moved to static helpers so we can't really get this information. As it sits, I think this hook has to die due to its complexity not being with the hook. Have you looked into other methods to accomplish what you want besides this low level BlockPathType?

@KaBob799
Copy link

Me using this method was just an attempt to bypass the lack of an API for adding custom block path types. I need all entities to understand whether or not my modded blocks are dangerous to them whenever they are pathing.

@LexManos
Copy link
Member

LexManos commented Mar 30, 2023

We can keep the custom path type hook, just kill off the mob parameter because it's not possible to propagate it down.
This would need to have more discussion from people showing their use cases and see what we can do about making a better/more functional hook.

@TelepathicGrunt
Copy link
Contributor Author

My use case was a curtain non-solid block that would prevent certain tagged mobs (not all) from walking or flying through it while allowing players and none-tagged mobs to pass through/pathfind through. Of course just blocking movement by EntityInside Block method, the mob will still try to pathfind through the block. So I was trying to find a way to make the walkNodeEvaluator not try to pathfind through my block if it is the specific tagged mob I don't want passing through. Like you said, the static stuff stopped me as well and the Forge hook wasn't working.

Though my main case was stopping bees and other flying insects which I am able to handle and got working. Blocking walk pathfinding would have be a nice thing to have if users tagged walking mobs to not pass through my block. But blocking off walking mobs is not a core feature of my block so if this hook cannot be fixed, that's ok. The walking mobs will just walk into the block and get stuck by pathfinding but can't pass through which isn't end of the world for me.

@autoforge autoforge bot removed the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.19 Bug This request reports or fixes a new or existing bug.
Projects
None yet
Development

No branches or pull requests

4 participants