Posted September 11, 201312 yr Hello, I've got a problem. I'm trying to make a mod that can freeze entities. I tried it with an event handler and the LivingUpdateEvent and setting the entity position to the lastTick position. But that doesn't work. I can't even set the position of a entity, i tried it with the x,y,z vars and with setPosition() but no luck. I've also tried world.isRemote and false. ss7 You sir are a god damn hero.
September 11, 201312 yr you could just give the entity potion effect of move slow with power 10 the only problem is that its less effective against other players because they can still move slowly when they jump. Use examples, i have aspergers. Examples make sense to me.
September 11, 201312 yr I have not personally tried this, but it should be possible to track the position of where the entity was frozen, and then on world tick, force-set the entity back to that position (updating both posX and prevPosX, possibly even lastTickPosX as well). Try force-setting motionX,Y,Z as well to 0. (you can synch entity with position using a WeakHashMap with entity as key and the position as value -- use a weak map so as not to leak references) You need to track the freeze position yourself, trying to use the entities own position variables will not work very well because the AI/move methods will adjust those themselves every tick.
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.