I want to edit snowgolems to change their behaviour. So I have: Code: public class Frosty extends EntitySnowman{ public Frosty(World world) { super(world); } How would I make it stare at zombies instead of Humans in this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); So im just modifying it's properties. What do I have to do? Does it involve changing all the this.blablabla A short example code will help alot. This can all probably be done with Bukkit API but I just want to get familiar with NMS . Thanks!
Block34 Yes, it would involve creating a new snowman, possibly not extending EntitySnowman but the superclass
fireblast709 so how would i extend the superclass. Developerjohn Yes sort of. Just make it stare at a zombie(minecraft staring contest lol). and make it attack passive mobs also
Block34 hmm I would have to say I'm not sure. I know the citizens plugin uses it though. Lemme check Block34 I'm guessing it's the rotation so when an entity enters (lets say a 5 block radius) area. That entity will rotate in the direction it's in. Hmmm, XD I think it's right somehow. Anyone has my permission to correct me. After all, I'm just starting to learn. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Ok so do i just take out this line and replace with: this.goalSelector.a(3,newPathfinderGoalLookAtPlayer(this,EntityZombie.class,6.0F));
That would make them stare at zombies instead of players, yes. If you are ok with letting them stare to both players and zombies, then this can be done by reflection (basically calling that method again with EntityZombie.class as parameter). This could also provide attacking passive mobs possibly with the priority for aggressive. If you don't want it, then extending the class is needed, which means you copy over the snowman class, fix the errors you get, calling EntityTypes#a(Class class, String name, int id) with the custom class, a custom name and: in case you want to override the old snowmen, the typeid of the snowmen Otherwise Code: id += (Byte.MAX_VALUE+1)*2; Which will make sure the client knows it is a snowman (due to how the packets work) Just note that these snowman are not persistant, meaning when you stop and start the server, the normal snowmen are spawned (This might be solved by enabling the plugin before startup, I am not sure of that). Also, this method is based on some of my code in 1.6.4, no guarantees that it works for 1.7
fireblast709 Yes, I understand the concept behind how to do it. Can you show me an example code for making them stare at both player and zombies. I think I already know how to extend the snowman class but I just don't know how to modify it's properties. Thank you! I know if i just did: Code: public class Frosty extends EntitySnowman{ public Frosty(World world) { super(world); this.goalSelector.a(3,newPathfinderGoalLookAtPlayer(this,EntityZombie.class,6.0F)); } it wont work right? I just dont know how to actually edit it. I get the concept but i just dont know how to do it EDIT: Sry i had to edit it a few times because the text/code wasnt showing up correctly