Jump to content

[1.8] onEntityItemUpdate Null pointer exception


zlotnleo

Recommended Posts

I have this code in the generic item class:

 

 

ItemStack washingResult;

 

    public void setWashingResult(ItemStack result)

    {

        washingResult = result;

    }

 

    @Override

    public boolean onEntityItemUpdate(EntityItem entityItem)

    {

        if(entityItem.worldObj.getBlockState(new BlockPos((int)Math.floor(entityItem.posX), (int)Math.floor(entityItem.posY), (int)Math.floor(entityItem.posZ))).getBlock() == Blocks.water && washingResult!=null)

        {

            entityItem.setEntityItemStack(washingResult);

        }

        return false;

    }

 

 

 

And in the item's class I call this in constructor:

    this.setWashingResult(new ItemStack(ModItems.wetCoal, 1, 0));

 

The item obtained with /give command or from creative inventory works just fine and has no problems being dropped. However, when I drop an item into the water, game crashes.

 

Crash log:

 

 

19:33:22] [server thread/INFO] [FML]: Applying holder lookups

[19:33:22] [server thread/INFO] [FML]: Holder lookups applied

[19:33:22] [Client thread/FATAL]: Reported exception thrown!

net.minecraft.util.ReportedException: Rendering entity in world

at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:425) ~[RenderManager.class:?]

at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) ~[RenderManager.class:?]

at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) ~[RenderManager.class:?]

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) ~[RenderGlobal.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) ~[EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) ~[EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1114) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]

at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]

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(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]

at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) [idea_rt.jar:?]

Caused by: java.lang.NullPointerException

at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:280) ~[itemStack.class:?]

at net.minecraft.client.renderer.ItemModelMesher.getMetadata(ItemModelMesher.java:70) ~[itemModelMesher.class:?]

at net.minecraft.client.renderer.ItemModelMesher.getItemModel(ItemModelMesher.java:43) ~[itemModelMesher.class:?]

at net.minecraft.client.renderer.entity.RenderEntityItem.func_177075_a(RenderEntityItem.java:109) ~[RenderEntityItem.class:?]

at net.minecraft.client.renderer.entity.RenderEntityItem.doRender(RenderEntityItem.java:179) ~[RenderEntityItem.class:?]

at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377) ~[RenderManager.class:?]

... 22 more

[19:33:22] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: ---- Minecraft Crash Report ----

// I blame Dinnerbone.

 

Time: 03.06.15 19:33

Description: Rendering entity in world

 

java.lang.NullPointerException: Rendering entity in world

at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:280)

at net.minecraft.client.renderer.ItemModelMesher.getMetadata(ItemModelMesher.java:70)

at net.minecraft.client.renderer.ItemModelMesher.getItemModel(ItemModelMesher.java:43)

at net.minecraft.client.renderer.entity.RenderEntityItem.func_177075_a(RenderEntityItem.java:109)

at net.minecraft.client.renderer.entity.RenderEntityItem.doRender(RenderEntityItem.java:179)

at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377)

at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)

at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1114)

at net.minecraft.client.Minecraft.run(Minecraft.java:376)

at net.minecraft.client.main.Main.main(Main.java:117)

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:497)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

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:497)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:280)

at net.minecraft.client.renderer.ItemModelMesher.getMetadata(ItemModelMesher.java:70)

at net.minecraft.client.renderer.ItemModelMesher.getItemModel(ItemModelMesher.java:43)

at net.minecraft.client.renderer.entity.RenderEntityItem.func_177075_a(RenderEntityItem.java:109)

at net.minecraft.client.renderer.entity.RenderEntityItem.doRender(RenderEntityItem.java:179)

 

-- Entity being rendered --

Details:

Entity Type: Item (net.minecraft.entity.item.EntityItem)

Entity ID: 15241

Entity Name: ~~ERROR~~ NullPointerException: null

Entity's Exact location: -213,33, 55,43, -1238,48

Entity's Block location: -214,00,55,00,-1239,00 - World: (-214,55,-1239), Chunk: (at 10,3,9 in -14,-78; contains blocks -224,0,-1248 to -209,255,-1233), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)

Entity's Momentum: 0,08, -0,39, -0,08

Entity's Rider: ~~ERROR~~ NullPointerException: null

Entity's Vehicle: ~~ERROR~~ NullPointerException: null

 

-- Renderer details --

Details:

Assigned renderer: net.minecraft.client.renderer.entity.RenderEntityItem@73379057

Location: 0,42,-0,22,-0,25 - World: (0,-1,-1), Chunk: (at 0,-1,15 in 0,-1; contains blocks 0,0,-16 to 15,255,-1), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)

Rotation: 116.71875

Delta: 0.11974108

Stacktrace:

at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377)

at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)

at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityPlayerSP['zlotnleo'/74, l='MpServer', x=-213,82, y=56,00, z=-1238,16]]

Chunk stats: MultiplayerChunkCache: 622, 622

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: -208,00,4,00,-1217,00 - World: (-208,4,-1217), Chunk: (at 0,0,15 in -13,-77; contains blocks -208,0,-1232 to -193,255,-1217), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)

Level time: 110294 game time, 6000 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: ~~ERROR~~ NullPointerException: null

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2613)

at net.minecraft.client.Minecraft.run(Minecraft.java:398)

at net.minecraft.client.main.Main.main(Main.java:117)

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:497)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

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:497)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Mac OS X (x86_64) version 10.10.3

Java Version: 1.8.0_45, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 618402520 bytes (589 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.10 FML v8.99.18.1419 Minecraft Forge 11.14.1.1419 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{8.99.18.1419} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1419.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{11.14.1.1419} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1419.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

coalage{1.8-1.0} [Coal Age] (CoalAge) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Loaded coremods (and transformers):

Launched Version: 1.8

LWJGL: 2.9.2

OpenGL: NVIDIA GeForce GT 750M OpenGL Engine GL version 2.1 NVIDIA-10.2.7 310.41.25f01, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because ARB_framebuffer_object 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: No

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)

[19:33:22] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: #@!@# Game crashed! Crash report saved to: #@!@# /Users/zlotnleo/Documents/IdeaProjects/minecraft/CoalAge/eclipse/./crash-reports/crash-2015-06-03_19.33.22-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

Process finished with exit code 255

 

[/spoiler/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.