-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Missing API for accessing targets of mobs using new AI brain system #6862
Comments
I’m not 100%, but I think this is works as intended. The axolotl, and all the newer entities do not use the same AI system as older mobs. They have a memory/brain system. There are methods to get and set memories on entities, and I think there is one for target entity. |
There sadly is not, the |
Ok, well there’s an open PR that adds them then. |
The PR has been rebased now, and I don't think those methods should be re-implemented. They aren't the same thing, and the inhertiance would be wrong. LivingEntities can have memories, but only Mobs have that target field. So if you moved the get/setTarget methods to LivingEntity, you'd be adding that to some entities for which it has 0 meaning. Some documentation clarification should be somewhere, maybe a whole big paragraph explaining that some entities use a totally different AI system. |
Oh sorry if I wasn't clear enough. I was merely suggesting implementing the Basically as plain as (don't flame me if this isn't actually valid code): public class CraftAxolotl {
....
public LivingEntity getTarget() {
return this.getMemoryKey(ATTACK_TARGET);
}
....
} or maybe in some form of |
That might be fine for the getTarget method, but I don't think it would for setTarget. simply setting the memory for |
Makes sense 👍 So I guess we can close this as working as intended ? |
Well, I guess since there isn't an actual way to do it (pending that PR), it can stay open and be closed by that maybe |
Expected behavior
That getTarget() returns the entity the axolotl is currently targeting, and that setTarget(null) clears targeting.
Observed/Actual behavior
getTarget() returns null, even when the axolotl is attacking another entity. Setting the target to null also does nothing.
Steps/models to reproduce
Reproduced this using the following code:
The output will be the "Target is null" message each time, and the axolotl continues attacking.
Plugin and Datapack List
Plugins (1): TestPlugin
There are 2 data packs enabled: [vanilla (built-in)], [file/bukkit (world)]
There are no more data packs available
Paper version
This server is running Paper version git-Paper-359 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: bc43f40)
You are running the latest version
Other
No response
The text was updated successfully, but these errors were encountered: