Posted June 13, 201312 yr 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: package timescape.render; import java.awt.geom.Arc2D.Float; import org.lwjgl.opengl.GL11; import timescape.ModelNutcracker; import timescape.entity.EntityNutcracker; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelEnderman; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @SideOnly(Side.CLIENT) public class RenderNutcracker extends RenderLiving { public RenderNutcracker(ModelNutcracker ModelNutcracker_Test, float f) { super(new ModelNutcracker(), 0.5F); } public RenderNutcracker(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } public void RenderNutcracker(EntityNutcracker par1EntityNutcracker, double par2, double par4, double par6, float par8, float par9) { super.doRenderLiving(par1EntityNutcracker, par2, par4, par6, par8, par9); } public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { this.RenderNutcracker((EntityNutcracker)par1EntityLiving, par2, par4, par6, par8, par9); } public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.RenderNutcracker((EntityNutcracker)par1Entity, par2, par4, par6, par8, par9); } } If you need anything else to help me, then let me know. Any help is appreciated. Greenman
June 13, 201312 yr 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.
June 16, 201312 yr 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.
June 16, 201312 yr 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. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 16, 201312 yr 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.
June 16, 201312 yr 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 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.
June 16, 201312 yr Alternatively, if it's just swords, you might want to build a seperate model and switch textures. That might be easier. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 16, 201312 yr 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.
June 16, 201312 yr 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 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.
June 16, 201312 yr 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.
June 17, 201312 yr Author 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? public int getHeldItem; { ItemStack itemstack = this.getHeldItem(Item.swordStone); }
June 17, 201312 yr 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? public int getHeldItem; { ItemStack itemstack = this.getHeldItem(Item.swordStone); } 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 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.
June 17, 201312 yr Author 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 protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2) { float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); super.renderEquippedItems(par1EntityLiving, par2); ItemStack itemstack = par1EntityLiving.getHeldItem(); ItemStack itemstack1 = par1EntityLiving.getCurrentArmor(3); float f2; }
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.