someonewithpc Posted May 29, 2014 Posted May 29, 2014 So as the title says, it doesn't render... I'm calling it from a RenderTickEvent handler to render a custom armor. The "render" class: package com.echo.darksouls.render; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; import org.lwjgl.opengl.GL11; public class WuellrovKnightArnorRender{ public static IModelCustom helmet; /*public WuellrovKnightArnorRender(){ helmet = AdvancedModelLoader.loadModel(new ResourceLocation("darksouls", "model/WuellrovKnightHelmet.obj")); }*/ public static void render(EntityPlayer player, int type){ initValues(); GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslated(player.posX, player.posY, player.posZ); switch(type){ case 0: Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("darksouls", "model/WuellrovKnightHelmet.png")); helmet.renderAll(); //System.out.println("WuellrovKnightArmorRender's render method is called."); break; } GL11.glPopMatrix(); } private static void initValues(){ if(helmet == null) helmet = AdvancedModelLoader.loadModel(new ResourceLocation("darksouls", "model/WuellrovKnightHelmet.obj")); } } The editor is behaving wierdly... Quote
jabelar Posted May 29, 2014 Posted May 29, 2014 I know you're working with an obj file, and it isn't an entity, as my experience is with Java models for entities, but for those the rendering starts with the RenderLiving class which associates the model with the textures. So I usually make a custom class that extends RenderLiving and registers the custom model into that. Not sure if that applies to your case at all, but maybe it will give a clue. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
someonewithpc Posted May 30, 2014 Author Posted May 30, 2014 I think the problem would be that, somehow, I have to associate the actual screen, before rendering. Quote
someonewithpc Posted June 1, 2014 Author Posted June 1, 2014 As I still don't understand why this doesn't work, I have tried using a entity for the armor, however, I have the same problem, the model doesn't render. Quote
jabelar Posted June 2, 2014 Posted June 2, 2014 Does your custom model extend ModelBase? If you look at the ModelTechne class, it both extends ModelBase and implements IModelCustom interface. I'm thinking that maybe if you extend ModelBase and furthermore register your custom Model with a custom Renderer it should probably just work. I don't think you should have to do any tick handling, but I'm not totally sure. Can you post your code for your custom model class, you renderer class, and the code (probably from your client proxy) where you register the model and renderer? Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
someonewithpc Posted June 5, 2014 Author Posted June 5, 2014 Thank you for the tip Got help from a friend and he pointed that out as well. I was overcomplicating things, inside the class that extends ItemArmor you @Override getArmorModel, and just return a class that extends ModelBase, inside which you render the model. You @Override getArmorTexture to give it it's texture. Like so: public class ModelTest extends ModelBiped { ModelRenderer head; ModelRenderer body; ModelRenderer rightarm; ModelRenderer leftarm; ModelRenderer rightleg; ModelRenderer leftleg; ModelRenderer head2; public ModelTest() { textureWidth = 64; textureHeight = 32; head = new ModelRenderer(this, 0, 0); head.addBox(-4F, -8F, -4F, 8, 8, ; head.setRotationPoint(0F, 0F, 0F); head.setTextureSize(64, 32); head.mirror = true; setRotation(head, 0F, 0F, 0F); body = new ModelRenderer(this, 16, 16); body.addBox(-4F, 0F, -2F, 8, 12, 4); body.setRotationPoint(0F, 0F, 0F); body.setTextureSize(64, 32); body.mirror = true; setRotation(body, 0F, 0F, 0F); rightarm = new ModelRenderer(this, 40, 16); rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); rightarm.setRotationPoint(-5F, 2F, 0F); rightarm.setTextureSize(64, 32); rightarm.mirror = true; setRotation(rightarm, 0F, 0F, 0F); leftarm = new ModelRenderer(this, 40, 16); leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); leftarm.setRotationPoint(5F, 2F, 0F); leftarm.setTextureSize(64, 32); leftarm.mirror = true; setRotation(leftarm, 0F, 0F, 0F); rightleg = new ModelRenderer(this, 0, 16); rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); rightleg.setRotationPoint(-2F, 12F, 0F); rightleg.setTextureSize(64, 32); rightleg.mirror = true; setRotation(rightleg, 0F, 0F, 0F); leftleg = new ModelRenderer(this, 0, 16); leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); leftleg.setRotationPoint(2F, 12F, 0F); leftleg.setTextureSize(64, 32); leftleg.mirror = true; setRotation(leftleg, 0F, 0F, 0F); head2 = new ModelRenderer(this, 0, 0); head2.addBox(-0.5F, -11F, -3F, 1, 10, 10); head2.setRotationPoint(0F, 0F, 0F); head2.setTextureSize(64, 32); head2.mirror = true; setRotation(head2, 0F, 0F, 0F); } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); head.render(f5); body.render(f5); rightarm.render(f5); leftarm.render(f5); rightleg.render(f5); leftleg.render(f5); head2.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } With the necessary package declaration and proper imports, this should render the "armor", in this case it's a copy of model biped. In this case it will render it 3 times, one for the vanilla code, that renders the player itself, and for the super call in the render method, and again for what's inside the render method. Of course, it's possible for you to replace what's inside there. Quote
Recommended Posts
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.