Jump to content

[SOLVED] [1.7.10] Player kicked with NullPointerException on block break


Andavin

Recommended Posts

So I cannot seem to find a solution to this problem. I've done tons of debugging and I've seemed to narrow it down some, but not as much as I'd like. It seems that after I initiate a teleport command that is handled by my mod (doesn't have to actually teleport me just start the command, however it is only with the teleport commands) I cannot break any block without it kicking me from the server printing out a NullPointerException as follows:

 

 

[18:26:38] [server thread/INFO] [MyEssentials]: Andavin ran the command tp2
[18:26:39] [server thread/WARN]: Failed to handle packet for /127.0.0.1:63816
java.lang.NullPointerException
at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:459) ~[ForgeHooks.class:?]
at net.minecraft.server.management.ItemInWorldManager.func_73084_b(ItemInWorldManager.java:259) ~[mx.class:?]
at net.minecraft.server.management.ItemInWorldManager.func_73074_a(ItemInWorldManager.java:151) ~[mx.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147345_a(NetHandlerPlayServer.java:489) ~[nh.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.func_148833_a(SourceFile:53) ~[ji.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.func_148833_a(SourceFile: ~[ji.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) ~[ej.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) [nc.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:334) [lt.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [li.class:?]
[18:26:39] [server thread/INFO]: Andavin lost connection: TextComponent{text='Internal server error', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}
[18:26:39] [server thread/INFO]: Andavin left the game

 

If I was to then log back in and break a block after this it will do the same thing over and over unless I remove my PlayerLoggedInEvent listener, in which case I have to teleport each time before I get the error.

 

I really have almost no idea which classes it's relevant to, but here are all the ones I can think of. I can post more if needed.

 

PlayerLoginListener:

http://pastebin.com/qtJLUCLZ

 

ListenerRegistry (The only classes that actually contain anything atm are the BlockBreak, Command, ChatListener, PlayerMove, PlayerTick, ServerTick, PlayerLogin, and PlayerLogout)

 

package me.andavin.MyEssentials.Listeners;

import org.apache.logging.log4j.Level;

import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.MinecraftForge;

public class ListenerRegistry {

public ListenerRegistry(){
	me.andavin.MyEssentials.MyEssentials.logger.log(Level.INFO, "Registering Listeners...");
	registerFMLCommonHandlerListeners();
	registerMinecraftForgeListeners();
}

private void registerFMLCommonHandlerListeners(){
	FMLCommonHandler.instance().bus().register(new ItemPickup());
	FMLCommonHandler.instance().bus().register(new PlayerLogin());
	FMLCommonHandler.instance().bus().register(new PlayerLogout());
	FMLCommonHandler.instance().bus().register(new PlayerMove());
	FMLCommonHandler.instance().bus().register(new PlayerTick());
	FMLCommonHandler.instance().bus().register(new ServerTick());
}

private void registerMinecraftForgeListeners(){
	MinecraftForge.EVENT_BUS.register(new ArrowLoose());
	MinecraftForge.EVENT_BUS.register(new BlockBreak());
	MinecraftForge.EVENT_BUS.register(new BlockHarvest());
	MinecraftForge.EVENT_BUS.register(new BlockMultiPlace());
	MinecraftForge.EVENT_BUS.register(new BlockPlace());
	MinecraftForge.EVENT_BUS.register(new ChatListener());
	MinecraftForge.EVENT_BUS.register(new Command());
	MinecraftForge.EVENT_BUS.register(new EntityInteract());
	MinecraftForge.EVENT_BUS.register(new FillBucket());
	MinecraftForge.EVENT_BUS.register(new FluidMove());
	MinecraftForge.EVENT_BUS.register(new LivingHurt());
	MinecraftForge.EVENT_BUS.register(new PlayerHarvest());
	MinecraftForge.EVENT_BUS.register(new PlayerInteract());
	MinecraftForge.EVENT_BUS.register(new PlayerOpenContainer());
	MinecraftForge.EVENT_BUS.register(new PlayerSleepInBed());
	MinecraftForge.EVENT_BUS.register(new Voting());
}

}

 

BlockBreak (I can remove all code from this class and doesn't change the outcome):

 

package me.andavin.MyEssentials.Listeners;

import java.util.UUID;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import me.andavin.MyEssentials.MySQL.Runnables.BreakLoggingQueue;
import net.minecraft.block.Block;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;

public class BlockBreak {

@SubscribeEvent
public void onBreak(BreakEvent event){
	UUID uuid = event.getPlayer().getUniqueID();
	String world = event.world.getWorldInfo().getWorldName();
	Integer[] list = new Integer[]{
	Block.getIdFromBlock(event.block),
	event.blockMetadata,
	event.x,
	event.y,
	event.z};
	BreakLoggingQueue.uuids.add(uuid);
	BreakLoggingQueue.worlds.add(world);
	BreakLoggingQueue.queue.add(list);
}

}

 

CommandHandler (This is where the CommandListener directs all commands):

http://pastebin.com/kUQ9J9XC

 

MyEssentials (@mod class):

http://pastebin.com/C6bsGhyq

 

And the two teleport commands that actually seem to cause the problem:

http://pastebin.com/5JXXJXmG

 

These commands don't actually have to go through, just called. I know this is a lot, but any help is extremely appreciated!

Link to comment
Share on other sites

I know that it's throwing the NullPointerException from either the onBlockBreakEvent method in ForgeHooks or in the method that calls that one. My only suspicion is that somehow my position is invalidated after I teleport and the client doesn't know where the block is that I broke? Or something to that effect maybe?

Link to comment
Share on other sites

BreakEvent is fired when any block is broken by any means.  Read the javadoc.

 

What happens if water pours on the ground and encounters tall grass?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Actually, BlockEvent.BreakEvent is only posted when a player breaks a block. At least to call the method onBlockBreakEvent in ForgeHooks EntityPlayerMP is one of the parameters. I did try it though and water doesn't throw the exception when it breaks a block. Do you know what I'm doing wrong that this would be happening?

Link to comment
Share on other sites

Hmmm, sorry about that. There is an event that does what I said.  Not that one then, hum.

 

What is the line of code at ForgeHooks.java line 459?  That'll help narrow down what was null, even if it isn't your code: you'll be able to figure out--by working backwards--what it was that your code did to cause it.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

This is the if statement that correlates to:

        // Tell client the block is gone immediately then process events
        if (world.getTileEntity(x, y, z) == null)
        {
            S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world);
            packet.field_148883_d = Blocks.air;
            packet.field_148884_e = 0;
            entityPlayer.playerNetServerHandler.sendPacket(packet);
        }

 

Line 459 is:

packet.field_148883_d = Blocks.air;

Link to comment
Share on other sites

Any idea why that would throw a NullPointer? What makes the packet handle fail? My best guess is that it can't find the player that broke the block or the World, but I can't figure out anything beyond that as to why my code would effect it.

Link to comment
Share on other sites

If I break the block in survival it actually crashes the server instead of just kicking me. What's nice about that is it gives me a crash report. To me it looks like the player is somehow null.

 

Here's the crash report:

 

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 4/16/16 10:23 PM
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:459)
at net.minecraft.server.management.ItemInWorldManager.func_73084_b(ItemInWorldManager.java:259)
at net.minecraft.server.management.ItemInWorldManager.func_73075_a(ItemInWorldManager.java:107)
at net.minecraft.entity.player.EntityPlayerMP.func_70071_h_(EntityPlayerMP.java:204)
at net.minecraft.world.World.func_72866_a(World.java:2070)
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:648)
at net.minecraft.world.World.func_72870_g(World.java:2034)
at net.minecraft.world.World.func_72939_s(World.java:1887)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:489)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:636)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:334)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:396)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)


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

-- Head --
Stacktrace:
at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:459)
at net.minecraft.server.management.ItemInWorldManager.func_73084_b(ItemInWorldManager.java:259)
at net.minecraft.server.management.ItemInWorldManager.func_73075_a(ItemInWorldManager.java:107)
at net.minecraft.entity.player.EntityPlayerMP.func_70071_h_(EntityPlayerMP.java:204)
at net.minecraft.world.World.func_72866_a(World.java:2070)
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:648)
at net.minecraft.world.World.func_72870_g(World.java:2034)
at net.minecraft.world.World.func_72939_s(World.java:1887)

-- Entity being ticked --
Details:
Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
Entity ID: 4845
Entity Name: Andavin
Entity's Exact location: -18.12, 64.00, 61.56
Entity's Block location: World: (-19,64,61), Chunk: (at 13,4,13 in -2,3; contains blocks -32,0,48 to -17,255,63), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity's Momentum: 0.00, 0.00, 0.00
Stacktrace:
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:489)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:636)

-- Affected level --
Details:
Level name: world
All players: 1 total; [EntityPlayerMP['Andavin'/4845, l='world', x=-18.12, y=64.00, z=61.56]]
Chunk stats: ServerChunkCache: 681 Drop: 0
Level seed: 744227533778554343
Level generator: ID 00 - default, ver 1. Features enabled: true
Level generator options: 
Level spawn location: World: (228,64,192), Chunk: (at 4,4,0 in 14,12; contains blocks 224,0,192 to 239,255,207), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 68293 game time, 68293 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 92080 (now: false), thunder time: 5141 (now: true)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Stacktrace:
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:334)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:396)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Mac OS X (x86_64) version 10.11.4
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1356803288 bytes (1293 MB) / 1640497152 bytes (1564 MB) up to 2863661056 bytes (2731 MB)
JVM Flags: 2 total; -Xmx3072M -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.99.99 Minecraft Forge 10.13.4.1558 7 mods loaded, 7 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] (forge.jar) 
UCHIJAAAA	Forge{10.13.4.1558} [Minecraft Forge] (forge.jar) 
UCHIJAAAA	FastCraft{1.23} [FastCraft] (fastcraft-1.23.jar) 
UCHIJAAAA	MyEssentials{1.0} [MyEssentials] (modid-1.0.jar) 
UCHIJAAAA	votifier{2.0} [Votifier] (Votifier.jar) 
UCHIJAAAA	worldedit{6.0-beta-01} [WorldEdit] (worldedit-forge.jar) 
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 20; [EntityPlayerMP['Andavin'/4845, l='world', x=-18.12, y=64.00, z=61.56]]
Is Modded: Definitely; Server brand changed to 'fml,forge'
Type: Dedicated Server (map_server.txt)

 

Would teleporting somehow make the EntityType for me null? How does that happen? Sorry for so many comments I just really need help with this.

Link to comment
Share on other sites

Okay, I believe I just figured out. Turns out it was in my personal player object that was extending EntityPlayerMP and was using the super constructor. I'm thinking that's where the null Entity Type was coming in. Removed that and everything works fine. Thank you for the help. :) I really appreciate the effort.

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.