Hi! I have a problem with Ticking Entity;
I made custom drop on stone when player is holding a redstonePickaxe, but minecraft will crash when tnt explode near stone.
This is my event line with caused Ticking Entity:
@SubscribeEvent public void onBlockDrop(HarvestDropsEvent event) {
random = new Random();
dropped = random.nextInt(2) + 1;
---- Minecraft Crash Report -------- Minecraft Crash Report ----// Why did you do that?
Time: 11.11.20 12:07Description: Ticking entity
java.lang.NullPointerException: Ticking entity at com.neevers.mod.DropHandler.onBlockDrop(DropHandler.java:108) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_DropHandler_onBlockDrop_HarvestDropsEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) at net.minecraft.world.World.createExplosion(World.java:2655) at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) at net.minecraft.world.World.updateEntity(World.java:2258) at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
A detailed walkthrough of the error, its code path and all known details is as follows:---------------------------------------------------------------------------------------
-- Head --Stacktrace: at com.neevers.mod.DropHandler.onBlockDrop(DropHandler.java:108) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_DropHandler_onBlockDrop_HarvestDropsEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) at net.minecraft.world.World.createExplosion(World.java:2655) at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) at net.minecraft.world.World.updateEntity(World.java:2258)
-- Entity being ticked --Details: Entity Type: PrimedTnt (net.minecraft.entity.item.EntityTNTPrimed) Entity ID: 22692 Entity Name: Block of TNT Entity's Exact location: 214,51, 5,49, 250,34 Entity's Block location: World: (214,5,250), Chunk: (at 6,0,10 in 13,15; contains blocks 208,0,240 to 223,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0,00, -0,00, -0,00Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
-- Affected level --Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player228'/252, l='New World', x=214,32, y=5,00, z=242,22]] Chunk stats: ServerChunkCache: 691 Drop: 0 Level seed: -8843183443350488524 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (216,64,224), Chunk: (at 8,4,0 in 13,14; contains blocks 208,0,224 to 223,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 4739 game time, 4739 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 14168 (now: false), thunder time: 118176 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: trueStacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
-- System Details --Details: Minecraft Version: 1.7.10 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_241, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 699896592 bytes (667 MB) / 1038876672 bytes (990 MB) up to 2624323584 bytes (2502 MB) JVM Flags: 4 total; -Xincgc -Xmx1024M -Xms1024M -Xmx2536M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJAAAA sb{1.0} [Nevers Server Mod] (bin) GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player228'/252, l='New World', x=214,32, y=5,00, z=242,22]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge'
The harvester field in the event is probably null, because there is no harvester when the block is broken by tnt. Simply adding a null check for event.harvester should fix the issue.
Hi! I have a problem with Ticking Entity;
I made custom drop on stone when player is holding a redstonePickaxe, but minecraft will crash when tnt explode near stone.
This is my event line with caused Ticking Entity:
@SubscribeEvent public void onBlockDrop(HarvestDropsEvent event) {
random = new Random();
dropped = random.nextInt(2) + 1;
if(event.block == Blocks.stone && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == NeeversMod.redstonePickaxe)if(random.nextInt(100)<5) {
{ { event.drops.add(dropped12, new ItemStack(NeeversMod.redstoneP)); } }
And this crash log:
---- Minecraft Crash Report -------- Minecraft Crash Report ----// Why did you do that?
Time: 11.11.20 12:07Description: Ticking entity
java.lang.NullPointerException: Ticking entity at com.neevers.mod.DropHandler.onBlockDrop(DropHandler.java:108) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_DropHandler_onBlockDrop_HarvestDropsEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) at net.minecraft.world.World.createExplosion(World.java:2655) at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) at net.minecraft.world.World.updateEntity(World.java:2258) at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
A detailed walkthrough of the error, its code path and all known details is as follows:---------------------------------------------------------------------------------------
-- Head --Stacktrace: at com.neevers.mod.DropHandler.onBlockDrop(DropHandler.java:108) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_DropHandler_onBlockDrop_HarvestDropsEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) at net.minecraft.world.World.createExplosion(World.java:2655) at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) at net.minecraft.world.World.updateEntity(World.java:2258)
-- Entity being ticked --Details: Entity Type: PrimedTnt (net.minecraft.entity.item.EntityTNTPrimed) Entity ID: 22692 Entity Name: Block of TNT Entity's Exact location: 214,51, 5,49, 250,34 Entity's Block location: World: (214,5,250), Chunk: (at 6,0,10 in 13,15; contains blocks 208,0,240 to 223,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0,00, -0,00, -0,00Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
-- Affected level --Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player228'/252, l='New World', x=214,32, y=5,00, z=242,22]] Chunk stats: ServerChunkCache: 691 Drop: 0 Level seed: -8843183443350488524 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (216,64,224), Chunk: (at 8,4,0 in 13,14; contains blocks 208,0,224 to 223,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 4739 game time, 4739 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 14168 (now: false), thunder time: 118176 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: trueStacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
-- System Details --Details: Minecraft Version: 1.7.10 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_241, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 699896592 bytes (667 MB) / 1038876672 bytes (990 MB) up to 2624323584 bytes (2502 MB) JVM Flags: 4 total; -Xincgc -Xmx1024M -Xms1024M -Xmx2536M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJAAAA sb{1.0} [Nevers Server Mod] (bin) GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player228'/252, l='New World', x=214,32, y=5,00, z=242,22]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge'
The harvester field in the event is probably null, because there is no harvester when the block is broken by tnt. Simply adding a null check for event.harvester should fix the issue.
Thank u so much! It worked!
My final class:
if (event.harvester == null) {return; }else if(event.block == Blocks.stone && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == NeeversMod.redstonePickaxe)if(random.nextInt(100)<5) { event.drops.add(dropped12, new ItemStack(NeeversMod.redstoneP)); }