New Entity AI via Plugin

Discussion in 'Bukkit Discussion' started by SchmidtMathias, Jul 10, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    SchmidtMathias

    Hi everyone,

    I'm working on a plugin to provide a new kind of AI to all kind of EntityAnimal's and EntityMonster's. Right now there is a way to get the Vanilla Monster Entity and use al().a() to get it walking to a certain position but EntityAnimal's don't have this function.

    So I started to create my own Pathfinder and just implemented the common A*-Algorithm in Minecraft and it works great. Then I tried to just use setVelocity() in a synchronous task that keeps pushing the Entity along the Path. And also that works pretty good but there is one problem I cannot solve: The Entity keeps trying to walk along it's own AI Orders witch doesn't interrupt my plugin or messing it up but it's completely impossible to turn the entity in the direction my plugin want's it to walk. So it is walking in the right direction, but I cannot control if it is walking backwards or side wards and this is quite ugly. If I try to set the Yaw-Value of the Vanilla Entity it is not reacting. I guess it is getting overwritten by the AI.

    So, what I need now, is a way to stop the Entity's AI. So that I can just set it's Yaw and Velocity without a outer force that distracts my orders.

    Any way to do so?

    Thanks for any kind of help.
     
  2. Offline

    md_5

    Its pretty difficult and requires usage of CraftBukkit, but basically:
    Make your plugin startup pre world load.
    Replace the EntityType NMS mappings via reflection.
    Add an event listener for CreatureSpawn. Use this to replace any other creatures that are spawned via command in a plugin.
     
Thread Status:
Not open for further replies.

Share This Page