Jump to content

Recommended Posts

Posted

So I created a pickaxe that when mining stone drops my custom block, and has a 25% chance to set the player on fire when mining a block. Code for harvest event below:

 

(Note: some of it is obfuscated with xxxx to keep names a secret)

 

@SubscribeEvent
public void xxxxPick(HarvestDropsEvent event)
{
	ItemStack theTool = event.harvester.getCurrentEquippedItem(); //[b]THIS[/b] is line 38, which was mentioned in the crash report
	if(theTool != null)
	{
		if(theTool.getItem() == ToolManager.xxxxPickaxe)
		{	
			if(random.nextInt(4) == 0)
			{
				event.harvester.setFire(5);
			}

			if(event.block != null)
			{
				if(event.block == Blocks.stone)
				{
					event.drops.clear();
					event.drops.add(new ItemStack(Item.getItemFromBlock(myBlocksClass.myCustomStone)));
				}
			}				
		}
	}

 

However, occasionally I get a crash report, stating a NullPointerException has occured doing my custom pick event. This really confuses me since I checked to see if both the block and the ItemStack for the tool are not null before using them. Example below:

 

 

// Hi. I'm Minecraft, and I'm a crashaholic.

 

Time: 3/21/16 7:12 PM

Description: Exception ticking world

 

java.lang.NullPointerException: Exception ticking world

at net.xxxxxx.events.HarvestingEvents.xxxxPick(HarvestingEvents.java:38)

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_HarvestingEvents_xxxxPick_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.block.Block.dropBlockAsItem(Block.java:795)

at net.minecraft.block.BlockBush.checkAndDropBlock(BlockBush.java:74)

at net.minecraft.block.BlockBush.updateTick(BlockBush.java:64)

at net.minecraft.world.WorldServer.func_147456_g(WorldServer.java:408)

at net.minecraft.world.WorldServer.tick(WorldServer.java:191)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:692)

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 net.xxxxxxx.events.HarvestingEvents.xxxxPick(HarvestingEvents.java:38)

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_HarvestingEvents_xxxxPick_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.block.Block.dropBlockAsItem(Block.java:795)

at net.minecraft.block.BlockBush.checkAndDropBlock(BlockBush.java:74)

at net.minecraft.block.BlockBush.updateTick(BlockBush.java:64)

at net.minecraft.world.WorldServer.func_147456_g(WorldServer.java:408)

at net.minecraft.world.WorldServer.tick(WorldServer.java:191)

 

-- Affected level --

Details:

Level name: New Worldwq346g344v632v2453v

All players: 1 total; [EntityPlayerMP['Player189'/19119, l='New Worldwq346g344v632v2453v', x=-73.43, y=72.00, z=185.88]]

Chunk stats: ServerChunkCache: 647 Drop: 0

Level seed: -2949494732709534244

Level generator: ID 00 - default, ver 1. Features enabled: true

Level generator options:

Level spawn location: World: (-69,64,258), Chunk: (at 11,4,2 in -5,16; contains blocks -80,0,256 to -65,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 25685 game time, 25685 day time

Level dimension: 0

Level storage version: 0x04ABD - Anvil

Level weather: Rain time: 117553 (now: false), thunder time: 9149 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true

Stacktrace:

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:692)

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_73, Oracle Corporation

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

Memory: 626505336 bytes (597 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: 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

UCHIJAAAAAAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAAAAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)

UCHIJAAAAAAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)

UCHIJAAAAAAAAA xxxxxxxx{0.1} [xxxxxxxx] (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['Player189'/19119, l='New Worldwq346g344v632v2453v', x=-73.43, y=72.00, z=185.88]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

Any idea what could be causing it? It says "BlockBush" in the crash report somewhere but the crash tends to occur half a minute after breaking a dead bush, if I broke one.

Posted

Maybe put a torch next to a mushroom, or spread water through crops or carpets. Those actions may trigger the event without setting a "harvester".

 

If all else fails, try some TNT. It may not solve your problem, but it will make you feel better.

 

You may also temporarily wrap your danger zone in a try-catch frame. Catch the next NPE and output everything you can see. Try to figure out what was being harvested and how. Then you'll have a better idea how to replicate the NPE as needed during testing.

 

Looking at your call stack, it appears that something was acting upon a BlockBush.

 

Or you can simply accept CoolAlias's advice to check harvester for null.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • I was playing minecraft, forge 47.3.0 and 1.20.1, but when i tried to play minecraft now only crashes, i need help please. here is the crash report: https://securelogger.net/files/e6640a4f-9ed0-4acc-8d06-2e500c77aaaf.txt
  • Topics

×
×
  • Create New...

Important Information

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