Résolu Problème render teche
-
Bonjour j’ai encore un petit problème mais du coté render du modèle techne d’une arme en particulier le kokuto
Je remercie d’avance tous ce qui m’aideront.En gros le modèle est charge mais n’apparais pas ig ^^ ?
Quelqu’un pourrais m’épaulè ? -
Envoie tes codes.
-
Alors cette fois ci différent ^^ j’ai un peu mate mon code j’ai del tous refais certain point et maintenant ça crash au lancement
Voici mes classe:
Le modèle
package opu.common; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class kokuto extends ModelBase { //fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; ModelRenderer Shape4; ModelRenderer Shape5; ModelRenderer Shape6; ModelRenderer Shape7; ModelRenderer Shape8; public kokuto() { textureWidth = 256; textureHeight = 256; Shape1 = new ModelRenderer(this, 100, 100); Shape1.addBox(-3.5F, -30F, -0.5F, 7, 30, 1); Shape1.setRotationPoint(0F, 0F, 0F); Shape1.setTextureSize(256, 256); Shape1.mirror = true; setRotation(Shape1, 0F, -1.570796F, -0.8726646F); Shape2 = new ModelRenderer(this, 92, 92); Shape2.addBox(-7.5F, -0.5F, -0.5F, 15, 1, 1); Shape2.setRotationPoint(0F, 0F, 0F); Shape2.setTextureSize(256, 256); Shape2.mirror = true; setRotation(Shape2, 0F, -1.570796F, -0.8726646F); Shape3 = new ModelRenderer(this, 107, 78); Shape3.addBox(-0.5F, 0F, -0.5F, 1, 10, 1); Shape3.setRotationPoint(0F, 0F, 0F); Shape3.setTextureSize(256, 256); Shape3.mirror = true; setRotation(Shape3, 0F, -1.570796F, -0.8726646F); Shape4 = new ModelRenderer(this, 0, 0); Shape4.addBox(-0.5F, 0F, -0.5F, 1, 1, 1); Shape4.setRotationPoint(0F, -5.5F, 5F); Shape4.setTextureSize(256, 256); Shape4.mirror = true; setRotation(Shape4, 0F, -1.570796F, 3.054326F); Shape5 = new ModelRenderer(this, 0, 0); Shape5.addBox(-0.5F, 0F, -0.5F, 1, 1, 1); Shape5.setRotationPoint(0F, -5.5F, 4.8F); Shape5.setTextureSize(256, 256); Shape5.mirror = true; setRotation(Shape5, 0F, -1.570796F, -1.919862F); Shape6 = new ModelRenderer(this, 0, 0); Shape6.addBox(-0.5F, -1F, -0.5F, 1, 1, 1); Shape6.setRotationPoint(0F, 5.533333F, -5F); Shape6.setTextureSize(256, 256); Shape6.mirror = true; setRotation(Shape6, 0F, -1.570796F, 3.054326F); Shape7 = new ModelRenderer(this, 0, 0); Shape7.addBox(-0.5F, -1F, -0.5F, 1, 1, 1); Shape7.setRotationPoint(0F, 5.5F, -4.8F); Shape7.setTextureSize(256, 256); Shape7.mirror = true; setRotation(Shape7, 0F, -1.570796F, -1.919862F); Shape8 = new ModelRenderer(this, 100, 50); Shape8.addBox(-0.5F, -0.5F, -0.5F, 1, 1, 1); Shape8.setRotationPoint(0.06F, 6.4F, 7.6F); Shape8.setTextureSize(256, 256); Shape8.mirror = true; setRotation(Shape8, 0F, -1.570796F, 0F); } 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); Shape1.render(f5); Shape2.render(f5); Shape3.render(f5); Shape4.render(f5); Shape5.render(f5); Shape6.render(f5); Shape7.render(f5); Shape8.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); } }
Le render
package opu.common; 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; public class RenderItem implements IItemRenderer { private static boolean renderInFrame; protected kokuto model; protected static final ResourceLocation texture = new ResourceLocation("modopu:textures/items/kokuto.png"); public RenderItem() { model = new kokuto(); } @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(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(140F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, -0.8F); 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(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(140F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, -0.8F); model.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); if(RenderItem.renderInFrame) { GL11.glScalef(0.4F, 0.4F, 0.4F); GL11.glTranslatef(-0.9F, 0.5F, 0.0F); GL11.glRotatef(-26F, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(140F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, -0.8F); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } } }
Et le proxy
MinecraftForgeClient.registerItemRenderer(modopu.Sabre4.itemID, (IItemRenderer)new kokuto());
Et au cas ou le rapport d’erreur
2013-12-10 22:09:18 [Infos] [STDOUT] Description: Initializing game 2013-12-10 22:09:18 [Infos] [STDOUT] 2013-12-10 22:09:18 [Infos] [STDOUT] java.lang.ClassCastException: opu.common.kokuto cannot be cast to net.minecraftforge.client.IItemRenderer 2013-12-10 22:09:18 [Infos] [STDOUT] at opu.proxy.ClientProxy.registerRender(ClientProxy.java:23) 2013-12-10 22:09:18 [Infos] [STDOUT] at opu.common.modopu.Init(modopu.java:129) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.client.Minecraft.startGame(Minecraft.java:509) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:808) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2013-12-10 22:09:18 [Infos] [STDOUT] 2013-12-10 22:09:18 [Infos] [STDOUT] 2013-12-10 22:09:18 [Infos] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows: 2013-12-10 22:09:18 [Infos] [STDOUT] –------------------------------------------------------------------------------------- 2013-12-10 22:09:18 [Infos] [STDOUT] 2013-12-10 22:09:18 [Infos] [STDOUT] – Head -- 2013-12-10 22:09:18 [Infos] [STDOUT] Stacktrace: 2013-12-10 22:09:18 [Infos] [STDOUT] at opu.proxy.ClientProxy.registerRender(ClientProxy.java:23) 2013-12-10 22:09:18 [Infos] [STDOUT] at opu.common.modopu.Init(modopu.java:129) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2013-12-10 22:09:18 [Infos] [STDOUT] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699) 2013-12-10 22:09:18 [Infos] [STDOUT] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.client.Minecraft.startGame(Minecraft.java:509) 2013-12-10 22:09:18 [Infos] [STDOUT] 2013-12-10 22:09:18 [Infos] [STDOUT] – Initialization -- 2013-12-10 22:09:18 [Infos] [STDOUT] Details: 2013-12-10 22:09:18 [Infos] [STDOUT] Stacktrace: 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:808) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2013-12-10 22:09:18 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
-
MinecraftForgeClient.registerItemRenderer(modopu.Sabre4.itemID, new RenderItem());
C’est le rendu qui doit être enregistré, pas le modèle. -
Marche impec