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

  • Author

It crashed for me. GitHub: https://github.com/SpaceboyRoss01/MSGundamMod.

 

@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Post event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		ResourceLocation texture = new ResourceLocation(ms.getBaseResourceLocation()+".png");
		event.getRenderer().bindTexture(texture);
		GL11.glScalef(msmob.scale,msmob.scale,msmob.scale);
	}
}

 

Edited by Spaceboy Ross

The official YouTuber Spaceboy Ross

17 minutes ago, Spaceboy Ross said:

It crashed for me. GitHub: https://github.com/SpaceboyRoss01/MSGundamMod.

 


@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Post event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		ResourceLocation texture = new ResourceLocation(ms.getBaseResourceLocation()+".png");
		event.getRenderer().bindTexture(texture);
		GL11.glScalef(msmob.scale,msmob.scale,msmob.scale);
	}
}

 

Something is null on this line.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

6 minutes ago, Spaceboy Ross said:

Ok, it's no longer null but the player is still the same size and still has the same skin. How do I render the new skin and entity size?

You have to use the Pre event render it yourself and then cancel the actual rendering from happening.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

6 minutes ago, Spaceboy Ross said:

Ok, got the scaling to work but I cannot get the custom skin to work.

*doesn't see code* Cool

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Pre event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png"));
		GL11.glScalef(msmob.scale,msmob.scale,msmob.scale);
		event.setCanceled(true);
	}
}

 

The official YouTuber Spaceboy Ross

15 minutes ago, Spaceboy Ross said:

@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Pre event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png"));
		GL11.glScalef(msmob.scale,msmob.scale,msmob.scale);
		event.setCanceled(true);
	}
}

 

You did one of the three things I said.

 

31 minutes ago, Animefan8888 said:

You have to use the Pre event render it yourself and then cancel the actual rendering from happening.

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

It's still not working.

@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Pre event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		GL11.glScalef(msmob.scale,msmob.scale,msmob.scale);
		event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png"));
		event.getRenderer().doRender((AbstractClientPlayer)player,event.getX(),event.getY(),event.getZ(),player.cameraYaw,event.getPartialRenderTick());
		event.setCanceled(true);
	}
}

 

The official YouTuber Spaceboy Ross

A fix to what?

What's broken?

 

You haven't given us any information about how to diagnose what's wrong. All you've said is "doctor, it hurts."

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

The game freezes when my code runs.

@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Pre event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		GL11.glScalef(msmob.scale,msmob.scale,msmob.scale);
		event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png"));
		event.getRenderer().doRender((AbstractClientPlayer)player,event.getX(),event.getY(),event.getZ(),player.cameraYaw,event.getPartialRenderTick());
		event.setCanceled(true);
	}
}

 

The official YouTuber Spaceboy Ross

5 minutes ago, Spaceboy Ross said:

The game freezes when my code runs.

You're causing an infinite loop of code by calling event.getRenderer().doRender.

Edited by Animefan8888
Typo

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Just now, Spaceboy Ross said:

Well, how do I actually render the player?

 

2 hours ago, Animefan8888 said:

You have to use the Pre event render it yourself and then cancel the actual rendering from happening.

Write the code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

1 minute ago, Spaceboy Ross said:

What does rendering it mean? I've canceled the game from rendering the player. 

You want to change the texture for the player and edit the scale. Ok. Editing the scale is easy enough as you already found out. But you cant bind the texture you want because it is bound in the vanilla code you dont have access to. So you have to cancel the vanilla rendering which you have done and then render the player yourself with your own code, using your texture.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

From what I can see and understand, you are trying to use the default Minecraft player model  as your base model, but you are using the default renderer to do it. You can use the MC player model, but you would need to copy it and change the relevant parts, such as what texture is bound to the gl, scale etc.  And then render that instead. The renderer is connected to the default mc model which also hard codes it's texture.

 

That's the easy way, or you can just code the model in yourself.

Edited by ZDoctor
Added

  • Author

It doesn't render correctly and it renders upsidedown. GitHub: https://github.com/SpaceboyRoss01/MSGundamMod

To recreate the bug, right click on an entity called RX-78-2 Gundam.

@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Pre event) {
	EntityPlayer player = event.getEntityPlayer();
	IHumanCapability nt = Human.getHuman(player);
	MobileSuit.MSMob msmob = nt.getMS();
	if(msmob != null) {
		MobileSuit ms = msmob.getMSRegistryEntry();
		event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png"));
		event.setCanceled(true);
		GlStateManager.pushMatrix();
		event.getRenderer().getMainModel().bipedHead.render(0.0625F*msmob.scale);
		event.getRenderer().getMainModel().bipedBody.render(0.0625F*msmob.scale);
		event.getRenderer().getMainModel().bipedLeftLeg.render(0.0625F*msmob.scale);
		event.getRenderer().getMainModel().bipedRightLeg.render(0.0625F*msmob.scale);
		event.getRenderer().getMainModel().bipedLeftArm.render(0.0625F*msmob.scale);
		event.getRenderer().getMainModel().bipedRightArm.render(0.0625F*msmob.scale);
		GlStateManager.popMatrix();
	}
}

 

The official YouTuber Spaceboy Ross

That's something I never understood as to why (but never bothered to look into it too hard) it happens, but what I do is just Rotate the gl 180 and that should fix it. I assume somewhere in the vanilla code something does that, but I haven't found it.

Edited by ZDoctor

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.