Jump to content

[1.7.10] [SOLVED] TileEntity isUseableByPlayer


Recommended Posts

Posted

Hello,

 

I've created with Forge 1.7.10-10.13.1.1224 a custom "furnace", but now I have one problem:

 

Everytime if I'm right clicking on it, the Game is crashing:

 

---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 14.10.14 18:28
Description: Ticking player

java.lang.NullPointerException: Ticking player
at minecraftplaye.primevalforest.common.tileentities.TileEntityCampFire.isUseableByPlayer(TileEntityCampFire.java:210)
at minecraftplaye.primevalforest.client.inventory.ContainerCampfire.canInteractWith(ContainerCampfire.java:150)
at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27)
at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:381)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:343)
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:334)
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)


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

-- Head --
Stacktrace:
at minecraftplaye.primevalforest.common.tileentities.TileEntityCampFire.isUseableByPlayer(TileEntityCampFire.java:210)
at minecraftplaye.primevalforest.client.inventory.ContainerCampfire.canInteractWith(ContainerCampfire.java:150)
at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27)
at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:381)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:343)

-- Player being ticked --
Details:
Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
Entity ID: 256
Entity Name: Gamer_ABC
Entity's Exact location: 223,08, 69,00, 350,50
Entity's Block location: World: (223,69,350), Chunk: (at 15,4,14 in 13,21; contains blocks 208,0,336 to 223,255,351), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Entity's Momentum: 0,00, -0,08, 0,00
Stacktrace:
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:334)
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@596d841a
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_65, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 283378288 bytes (270 MB) / 749731840 bytes (715 MB) up to 3810525184 bytes (3634 MB)
JVM Flags: 0 total; 
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.84.1217 Minecraft Forge 10.13.1.1217 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{7.10.84.1217} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.1.1217.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.1.1217} [Minecraft Forge] (forgeSrc-1.7.10-10.13.1.1217.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
primevalforest{@VERSION@} [Primeval Forest] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
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['Gamer_ABC'/256, l='World', x=223,08, y=69,00, z=350,50]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

So the "furnace" should only be burning if there is wood in it and if you did a right click with an flient and steel.

 

The block code:

 

@Override
    public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) 
{
	if(world.isRemote)
		return;

	if(!player.isSneaking())
	{
		if(player.getCurrentEquippedItem().getItem() == Items.flint_and_steel)
		{
			if(!world.isRaining() && !world.isThundering() && !world.canBlockSeeTheSky(x, y, z))
				setBurning(true);
			else
				setBurning(false);
		}
		else
			setBurning(false);
	}
	else
		setBurning(false);
}

 

 

The TileEntity-Code:

 

@Override
public boolean isUseableByPlayer(EntityPlayer player) 
{
	return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : (player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 14.0D && player.getCurrentEquippedItem().getItem() != Items.flint_and_steel);
}

 

 

I hope someone can help me to fix this problem...

The line of code that makes problems is the only line in the isUseableByPlayer method that I posted a few lines over this here.

 

Bektor

Developer of Primeval Forest.

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



×
×
  • Create New...

Important Information

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