Rendu d'item avec un model techne
-
Voilà, j’ai copié-collé le code dans un case EQUIPPED_FIRST_PERSON et rajouter le break mais aucun changement. De plus aucun rendu n’apparaît lorsque je suis en première personne.
@Override public void renderItem(ItemRenderType type, ItemStack item, Object… data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); GL11.glRotatef(45, 0.0F, 0.0F, 1.0F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); 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(); GL11.glRotatef(45, 0.0F, 0.0F, 1.0F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } }
-
Dans la fonction handleRenderType, ajoute la case EQUIPPED_FIRST_PERSON et met sur true.
-
Merci, voilà qui résout une partie du problème
Cependant je n’arrive toujours pas à changer l’orientation de mon rendu…
Une idée ? -
Tu l’as peut être fait tourné dans le mauvais axe ?
Vérifie aussi que tu as mit le code de rotation avant le model.render(….) -
Voilà j’ai trouvé, c’était bien l’axe qui posait problème apparemment, il faut mettre un angle négatif pour voir une modification…
Merci tout le monde pour m’avoir aider ! -
Bonjour bonjour j’ai un petit probleme au niveau du lancement du rendu
lorsque le jeu ce lance il crash avec le rendu, je l’ai désactiver pour tester sa marche voici txt de crash–-- Minecraft Crash Report ---- // But it works on my machine. Time: 09/10/14 21:18 Description: Initializing game java.lang.ClassCastException: google.pulganr.common.PhoneTechneModel cannot be cast to net.minecraftforge.client.IItemRenderer at google.pulganr.client.ClientProxy.registerRender(ClientProxy.java:18) at google.pulganr.common.ModTutoriel.init(ModTutoriel.java:109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at google.pulganr.client.ClientProxy.registerRender(ClientProxy.java:18) at google.pulganr.common.ModTutoriel.init(ModTutoriel.java:109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_65, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 730515248 bytes (696 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.84.1217 Minecraft Forge 10.13.1.1217 5 mods loaded, 5 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.10.84.1217} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.1.1217.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.13.1.1217} [Minecraft Forge] (forgeSrc-1.7.10-10.13.1.1217.jar) Unloaded->Constructed->Pre-initialized->Initialized examplemod{1.0} [examplemod] (bin) Unloaded->Constructed->Pre-initialized->Initialized pulganrmod{0.0.37 BETA} [Watch Craft] (bin) Unloaded->Constructed->Pre-initialized->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: GeForce GTX 660/PCIe/SSE2 GL version 4.4.0 NVIDIA 344.11, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: Français (France) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: On (16)
et voici mes classes :
classe rendu techne
package google.pulganr.common; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class PhoneTechneModel extends ModelBase { //fields ModelRenderer telephone; public PhoneTechneModel() { textureWidth = 64; textureHeight = 64; telephone = new ModelRenderer(this, 0, 0); telephone.addBox(0F, 0F, 0F, 9, 1, 6); telephone.setRotationPoint(-3F, 23F, 0F); telephone.setTextureSize(64, 64); telephone.mirror = true; setRotation(telephone, 0F, 0F, 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); telephone.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); } }
classe de l’item:
package google.pulganr.common; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; public class ItemTelephone extends Item implements IItemRenderer { protected PhoneTechneModel model; protected static final ResourceLocation texture = new ResourceLocation("ModTutoriel:textures/items/itemTechne.png"); public ItemTelephone() { this.setCreativeTab(ModTutoriel.watchcraftCreativeTabs); model = new PhoneTechneModel(); } @Override public void registerIcons(IIconRegister iconregister) { this.itemIcon = iconregister.registerIcon(ModTutoriel.MODID + ":telephonehack1"); this.itemIcon = iconregister.registerIcon(ModTutoriel.MODID + ":telephonebase"); this.itemIcon = iconregister.registerIcon(ModTutoriel.MODID + ":telephonehack2"); this.itemIcon = iconregister.registerIcon(ModTutoriel.MODID + ":telephonehack3"); this.itemIcon = iconregister.registerIcon(ModTutoriel.MODID + ":telephonebase"); } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { MovingObjectPosition objectMouseOver = player.rayTrace(64, 1); //rayTace = pos pointer if(objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && !world.isRemote) { EntityTNTPrimed tnt = new EntityTNTPrimed(world, objectMouseOver.blockX, objectMouseOver.blockY + 1, objectMouseOver.blockZ, player); world.spawnEntityInWorld(tnt); } return stack; } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: 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); 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); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } } }
et classe ClientProxy :
package google.pulganr.client; import google.pulganr.common.EntityMobTutoriel; import google.pulganr.common.ModTutoriel; import google.pulganr.common.PhoneTechneModel; import net.minecraft.client.model.ModelBiped; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRender() { System.out.println("méthode côté client"); RenderingRegistry.registerEntityRenderingHandler(EntityMobTutoriel.class, new RenderMobTutoriel(new ModelBiped(), 0.5F)); MinecraftForgeClient.registerItemRenderer(ModTutoriel.telephone, (IItemRenderer)new PhoneTechneModel()); } }
une idée? :huh:
-
MinecraftForgeClient.registerItemRenderer(ModTutoriel.telephone, (IItemRenderer)new PhoneTechneModel());
Tu dois avoir ici la classe du rendu, pas du modèle, donc la classe ItemTelephone (d’ailleurs tu aurai du faire une classe à part plutôt qu’ajouter le code dans la classe de ton item, mais ça devrait aussi fonctionner).
-
@‘robin4002’:
MinecraftForgeClient.registerItemRenderer(ModTutoriel.telephone, (IItemRenderer)new PhoneTechneModel());
Tu dois avoir ici la classe du rendu, pas du modèle, donc la classe ItemTelephone (d’ailleurs tu aurai du faire une classe à part plutôt qu’ajouter le code dans la classe de ton item, mais ça devrait aussi fonctionner).
je doit bien mettre ceci dans la classe ClientProxy?
car si oui : j’ai encore le crash
si non : je suis nulsinon j’ai mit ceci
public void renderItem(ItemRenderType type, ItemStack item, Object… data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); 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); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; }
Pour avoir le rendu au sol mais rien dans :
@Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: return true; default: return false; } }
C’est normal?
-
Non, tu l’as déjà normalement, il faut que tu modifie par ce que je t’ai dit de mettre.
Et non ce n’est pas normal, il faut que tu ajoutes case ENTITY et return true; dans handleRenderType -
@‘robin4002’:
Non, tu l’as déjà normalement, il faut que tu modifie par ce que je t’ai dit de mettre.
Et non ce n’est pas normal, il faut que tu ajoutes case ENTITY et return true; dans handleRenderTypefinalement j’ai fait le TechneRender ailleur et j’ai rajouter le morceau de code et sa marche merci robin
encore moi j’ai une erreur sur cette ligne
-
%(#000000)[GL11]%(#666600)[.]%(#000000)[glRotatef]%(#666600)[(]%(#000000)[*Angle*]%(#666600)[,] %(#646464)[0.0F]%(#666600)[,] %(#646464)[1.0F]%(#666600)[,] %(#646464)[0.0F]%(#666600)[);]
le angle est souligner que doi-je faire?
-
-
Il faut que tu remplace angle par une valeur
-
Ce tutoriel marche toujours en 1.7.10 ?
-
@‘Oeilomega’:
Ce tutoriel marche toujours en 1.7.10 ?
Oui
-
Ok merci^^
-
J’ai un probleme, j’ai suivis le tuto et meme chercher sur le web mais je ne trouves pas de solution:
je fais comme c’est ecrit mais il ne reconnait pas le::::
“model.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);”
:::
ca me dit:
:::
The method render(Entity, float, float, float, float, float, float) is undefined for the type ItemBaguetteSureauTechneRender.
:::Vous pouvez m’aider ?
Mon code:
:::package com.harrypotter.sosoh.client; import org.lwjgl.opengl.GL11; 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; public class ItemBaguetteSureauTechneRender implements IItemRenderer{ protected ItemBaguetteSureauTechneRender model; protected static final ResourceLocation texture = new ResourceLocation("ModTutoriel:textures/items/itemTechne.png"); public ItemBaguetteSureauTechneRender () { model = new ItemBaguetteSureauTechneRender(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: 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(0F, 1.0f, 0.0f, 0.0f); GL11.glRotatef(-5F, 0.0f, 1.0f, 0.0f); GL11.glRotatef(-150F, 0.0f, 0.0f, 1.0f); GL11.glTranslatef(-0.8F, 0.6F, -0.1F); model.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } } }
:::
-
Fait voir le code de ton modèle ?
-
Voila:
:::package com.harrypotter.sosoh.client; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBaguetteSureau extends ModelBase { //fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; ModelRenderer Shape4; ModelRenderer Shape5; ModelRenderer Shape6; ModelRenderer Shape7; ModelRenderer Shape8; ModelRenderer Shape9; public ModelBaguetteSureau() { textureWidth = 64; textureHeight = 32; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 1, 1, 14); Shape1.setRotationPoint(0F, 20.36667F, -8F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 36, 0); Shape2.addBox(0F, 0F, 0F, 2, 2, 1); Shape2.setRotationPoint(-0.5F, 19.86667F, 6F); Shape2.setTextureSize(64, 32); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0F); Shape3 = new ModelRenderer(this, 36, 0); Shape3.addBox(0F, 0F, 0F, 2, 2, 1); Shape3.setRotationPoint(-0.5F, 19.9F, 3F); Shape3.setTextureSize(64, 32); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 43, 0); Shape4.addBox(0F, 0F, 0F, 3, 3, 1); Shape4.setRotationPoint(-1F, 19.5F, 0F); Shape4.setTextureSize(64, 32); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0F); Shape5 = new ModelRenderer(this, 36, 0); Shape5.addBox(0F, 0F, 0F, 2, 2, 1); Shape5.setRotationPoint(-0.5F, 19.9F, -2.5F); Shape5.setTextureSize(64, 32); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 31, 0); Shape6.addBox(0F, 0F, 0F, 1, 1, 1); Shape6.setRotationPoint(0F, 20.1F, -6F); Shape6.setTextureSize(64, 32); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0F); Shape7 = new ModelRenderer(this, 31, 0); Shape7.addBox(0F, 0F, 0F, 1, 1, 1); Shape7.setRotationPoint(0F, 20.6F, -6F); Shape7.setTextureSize(64, 32); Shape7.mirror = true; setRotation(Shape7, 0F, 0F, 0F); Shape8 = new ModelRenderer(this, 31, 0); Shape8.addBox(0F, 0F, 0F, 1, 1, 1); Shape8.setRotationPoint(0.3F, 20.35F, -6F); Shape8.setTextureSize(64, 32); Shape8.mirror = true; setRotation(Shape8, 0F, 0F, 0F); Shape9 = new ModelRenderer(this, 31, 0); Shape9.addBox(0F, 0F, 0F, 1, 1, 1); Shape9.setRotationPoint(-0.3F, 20.4F, -6F); Shape9.setTextureSize(64, 32); Shape9.mirror = true; setRotation(Shape9, 0F, 0F, 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); Shape9.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); } }
:::
-
Problème trouvé, dans ta classe ItemBaguetteSureauTechneRender, tu as mit
protected ItemBaguetteSureauTechneRender model;
et :
model = new ItemBaguetteSureauTechneRender();Or cela devrait être :
protected ModelBaguetteSureau model;et :
model = new ModelBaguetteSureau(); -
Ok je testes et j’edit pour que tu saches si ça a fonctionné !
Edit: Il n’y a plus d’erreur, merci !
Ma texture ne s’affiche pas.
Mes codes:
:::package com.harrypotter.sosoh.client; import org.lwjgl.opengl.GL11; import com.harrypotter.sosoh.common.ModHarryPotter; 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; public class ItemBaguetteSureauTechneRender implements IItemRenderer{ protected ModelBaguetteSureau model; protected static final ResourceLocation texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/items/model_items_sureau.png"); public ItemBaguetteSureauTechneRender () { model = new ModelBaguetteSureau(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: 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); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } } }
:::
:::
package com.harrypotter.sosoh.common.items.baguettes; import com.harrypotter.sosoh.common.ModHarryPotter; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; public class ItemBaguetteSureau extends Item{ public ItemBaguetteSureau() { this.setCreativeTab(ModHarryPotter.creativetabsHPB); this.setMaxStackSize(1); } }
:::
:::
package com.harrypotter.sosoh.proxy; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; import com.harrypotter.sosoh.client.ItemBaguetteSureauTechneRender; import com.harrypotter.sosoh.client.TESRInventoryRenderer; import com.harrypotter.sosoh.client.TileEntityChaudronSpecialRenderer; import com.harrypotter.sosoh.common.ModHarryPotter; import com.harrypotter.sosoh.common.blocks.TileEntityChaudron; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { public static int tesrRenderId; @Override public void registerRender() { System.out.println("méthode côté client"); tesrRenderId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChaudron.class, new TileEntityChaudronSpecialRenderer()); MinecraftForgeClient.registerItemRenderer(ModHarryPotter.itemBaguetteSureau, (IItemRenderer)new ItemBaguetteSureauTechneRender()); } }
:::
-
Tu as placé ta texture où ? Et elle fait quelle taille ?
(la prochaine fois utilise la fonction éditer).