Jump to content

Recommended Posts

Posted

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

  Quote

You sir are a god damn hero.

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.