Jump to content

[1.7.10]Flipping an entity with RenderLivingEvent


Asweez

Recommended Posts

How do I flip an entity upside down through RenderLivingEvent? Right now it doesn't do anything when the entities have my potion effect.

 

Here is my code :

@SubscribeEvent
public void renderLiving(RenderLivingEvent.Post event){
	if(event.entity.getActivePotionEffect(MagiCraft.flipped) != null){
		GL11.glPushMatrix();
		GL11.glRotated(180, 0, 0, 1);
		GL11.glPopMatrix();
	}
}

 

Yes I have registered it and it is getting called.

 

Thanks!

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

Before it renders:

push the state, change the state

After it renders:

restore the state

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Do I use both the RenderLivingEvent.Pre and Post events?

 

Uh, let me check.

 

Before it renders:

push the state, change the state

After it renders:

restore the state

 

Pretty sure that "Before" and "After" are two different phases.

 

But you know what, do it in only one and see how that works out for you.  Oh wait, you did.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ok I did that, however the only entity that renders while my potion effect is active is the player. Any of the other entities are not affected. I checked with LivingUpdateEvent that the potion effect was registering, and LivingUpdate said that they had my potion effect active. For some reason it just isn't registering on the client. How do I fix this?

 

Code:

@SubscribeEvent
public void renderLiving(RenderLivingEvent.Pre event){
	if(event.entity.getActivePotionEffect(MagiCraft.flipped) != null){
		GL11.glPushMatrix();
		GL11.glRotatef(180.0f, 0, 0, 1.0f);
		GL11.glTranslated(0, event.entity.height/2 + 0.1f, 0);
	}
}

@SubscribeEvent
public void renderLiving(RenderLivingEvent.Post event){
	if(event.entity.getActivePotionEffect(MagiCraft.flipped) != null){
		GL11.glPopMatrix();
	}
}

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

Could I just have an

isFlipped

property in the IExtendedEntityProperties that is set to true when the entity has the potion and false when is doesn't? Then the client would get the

isFlipped

property and determine whether or not to flip it.

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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