Posted August 22, 201312 yr so, i am trying to update my dagger, the entity and the item class are all fine and work, there are no errors in those or the render dagger class, however no matter what i do i cannot seem to make the dagger entity render properly. I think the problem is from the this.loadtexture is the old way to bind the texture to the entity and the new method is a bit convoluted and just new ok so the path to the texture i am trying to use it "/Minecraft/src/assets/ashtonsmod/textures/gui/dagger.png" i have copied the arrow class just to try and get it to work, so yeah here is the class. package ashtonsmod.common; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderDagger extends Render { private static final ResourceLocation myresourcelocation = new ResourceLocation("ashtonsmod", "textures/gui/dagger.png"); public void renderDagger(EntityDagger par1EntityDagger, double par2, double par4, double par6, float par8, float par9) { this.func_110777_b(par1EntityDagger); GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glRotatef(par1EntityDagger.prevRotationYaw + (par1EntityDagger.rotationYaw - par1EntityDagger.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(par1EntityDagger.prevRotationPitch + (par1EntityDagger.rotationPitch - par1EntityDagger.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float)(0 + b0 * 10) / 32.0F; float f5 = (float)(5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float)(5 + b0 * 10) / 32.0F; float f9 = (float)(10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = (float)par1EntityDagger.arrowShake - par9; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); Minecraft.getMinecraft().renderEngine.func_110577_a(myresourcelocation); } protected ResourceLocation func_110779_a(EntityDagger par1EntityDagger) { return myresourcelocation; } protected ResourceLocation func_110775_a(Entity par1Entity) { return this.func_110779_a((EntityDagger)par1Entity); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.renderDagger((EntityDagger)par1Entity, par2, par4, par6, par8, par9); } } Thanks for your help in advance, i have been trying to solve this for a while and it is my last problem with my mod and i know some of you have seen this before in my last updating post. Use examples, i have aspergers. Examples make sense to me.
August 22, 201312 yr Did you register your renderer on client side ? Remove all this Minecraft.getMinecraft().renderEngine.func_110577_a(myresourcelocation); protected ResourceLocation func_110779_a(EntityDagger par1EntityDagger) { return myresourcelocation; } Change with this protected ResourceLocation func_110775_a(Entity par1Entity) { return myresourcelocation; }
August 22, 201312 yr Author where are the vanilla entities registered? the snowball entity in particular; or RenderingRegistry.registerEntityRenderingHandler(EntityRockSnowball.class, new RenderRockSnowball(X)); what goes in the brackets instead of the X i know this is simple but i am tired Use examples, i have aspergers. Examples make sense to me.
August 22, 201312 yr Author ok so the 3 tuts i have read say it should reference the item class but when i do this is says cannot be resolved to type, and would you like to create the class so i guess i'm referencing it wrong. RenderingRegistry.registerEntityRenderingHandler(EntityRockSnowball.class, new RenderRockSnowball(ashtonsmod.RockSnowball)); Use examples, i have aspergers. Examples make sense to me.
August 23, 201312 yr i dont think your renderer needs to know about which item it renders, it pretty much just needs to know how to render wtv you're asking it to do new RenderRockSnowball(ashtonsmod.RockSnowball)//bold probably not required or adding giving any information to the renderer how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
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.