Jump to content

Recommended Posts

Posted

I am creating a spike block, but the game will crash suddenly. The crash logs have been somewhat unhelpful as the entity being ticked is not the entity damaged by the spikes. Any help would be appreciated.

 

 

Crash Report:

 

 

---- Minecraft Crash Report ----
// I let you down. Sorry 

Time: 2/3/14 9:18 AM
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
at net.minecraft.entity.Entity.moveEntity(Entity.java:758)
at net.minecraft.entity.EntityLivingBase.moveEntityWithHeading(EntityLivingBase.java:1725)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2063)
at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:451)
at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:138)
at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:56)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856)
at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:270)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2257)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:699)
at net.minecraft.world.World.updateEntity(World.java:2217)
at net.minecraft.world.World.updateEntities(World.java:2067)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:530)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:739)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)


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

-- Head --
Stacktrace:
at net.minecraft.entity.Entity.moveEntity(Entity.java:758)
at net.minecraft.entity.EntityLivingBase.moveEntityWithHeading(EntityLivingBase.java:1725)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2063)
at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:451)
at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:138)
at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:56)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856)
at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:270)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2257)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:699)
at net.minecraft.world.World.updateEntity(World.java:2217)

-- Entity being ticked --
Details:
Entity Type: Cow (net.minecraft.entity.passive.EntityCow)
Entity ID: 37
Entity Name: Cow
Entity's Exact location: -290.29, 73.00, 291.33
Entity's Block location: World: (-291,73,291), Chunk: (at 13,4,3 in -19,18; contains blocks -304,0,288 to -289,255,303), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity's Momentum: 0.00, -0.08, 0.00
Stacktrace:
at net.minecraft.world.World.updateEntities(World.java:2067)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:530)

-- Affected level --
Details:
Level name: Dev
All players: 1 total; [EntityPlayerMP['Player688'/198, l='Dev', x=-209.25, y=79.00, z=257.82]]
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: 6914035959553019192
Level generator: ID 00 - default, ver 1. Features enabled: true
Level generator options: 
Level spawn location: World: (-216,64,256), Chunk: (at 8,4,0 in -14,16; contains blocks -224,0,256 to -209,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 772 game time, 772 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 164816 (now: false), thunder time: 131710 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:739)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)

-- System Details --
Details:
Minecraft Version: 1.7.2
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: 838589000 bytes (799 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 6555 (367080 bytes; 0 MB) allocated, 420 (23520 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.01-pre FML v7.2.112.1023 Minecraft Forge 10.12.0.1023 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.112.1023} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1023.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.0.1023} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1023.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
strongholdcraft{0.0.1} [strongholdCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 1055 (59080 bytes; 0 MB) allocated, 51 (2856 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player688'/198, l='Dev', x=-209.25, y=79.00, z=257.82]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

 

 

BlockSpikes:

 

 

package strongholdCraft.common.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import strongholdCraft.StrongholdCraft;
import strongholdCraft.common.render.SpikeInventoryRenderer;
import strongholdCraft.common.tileEntities.TileEntitySpike;

import com.mojang.authlib.GameProfile;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockSpikes extends BlockContainer{
@SideOnly(Side.CLIENT)
private IIcon field_150041_a;
@SideOnly(Side.CLIENT)
private IIcon field_150040_b;

//TODO add different tiers of spike

public BlockSpikes(){
	super(Material.field_151573_f);
	//this.func_149711_c(5.0F);
	this.func_149647_a(StrongholdCraft.tabStrongholdCraft);
}
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
	float f = 0.125F;
	return AxisAlignedBB.getAABBPool().getAABB((double)p_149668_2_+f, (double)p_149668_3_, (double)p_149668_4_+f, (double)(p_149668_2_+1)-f, (double)(p_149668_3_+1)-f, (double)(p_149668_4_+1)-f);
}

@SideOnly(Side.CLIENT)
public IIcon func_149691_a(int p_149691_1_, int p_149691_2_)
{
	return p_149691_1_ == 1 ? this.field_150041_a : (p_149691_1_ == 0 ? this.field_150040_b : this.field_149761_L);
}

public boolean func_149662_c()
{
	return false;
}



public boolean func_149727_a(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{ 
	TileEntitySpike spikeentity = (TileEntitySpike)world.func_147438_o(x,  y,  z);

	System.out.println(spikeentity.getCurrentDurability());
	super.func_149727_a(world, x, y, z, player, side, hitX, hitY, hitZ);
	return true;
}



public int func_149645_b()
{
	return SpikeInventoryRenderer.myRenderID;
}


public void func_149670_a(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_)
{
	if(p_149670_5_ instanceof EntityLivingBase){
		TileEntitySpike spikeentity = (TileEntitySpike)p_149670_1_.func_147438_o(p_149670_2_,  p_149670_3_,  p_149670_4_);

		double i = ((EntityLivingBase) p_149670_5_).getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
		((EntityLivingBase) p_149670_5_).getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(10000000D);
		if(p_149670_5_.attackEntityFrom(DamageSource.causePlayerDamage(new FakePlayer(FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(0), new GameProfile("", "Spikes"))), 1.0F)){
			spikeentity.damageSpike(1);
			if(spikeentity.getCurrentDurability() <= 0){
				 Minecraft.getMinecraft().theWorld.playAuxSFX(2001, p_149670_2_, p_149670_3_, p_149670_4_, Block.func_149682_b(Minecraft.getMinecraft().theWorld.func_147439_a(p_149670_2_, p_149670_3_, p_149670_4_)) + (Minecraft.getMinecraft().theWorld.getBlockMetadata(p_149670_2_, p_149670_3_, p_149670_4_) << 12));
				this.removedByPlayer(p_149670_1_, null, p_149670_2_, p_149670_3_, p_149670_4_);
			}
		}
		((EntityLivingBase) p_149670_5_).getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(i);
	}
}

@SideOnly(Side.CLIENT)
public void func_149651_a(IIconRegister p_149651_1_)
{
	this.field_149761_L = p_149651_1_.registerIcon(this.func_149641_N() + "_side");
	this.field_150041_a = p_149651_1_.registerIcon(this.func_149641_N() + "_top");
	this.field_150040_b = p_149651_1_.registerIcon(this.func_149641_N() + "_bottom");
}

@Override
public TileEntity func_149915_a(World var1, int var2) {
	// TODO Auto-generated method stub
	return new TileEntitySpike();
}

public boolean func_149646_a(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
   return false;
}








}

 

 

 

TileEntitySpike

 

 

package strongholdCraft.common.tileEntities;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class TileEntitySpike extends TileEntity {

public int maxDurability = 10;
public int currentDurability = maxDurability;

public void damageSpike(int damageDealt){
	this.currentDurability -= damageDealt;
}

public void setMaxDurability(int maxDurability){
	this.maxDurability = maxDurability;
	System.out.println("SetDurability:" +maxDurability +"|"+currentDurability);
}

public void setCurrentDurability(int durability){
	this.currentDurability = durability;
}

public int getMaxDurability(){
	return this.currentDurability;
}

public int getCurrentDurability() {
	return this.currentDurability;
}

public void func_145841_b(NBTTagCompound var1)
{
	var1.setInteger("maxDurability", this.maxDurability);
	var1.setInteger("currentDurability", this.currentDurability);
	System.out.println("writeNBT:" +maxDurability +"|"+currentDurability);
	super.func_145841_b(var1);
}

public void func_145839_a(NBTTagCompound var1)
{
	this.maxDurability = var1.getInteger("maxDurability");
	this.currentDurability = var1.getInteger("currentDurability");
	System.out.println("readNBT:" +maxDurability +"|"+currentDurability);
	super.func_145839_a(var1);
}

@Override 
public Packet func_145844_m(){
	NBTTagCompound tileTag = new NBTTagCompound();
	this.func_145841_b(tileTag);
	return new S35PacketUpdateTileEntity(this.field_145851_c, this.field_145848_d, field_145849_e, 0, tileTag);
}

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
	this.func_145839_a(pkt.func_148857_g());
}
}

 

 

 

 

Posted

Hi

 

By gum obfuscated code is confusing...

 

I guess the crash occurs whenever an entity collides with the spikes?

 

I would suggest that you go to line 758 in Entity.moveEntity and see if you can figure out what object is null on that line.  In my 1.7.2 this is

 

            List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(par1, par3, par5));

            for (int i = 0; i < list.size(); ++i)
            {
                par3 = ((AxisAlignedBB)list.get(i)).calculateYOffset(this.boundingBox, par3); // line 758
            }

 

so almost certainly the getCollidingBoundingBoxes is returning a list with a null entry in it but I don't know how, it doesn't look like it should be able to.  Perhaps you could add some logging code or a breakpoint to your Block func_149668_a to see if you can figure out where the null is coming from.  It's sure not clear to me. 

 

-TGG

Posted

Try without this

Minecraft.getMinecraft().theWorld.playAuxSFX(2001, p_149670_2_, p_149670_3_, p_149670_4_, Block.func_149682_b(Minecraft.getMinecraft().theWorld.func_147439_a(p_149670_2_, p_149670_3_, p_149670_4_)) + (Minecraft.getMinecraft().theWorld.getBlockMetadata(p_149670_2_, p_149670_3_, p_149670_4_) << 12));

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.