Résolu Diverses Questions
-
Tu as pas une idee de comment je pourrais faire ?
-
Heu … ? tu n’as pas répondu à ma question x)
Car ce que tu es en train de faire c’est exactement comme ça que je l’aurai fait. Et kevin_68 l’a fait dans son mod spotlight, ça fonctionne très bien.
-
J’ai cru que c’était rhétorique car tu as dis “Je trouve ça étrange […]”. x) Le code je le juste avant d’appliquer la texture ?
EDIT:
Je l’ai mis ici:private void renderTileEntityChaudronAt(TileEntityChaudron tile, double x, double y, double z, float partialRenderTick) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef((90F * tile.getDirection()) + 180F, 0.0F, 1.0F, 0.0F); if (tile.getContenu().equalsIgnoreCase("vide")) { this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png"); } else { this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png"); } this.bindTexture(texture); model.renderAll(); GL11.glPopMatrix(); }
Et ça crash:
[23:05:10] [main/INFO] [GradleStart]: Extra: []
[23:06:42] [Server thread/INFO]: Stopping server
[23:06:42] [Server thread/INFO]: Saving players
[23:06:42] [Server thread/INFO]: Saving worlds
[23:06:42] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/Overworld
[23:06:42] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/Nether
[23:06:42] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/The End
[23:06:42] [Server thread/INFO] [FML]: Unloading dimension 0
[23:06:42] [Server thread/INFO] [FML]: Unloading dimension -1
[23:06:42] [Server thread/INFO] [FML]: Unloading dimension 1
[23:06:42] [Server thread/INFO] [FML]: Applying holder lookups
[23:06:42] [Server thread/INFO] [FML]: Holder lookups applied
[23:06:43] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Rendering Block Entity
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:148) ~[TileEntityRendererDispatcher.class:?]
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) ~[TileEntityRendererDispatcher.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
Caused by: java.lang.NullPointerException
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36) ~[TileEntityChaudronSpecialRenderer.class:?]
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityAt(TileEntityChaudronSpecialRenderer.java:27) ~[TileEntityChaudronSpecialRenderer.class:?]
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) ~[TileEntityRendererDispatcher.class:?]
… 15 more
[23:06:43] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
// Quite honestly, I wouldn’t worry myself about that.Time: 18/02/15 23:06
Description: Rendering Block Entityjava.lang.NullPointerException: Rendering Block Entity
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36)
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityAt(TileEntityChaudronSpecialRenderer.java:27)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056)
at net.minecraft.client.Minecraft.run(Minecraft.java:951)
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 net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)A detailed walkthrough of the error, its code path and all known details is as follows:
– Head –
Stacktrace:
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36)
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityAt(TileEntityChaudronSpecialRenderer.java:27)– Block Entity Details –
Details:
Name: ModHarryPotter.MODID:BlockChaudron // com.harrypotter.sosoh.common.blocks.TileEntityChaudron
Block type: ID #165 (tile.chaudron // com.harrypotter.sosoh.common.blocks.BlockChaudron)
Block data value: 0 / 0x0 / 0b0000
Block location: World: (-138,4,1356), Chunk: (at 6,0,12 in -9,84; contains blocks -144,0,1344 to -129,255,1359), Region: (-1,2; contains chunks -32,64 to -1,95, blocks -512,0,1024 to -1,255,1535)
Actual block type: ID #165 (tile.chaudron // com.harrypotter.sosoh.common.blocks.BlockChaudron)
Actual block data value: 0 / 0x0 / 0b0000
Stacktrace:
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300) -
Au pire, mets une valeur par défaut et regarde ce que ça donne, normalement il ne devrais plus y avoir de NPE.
-
Valeur ou ?
-
@‘sosoh’:
Valeur ou ?
public RessourceLocation texture = new RessourceLocation(MODID, “textures…”);
-
at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.ren derTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36) ~[TileEntityChaudronSpecialRenderer.class:?]
Tu as quoi à la ligne 36 ? -
Désolé, de repondre que maintenant, j’étais occupé, à la ligne 36 j’ai:
if (tile.getContenu().equalsIgnoreCase("vide")) { this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png"); } else { this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png"); }
-
Le contenu est null. Fait comme ça :
if (tile.getContenu() != null && tile.getContenu().equalsIgnoreCase(“vide”)) {ou :
if (“vide”.equalsIgnoreCase(tile.getContenu())) {