Résolu Des renders, trop de renders …
-
Et revoila encore un problème …
Comme vous le voyez, le model apparait 3 fois. En 1er personne et au sol, le rendu ne buggue pas.
Voila la classe du render.package assets.ei.Weapons; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import assets.ei.Data.M_GunBase; public class W_TokarevRender implements IItemRenderer { protected M_GunBase model; protected M_GunBase modelFP; protected M_GunBase modelEN; protected static final ResourceLocation texture = new ResourceLocation("ei:textures/models/items/Tokarev.png"); public W_TokarevRender() { model = new M_GunBase(); modelFP = new M_GunBase(); modelEN = new M_GunBase(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: return true; case EQUIPPED_FIRST_PERSON: return true; case ENTITY: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(0.0F, 0.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.0F, -0.0F); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } case EQUIPPED_FIRST_PERSON: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(-90.0F, -90.0F, -180.0F, 0.0F); GL11.glTranslatef(0.5F, -0.5F, -1.0F); modelFP.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } case ENTITY: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(90.0F, 90.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.2F, -0.0F); modelEN.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } default: break; } } }
Merci d’avance de vos réponses.
-
Il faut juste lui dire de ne pas continuer dans le switch (autrement dit tu as oublié les break;)
case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef( 0.0F, 0.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.0F, -0.0F); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } case EQUIPPED_FIRST_PERSON: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef( -90.0F, -90.0F, -180.0F, 0.0F); GL11.glTranslatef(0.5F, -0.5F, -1.0F); modelFP.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } case ENTITY: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef( 90.0F, 90.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.2F, -0.0F); modelEN.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; }
-
Ha, merci.