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

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.

  • Author

Well when I remove that, all entities are flipped. What exactly does push/pop matrix do?

 

2) I changed it to Pre

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

  • Author

So how do I properly use them to do what I want?

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

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.

  • Author

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

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

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.

  • Author

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.

  • Author

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.

  • Author

Oh ok

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

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.