Jump to content

Recommended Posts

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.

Posted

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.

Posted

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.

Posted

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

 

 

Posted

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

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