@DailyCraft merci de ta réponse.
Ca ne marche toujours pas…
Le crash report me donne un NullPointerException 
Code :
| package com.avonia.mod.util.handlers; |
| |
| import org.jline.utils.PumpReader; |
| |
| import com.avonia.mod.init.ItemInit; |
| import com.avonia.mod.init.objects.ItemRadar; |
| import com.avonia.mod.util.Reference; |
| |
| import net.minecraft.block.BlockDoublePlant.EnumPlantType; |
| import net.minecraft.client.Minecraft; |
| import net.minecraft.client.gui.FontRenderer; |
| import net.minecraft.client.gui.Gui; |
| import net.minecraft.entity.player.EntityPlayer; |
| import net.minecraft.item.ItemStack; |
| import net.minecraft.util.EnumHand; |
| import net.minecraft.util.ResourceLocation; |
| import net.minecraftforge.client.event.RenderGameOverlayEvent; |
| import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; |
| import net.minecraftforge.fml.relauncher.Side; |
| import net.minecraftforge.fml.relauncher.SideOnly; |
| |
| public class RadarHandler extends Gui |
| { |
| private Minecraft mc; |
| |
| public static int amountTiles; |
| |
| |
| FontRenderer fontRender; |
| |
| final ResourceLocation bg = new ResourceLocation(Reference.MODID + ":textures/items/radar.png"); |
| |
| public RadarHandler() { |
| this.mc = Minecraft.getMinecraft(); |
| this.fontRender = this.mc.fontRenderer; |
| } |
| |
| @SideOnly(Side.CLIENT) |
| @SubscribeEvent |
| public void onRenderPre(RenderGameOverlayEvent.Pre event) |
| { |
| |
| if(event.getType() != null) |
| { |
| mc.getTextureManager().bindTexture(this.bg); |
| |
| drawModalRectWithCustomSizedTexture(5,5,0,0,32,32,32,32); |
| |
| amountTiles = mc.world.getChunkFromChunkCoords(mc.player.chunkCoordX + 0, |
| mc.player.chunkCoordZ + 0).getTileEntityMap().values().size(); |
| |
| amountTiles = amountTiles + mc.world.getChunkFromChunkCoords(mc.player.chunkCoordX + 0, |
| mc.player.chunkCoordZ + 1).getTileEntityMap().values().size(); |
| |
| amountTiles = amountTiles + mc.world.getChunkFromChunkCoords(mc.player.chunkCoordX + 0, |
| mc.player.chunkCoordZ - 1).getTileEntityMap().values().size(); |
| |
| amountTiles = amountTiles + mc.world.getChunkFromChunkCoords(mc.player.chunkCoordX + 1, |
| mc.player.chunkCoordZ).getTileEntityMap().values().size(); |
| |
| amountTiles = amountTiles + mc.world.getChunkFromChunkCoords(mc.player.chunkCoordX - 1, |
| mc.player.chunkCoordZ).getTileEntityMap().values().size(); |
| |
| drawCenteredString(fontRender, this.amountTiles + "%", 0,100, 11); |
| |
| event.setCanceled(true); |
| } |
| } |
| |
| } |
| |
Crash-report:
---- Minecraft Crash Report ----
// This doesn't make any sense!
Time: 4/14/20 4:28 PM
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at net.minecraft.client.gui.Gui.drawCenteredString(Gui.java:127)
at com.avonia.mod.util.handlers.RadarHandler.onRenderPre(RadarHandler.java:64)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_16_RadarHandler_onRenderPre_Pre.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:910)
at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:119)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1151)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1209)
at net.minecraft.client.Minecraft.run(Minecraft.java:442)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:25)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.client.gui.Gui.drawCenteredString(Gui.java:127)
at com.avonia.mod.util.handlers.RadarHandler.onRenderPre(RadarHandler.java:64)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_16_RadarHandler_onRenderPre_Pre.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:910)
at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:119)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player997'/494, l='MpServer', x=8.50, y=65.00, z=8.50]]
Chunk stats: MultiplayerChunkCache: 0, 0
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: World: (8,64,8), Chunk: (at 8,4,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 0 game time, 0 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 1 total; [EntityPlayerSP['Player997'/494, l='MpServer', x=8.50, y=65.00, z=8.50]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2889)
at net.minecraft.client.Minecraft.run(Minecraft.java:471)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:25)
-- System Details --
Details:
Minecraft Version: 1.12.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_181, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 701521864 bytes (669 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP 9.42 Powered by Forge 14.23.5.2847 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
| State | ID | Version | Source | Signature |
|:------ |:--------- |:------------ |:-------------------------------- |:--------- |
| LCHIJA | minecraft | 1.12.2 | minecraft.jar | None |
| LCHIJA | mcp | 9.42 | minecraft.jar | None |
| LCHIJA | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.5.2847.jar | None |
| LCHIJA | forge | 14.23.5.2847 | forgeSrc-1.12.2-14.23.5.2847.jar | None |
| LCHIJA | avonia | 1.0.0 | bin | None |
Loaded coremods (and transformers):
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 445.75' Renderer: 'GeForce GTX 1050/PCIe/SSE2'
Launched Version: 1.12.2
LWJGL: 2.9.4
OpenGL: GeForce GTX 1050/PCIe/SSE2 GL version 4.6.0 NVIDIA 445.75, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.
Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs:
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 16x AMD Ryzen 7 1700 Eight-Core Processor