Posted February 1, 201510 yr Hi guys, this thing drives me nuts. I can have a watermob swim anywhere I want, but I can't figure out how to make it swims on place perfectly still (like there was no gravity). I tried almost everything but I am pretty sure one of you guys made it works. I tried calling a method of that type in updateAITasks. But the mobs always jump up and down. I just want it to stay still ... that simple. I am looking for a way to disable the gravity on it. if ((!aWaterMob.isDead) && (aWaterMob!=null)) { aWaterMob.motionY = 0.01F; }
February 1, 201510 yr Author Briefly I just want to know what is the motionY value formula I need to put something so the mob will not go up or down... Was not able to find the perfect value yet. aWaterMob.motionY = ?
February 2, 201510 yr I'd think that if you set motionY to 0 it wouldn't move up and down in the Y direction (not sure though), have you tested that?
February 2, 201510 yr You need to get the movement event(From forge) and then whenever the mob is moving, if it is on the y axis, cancel it.
February 3, 201510 yr the movement event(From forge). Umm...? http://images-cdn.9gag.com/photo/azbp0MB_460sa_v1.gif[/img] (Sorry this post didn't bring anything new). From what I remember (old times) - world has "gravity" that is pulling entity down. To hold entity in Y axis you could add vector = falling vector if entity is NOT on ground (onUpdate method). I was doing it so long ago that I don't think it will work now. 1.7.10 is no longer supported by forge, you are on your own.
February 3, 201510 yr As Ernio mentioned, just put 'this.motionY = 0.0F' in your mob's onUpdate method. If that doesn't work, try onLivingUpdate method. If neither work, try putting it before or after the call to super in either one. It depends, of course, on how your mob's swimming is handled, for example if it has custom AI, but it should work (I can vouch for hovering in the air, at least). http://i.imgur.com/NdrFdld.png[/img]
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.