Koward Posted August 6, 2016 Posted August 6, 2016 Hello. I'd like to change the motionX, Y, Z of an Entity (NOT a LivingEntity) to 0 (or whatever value) when it's in Water. There's no simple "EntityUpdate" event so I wondered what was the best way to do it. Quote
Ernio Posted August 6, 2016 Posted August 6, 2016 Hook into WorldTickEvent (pick one phase) and change stuff with World#entityList (name varies, I don't remember). This way you can "almost" replicate LivingUpdateEvent - difference is you can't cancel it and is happens in slightly different time frame (which might make it "different" when changing stuff such as entity's motions). For more look where said event is called from. (you will probabyl want to use START phase). Quote 1.7.10 is no longer supported by forge, you are on your own.
Koward Posted August 6, 2016 Author Posted August 6, 2016 Unfortunately it just mess up the block movement every tick, it's not the effect I'm looking for at all. I would basically like items to stay, in water, at the height I throw them. Avoid them to sink. Here the standard behavior happens between each triggering of the event so it sinks a bit, then goes back up a bit, etc and in the end the sinking wins. Quote
Ernio Posted August 6, 2016 Posted August 6, 2016 All items or just yours? You can return custom EntityItem from Item class. Something like #getEntityItem and #hasCustomEntityItem (again - I don't remember naming). Edit: For all others you can do the same with EntityJoinWorldEvent detect and spawn your own custom EntityItem. P.S: In future - start with what you said in last post, just state your end goal. Quote 1.7.10 is no longer supported by forge, you are on your own.
Koward Posted August 6, 2016 Author Posted August 6, 2016 I needed this for all items.. *Sigh* I guess it seems I'll have to customize every single Item in Minecraft if I ever want to do that. P.S: In future - start with what you said in last post, just state your end goal. I often like to do generic things that can have lots of uses, but you're right I should have added a clear example. Quote
Recommended Posts
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.