Jump to content

Recommended Posts

Posted

Hello everyone,

 

I've been trying to render a weapon with a custom mob that I created, but I can't seem to figure out what bit of code I need to put in the render***.java.  I want to render just a stone sword in the right hand of the mob.  Here is the render***.java class:

 

 

  Reveal hidden contents

 

 

If you need anything else to help me, then let me know.  Any help is appreciated.

 

Greenman

Posted

I have no idea, but the solution offered may end up helping me with a tile entity that needs to do something similar.

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.

Posted
  On 6/16/2013 at 7:40 PM, Greenman284 said:

Does nobody else have this problem other than me and Draco?

 

Admittedly I want to render a sword on a TileEntity...

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.

Posted
  On 6/16/2013 at 8:40 PM, ObsequiousNewt said:

It's a matter of special rendering code in either case. You'll need to play around with glScale() and glRotate() and glTranslate() until you find values that fit.

 

My question is:

What is it that I am rendering?  I don't want to go into techne and try and figure out how to build the boxes so that it looks like a sword.

 

Which means there's got to be some kind of model for items around somewhere already.

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.

Posted
  On 6/16/2013 at 9:42 PM, Draco18s said:

  Quote

It's a matter of special rendering code in either case. You'll need to play around with glScale() and glRotate() and glTranslate() until you find values that fit.

 

My question is:

What is it that I am rendering?  I don't want to go into techne and try and figure out how to build the boxes so that it looks like a sword.

 

Which means there's got to be some kind of model for items around somewhere already.

 

You render items with ItemRenderer.renderItemIn2D

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted
  On 6/16/2013 at 10:12 PM, SanAndreasP said:
You render items with ItemRenderer.renderItemIn2D

 

Ah ha!  Sweet, thanks.

Hadn't delved into the code that vanilla has to render items yet other than "hey, didn't I dup a mob that could do it?" and looking at that mob's render code (with no luck).

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.

Posted
  On 6/16/2013 at 11:06 PM, Draco18s said:

  Quote
You render items with ItemRenderer.renderItemIn2D

 

Ah ha!  Sweet, thanks.

Hadn't delved into the code that vanilla has to render items yet other than "hey, didn't I dup a mob that could do it?" and looking at that mob's render code (with no luck).

 

Well, I had to use this for a custom item renderer with glowing parts of textures (if you wanna see what I mean:

)

There's also some code in the RenderBiped or RenderLiving (can't remember which one) which deals with holding items by entities.

If you want to do it easy on your Entity, I suggest you override the getHeldItem method in your entity class and return an ItemStack, containing the item which should be held.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted
  On 6/16/2013 at 11:26 PM, SanAndreasP said:
Well, I had to use this for a custom item renderer with glowing parts of textures (if you wanna see what I mean:
)

 

Neat!

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.

Posted
  On 6/16/2013 at 11:26 PM, SanAndreasP said:

  Quote

  Quote
You render items with ItemRenderer.renderItemIn2D

 

Ah ha!  Sweet, thanks.

Hadn't delved into the code that vanilla has to render items yet other than "hey, didn't I dup a mob that could do it?" and looking at that mob's render code (with no luck).

 

Well, I had to use this for a custom item renderer with glowing parts of textures (if you wanna see what I mean:

)

There's also some code in the RenderBiped or RenderLiving (can't remember which one) which deals with holding items by entities.

If you want to do it easy on your Entity, I suggest you override the getHeldItem method in your entity class and return an ItemStack, containing the item which should be held.

 

Is this what you mean about overriding the geHeldItem?

 

 

  Reveal hidden contents

 

Posted
  On 6/17/2013 at 12:43 AM, Greenman284 said:

  Quote

  Quote

  Quote
You render items with ItemRenderer.renderItemIn2D

 

Ah ha!  Sweet, thanks.

Hadn't delved into the code that vanilla has to render items yet other than "hey, didn't I dup a mob that could do it?" and looking at that mob's render code (with no luck).

 

Well, I had to use this for a custom item renderer with glowing parts of textures (if you wanna see what I mean:

)

There's also some code in the RenderBiped or RenderLiving (can't remember which one) which deals with holding items by entities.

If you want to do it easy on your Entity, I suggest you override the getHeldItem method in your entity class and return an ItemStack, containing the item which should be held.

 

Is this what you mean about overriding the geHeldItem?

 

 

  Reveal hidden contents

 

 

no... It's a method. Its return value is an ItemStack, so you have to return an ItemStack, containing the item which should be held...

	@Override
public ItemStack getHeldItem() {
	return new ItemStack(ItemInstance);
}

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted
  On 6/16/2013 at 10:12 PM, SanAndreasP said:
You render items with ItemRenderer.renderItemIn2D

no... It's a method. Its return value is an ItemStack, so you have to return an ItemStack, containing the item which should be held...

	@Override
public ItemStack getHeldItem() {
	return new ItemStack(ItemInstance);
}

 

Hmm, I did that, but I had no change in-game.  I also looked at the renderbiped.java and this is the only thing I could find that would be helpful in the render***.java

 

 

  Reveal hidden contents

 

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.