Jump to content

Custom player rendering


Spaceboy Ross

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

1 hour ago, Spaceboy Ross said:

It's ๏ปฟ๏ปฟstill๏ปฟ not working.๏ปฟ

Define not working.ย 

  • Confused 1

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.

Link to comment
Share on other sites

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

  • Sad 1

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

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • BALON168๐ŸŽˆ: Situs Slot Gacor Terbaik, Termewah, dan Tergacor 2024 dengan RTP 99,99% Mudah Maxwin Jika Anda pencinta judi online, mencari situs yang dapat diandalkan dan memberikan pengalaman bermain yang memuaskan tentu menjadi prioritas. Salah satu opsi terbaik yang patut dipertimbangkan adalah BALON168๐ŸŽˆ. Situs ini tidak hanya menawarkan berbagai permainan slot yang menarik, tetapi juga mempersembahkan keunggulan dan kenyamanan bagi para pemainnya. Keunggulan BALON168๐ŸŽˆ BALON168๐ŸŽˆ tidak hanya sekadar situs slot online biasa. Dengan reputasi yang solid dan terpercaya, BALON168๐ŸŽˆ telah menjadi destinasi favorit bagi para penggemar judi online di tahun 2024. Keunggulan yang ditawarkan mencakup: 1. RTP Tinggi 99,99% Salah satu hal yang membuat BALON168๐ŸŽˆ menonjol adalah tingkat pengembalian (RTP) yang luar biasa tinggi, mencapai 99,99%. Ini berarti pemain memiliki peluang besar untuk memenangkan hadiah besar setiap kali mereka memutar gulungan di slot BALON168๐ŸŽˆ. 2. Permainan Slot Gacor BALON168๐ŸŽˆ dikenal sebagai situs slot gacor terbaik di tahun 2024. "Gacor" adalah istilah yang digunakan untuk mesin slot yang sering memberikan kemenangan kepada pemainnya. Dengan koleksi permainan slot yang beragam dan sering memberikan jackpot besar, BALON168๐ŸŽˆ memastikan pengalaman bermain yang memuaskan bagi para pengunjungnya. 3. Maxwin yang Mudah Di BALON168๐ŸŽˆ, peluang maxwin tidak hanya menjadi impian belaka. Dengan fitur yang mudah dimengerti dan diakses, pemain memiliki kesempatan yang besar untuk meraih kemenangan maksimum dalam setiap permainan yang mereka mainkan. Keamanan dan Kepuasan Pemain BALON168๐ŸŽˆ mengutamakan keamanan dan kepuasan para pemainnya. Dengan sistem keamanan terkini dan perlindungan data yang canggih, para pemain dapat bermain dengan tenang tanpa khawatir tentang privasi dan keamanan mereka. Layanan pelanggan yang responsif dan ramah juga selalu siap membantu para pemain dalam setiap masalah atau pertanyaan yang mereka miliki. ย  ย  ย  โฑโฑโฑโฑโฑ DAFTAR DI SINI โฐโฐโฐโฐโฐ โฑโฑโฑโฑโฑ DAFTAR AKUN PRO โฐโฐโฐโฐโฐ โฑโฑโฑโฑโฑ DAFTAR AKUN VIPI โฐโฐโฐโฐโฐ ย  ย  ย  ย  ย  ย 
    • LadangToto2 adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Mestika. Berikut adalah beberapa alasan mengapa Anda harus memilih LadangToto2: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Mestika Kami menyediakan layanan transaksi mudah melalui Bank Mestika untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Hadiah Hingga 100 Juta LadangToto2 memberikan kesempatan untuk meraih hadiah hingga 100 juta dalam kemenangan. Dengan jackpot dan hadiah-hadiah besar yang ditawarkan, setiap putaran permainan bisa menjadi peluang untuk meraih keberuntungan besar. ย 
    • Mengapa Memilih LadangToto? LadangToto adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor WD Maxwin dengan transaksi mudah menggunakan Bank BNI. Berikut adalah beberapa alasan mengapa Anda harus memilih LadangToto: Slot Gacor WD Maxwin Terbaik Kami menyajikan koleksi slot gacor WD Maxwin terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank BNI Kami menyediakan layanan transaksi mudah melalui Bank BNI untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. ย 
    • Akun Pro Kamboja adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot Maxwin dengan transaksi mudah menggunakan Bank Lampung. Berikut adalah beberapa alasan mengapa Anda harus memilih Akun Pro Kamboja: Slot Maxwin Terbaik Kami menyajikan koleksi slot Maxwin terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Lampung Kami menyediakan layanan transaksi mudah melalui Bank Lampung untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Anti Rungkat Akun Pro Kamboja memberikan jaminan "anti rungkat" kepada para pemainnya. Dengan fitur ini, Anda dapat merasakan sensasi bermain dengan percaya diri, karena kami memastikan pengalaman bermain yang adil dan menyenangkan bagi semua pemain. ย 
    • BINGO188: Destinasi Terbaik untuk Pengalaman Slot yang Terjamin Selamat datang di BINGO188, tempat terbaik bagi para pecinta slot yang mencari pengalaman bermain yang terjamin dan penuh kemenangan. Di sini, kami menawarkan fitur unggulan yang dirancang untuk memastikan kepuasan dan keamanan Anda. Situs Slot Garansi Kekalahan 100 Kami memahami bahwa kadang-kadang kekalahan adalah bagian dari permainan. Namun, di BINGO188, kami memberikan jaminan keamanan dengan fitur garansi kekalahan 100. Jika Anda mengalami kekalahan, kami akan mengembalikan saldo Anda secara penuh. Kemenangan atau uang kembali, kami memastikan Anda tetap merasa aman dan nyaman. Bebas IP Tanpa TO Nikmati kebebasan bermain tanpa batasan IP dan tanpa harus khawatir tentang TO (Turn Over) di BINGO188. Fokuslah pada permainan Anda dan rasakan sensasi kemenangan tanpa hambatan. Server Thailand Paling Gacor Hari Ini Bergabunglah dengan server terbaik di Thailand hanya di BINGO188! Dengan tingkat kemenangan yang tinggi dan pengalaman bermain yang lancar, server kami dijamin akan memberikan Anda pengalaman slot yang tak tertandingi. Kesimpulan BINGO188 adalah pilihan terbaik bagi Anda yang menginginkan pengalaman bermain slot yang terjamin dan penuh kemenangan. Dengan fitur situs slot garansi kekalahan 100, bebas IP tanpa TO, dan server Thailand paling gacor hari ini, kami siap memberikan Anda pengalaman bermain yang aman, nyaman, dan menguntungkan. Bergabunglah sekarang dan mulailah petualangan slot Anda di BINGO188!
  • Topics

×
×
  • Create New...

Important Information

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