Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, I've created a 'potion'entity which affects every entity with an instance of entityliving(base), which works fine, until EntityBodyHelper is getting called. EntityBodyHelper creates the random rotation jaw and pitch and is overriding my potions.

I want my entities to have a locked rotation jaw and pitch until the potion wears off (make the entity look at the thrower).

Currently I am using an exact copy of EntityLookHelper, but it takes entities with an instance of EntitylivingBase instead of EntityLiving (so I can affect EntityPlayer as well) and is not reliable of having AI enabled (it gets updated when the potion is active).

Does anyone maybe have a better solution?

 

All I can think of at the moment is to remove the affected entity's AI and add them back in when the potion is about the wear off, but that makes the entities 'freeze' if their walking is based on an ai task.

Well, this is more of a thought experiment than a coding solution, but I think you should make a new class like EntityLivingBase that is almost exactly the same but with the set jaw and pitch values, and then use that in your code.

Developer of the WIP Rubies mod.

  • Author

Well, this is more of a thought experiment than a coding solution, but I think you should make a new class like EntityLivingBase that is almost exactly the same but with the set jaw and pitch values, and then use that in your code.

 

No, this is not what I am trying to do, to address what I want to create is best shown in this video:

I want to affect all entities of EntityLiving(Base) to be looking at the thrower, in this video the entity is controlling the player's rotation jaw and pitch to be looking at the x,y,z and the eyeheight of this entity.

Hi

 

So I gather you want your potion to affect vanilla entities too?

 

You may be able to force the yaw and pitch in the RenderLivingEvent.Pre event.

 

Otherwise, your best bet is probably to use reflection to modify the EntityBodyHelper class, or alternatively use an AccessTransformer to transform EntityLiving.bodyHelper to be public, and when an Entity is created, overwrite its bodyHelperfield with your own MyEntityBodyHelper class extends EntityBodyHelper.

 

No guarantees it would work, but could be fun to try :)

 

-TGG

 

 

  • Author

Hi

 

So I gather you want your potion to affect vanilla entities too?

 

You may be able to force the yaw and pitch in the RenderLivingEvent.Pre event.

 

Otherwise, your best bet is probably to use reflection to modify the EntityBodyHelper class, or alternatively use an AccessTransformer to transform EntityLiving.bodyHelper to be public, and when an Entity is created, overwrite its bodyHelperfield with your own MyEntityBodyHelper class extends EntityBodyHelper.

 

No guarantees it would work, but could be fun to try :)

 

-TGG

Thanks for the input.

 

Actually I am not using a potion, it's an entity that acts like a potion. It mounts the entity in question and gives it certain effects, this way I can easily add models or custom lwjgl particles to the 'potion'entity (not a fan of the swirly particles currently present in potion effects).

I want it to affect every single living entity, modded or vanilla.

 

But my lookhelper is getting overridden every single time.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.