Jump to content

HarvestDropsEvent isnt working...?


Manslaughter777

Recommended Posts

Some reason i keep crashing when trying to use the event. It was working at some stage but now its not... im pretty sure im doing something wrong but idk what..

 

The class:

 

 

package com.manslaughter777.moondimension.event;

import com.manslaughter777.moondimension.Main;
import com.manslaughter777.moondimension.entity.EntitySpaceman;
import com.manslaughter777.moondimension.inventory.InventoryTool;
import com.manslaughter777.moondimension.items.ItemMoonPickaxe;
import com.manslaughter777.moondimension.items.ItemToolUpgrade;

import net.minecraft.block.Block;
import net.minecraft.block.BlockOre;
import net.minecraft.block.BlockSand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.world.BlockEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class HarvestDropsEvent {

@SubscribeEvent
public void onBlockBreak(BlockEvent.HarvestDropsEvent event) {
	EntityPlayer player = event.harvester;
	World world = event.world;
	Block block = event.block;
	int x = event.x;
	int y = event.y;
	int z = event.z;	

	//InventoryTool inv = new InventoryTool(player.getHeldItem());


	if(player.getHeldItem() != null) { //this is line 34, where the crash report leads to
		if(player.getHeldItem().getItem() instanceof ItemMoonPickaxe) { //only pickaxes
			if(new InventoryTool(player.getHeldItem()).upgrade[itemToolUpgrade.oreHarvesterId] == true) {

				if(block instanceof BlockSand) {
					event.drops.add(new ItemStack(Blocks.anvil));
					event.drops.remove(new ItemStack(Blocks.sand));
				}
			}
		}
	}

}

}

 

 

 

The crash report:

 

 

// Sorry 

Time: 2/03/15 4:09 PM
Description: Exception in server tick loop

java.lang.NullPointerException: Exception in server tick loop
at com.manslaughter777.moondimension.event.HarvestDropsEvent.onBlockBreak(HarvestDropsEvent.java:34)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_13_HarvestDropsEvent_onBlockBreak_HarvestDropsEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:146)
at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806)
at net.minecraft.block.Block.dropBlockAsItem(Block.java:795)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:184)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:162)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:132)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:162)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:162)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:162)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:162)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:132)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:132)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:132)
at net.minecraft.world.WorldServer.scheduleBlockUpdateWithPriority(WorldServer.java:455)
at net.minecraft.world.WorldServer.scheduleBlockUpdate(WorldServer.java:432)
at net.minecraft.block.BlockDynamicLiquid.onBlockAdded(BlockDynamicLiquid.java:352)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:713)
at net.minecraft.world.World.setBlock(World.java:519)
at net.minecraft.block.BlockDynamicLiquid.func_149813_h(BlockDynamicLiquid.java:187)
at net.minecraft.block.BlockDynamicLiquid.updateTick(BlockDynamicLiquid.java:152)
at net.minecraft.world.gen.feature.WorldGenLiquids.generate(WorldGenLiquids.java:83)
at net.minecraft.world.biome.BiomeDecorator.genDecorations(BiomeDecorator.java:344)
at net.minecraft.world.biome.BiomeDecorator.decorateChunk(BiomeDecorator.java:145)
at net.minecraft.world.biome.BiomeGenBase.decorate(BiomeGenBase.java:412)
at net.minecraft.world.biome.BiomeGenForest.decorate(BiomeGenForest.java:198)
at net.minecraft.world.gen.ChunkProviderGenerate.populate(ChunkProviderGenerate.java:444)
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:313)
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157)
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119)
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305)
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79)
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445)
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:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 844794136 bytes (805 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: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
moondimension{1.0.0} [The Moon] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[16:09:52] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-03-02_16.09.52-server.txt
AL lib: (EE) alc_cleanup: 1 device not closed

 

 

Link to comment
Share on other sites

From

HarvestDropsEvent

:

public final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.