Jump to content

Recommended Posts

Posted

Ok, so my ammo crashes the game when it hits an entity, but if it just hits a block, it explodes, with no issues. Here is the crash report:

 

 

[21:37:37] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: ---- Minecraft Crash Report ----

// I'm sorry, Dave.

 

Time: 5/10/15 9:37 PM

Description: Ticking entity

 

java.lang.NullPointerException: Ticking entity

at the_fireplace.unlogicii.entity.coal.EntityDestabilizedCoal.executeImpact(EntityDestabilizedCoal.java:29)

at the_fireplace.unlogicii.entity.coal.EntityCoalCommon.onImpact(EntityCoalCommon.java:92)

at net.minecraft.entity.projectile.EntityThrowable.onUpdate(EntityThrowable.java:232)

at the_fireplace.unlogicii.entity.coal.EntityCoalCommon.onUpdate(EntityCoalCommon.java:145)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2024)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)

at net.minecraft.world.World.updateEntity(World.java:1990)

at net.minecraft.world.World.updateEntities(World.java:1816)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)

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

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)

at java.lang.Thread.run(Unknown Source)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at the_fireplace.unlogicii.entity.coal.EntityDestabilizedCoal.executeImpact(EntityDestabilizedCoal.java:29)

at the_fireplace.unlogicii.entity.coal.EntityCoalCommon.onImpact(EntityCoalCommon.java:92)

at net.minecraft.entity.projectile.EntityThrowable.onUpdate(EntityThrowable.java:232)

at the_fireplace.unlogicii.entity.coal.EntityCoalCommon.onUpdate(EntityCoalCommon.java:145)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2024)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)

at net.minecraft.world.World.updateEntity(World.java:1990)

 

-- Entity being ticked --

Details:

Entity Type: ammo_destabilized_coal (the_fireplace.unlogicii.entity.coal.EntityDestabilizedCoal)

Entity ID: 257278

Entity Name: entity.ammo_destabilized_coal.name

Entity's Exact location: 601.52, 5.54, 814.80

Entity's Block location: 601.00,5.00,814.00 - World: (601,5,814), Chunk: (at 9,0,14 in 37,50; contains blocks 592,0,800 to 607,255,815), Region: (1,1; contains chunks 32,32 to 63,63, blocks 512,0,512 to 1023,255,1023)

Entity's Momentum: -0.07, -0.01, 0.42

Entity's Rider: ~~ERROR~~ NullPointerException: null

Entity's Vehicle: ~~ERROR~~ NullPointerException: null

Stacktrace:

at net.minecraft.world.World.updateEntities(World.java:1816)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)

 

-- Affected level --

Details:

Level name: New World

All players: 1 total; [EntityPlayerMP['Player531'/31, l='New World', x=602.96, y=4.00, z=807.56]]

Chunk stats: ServerChunkCache: 659 Drop: 0

Level seed: -3109142402261117194

Level generator: ID 01 - flat, ver 0. Features enabled: true

Level generator options:

Level spawn location: 499.00,4.00,814.00 - World: (499,4,814), Chunk: (at 3,0,14 in 31,50; contains blocks 496,0,800 to 511,255,815), Region: (0,1; contains chunks 0,32 to 31,63, blocks 0,0,512 to 511,255,1023)

Level time: 78902 game time, 2304 day time

Level dimension: 0

Level storage version: 0x04ABD - Anvil

Level weather: Rain time: 1 (now: false), thunder time: 1 (now: false)

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

Stacktrace:

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

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)

at java.lang.Thread.run(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_45, Oracle Corporation

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

Memory: 926310784 bytes (883 MB) / 1056309248 bytes (1007 MB) up to 2130051072 bytes (2031 MB)

JVM Flags: 3 total; -Xincgc -Xmx2048M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.10 FML v8.0.42.1338 Minecraft Forge 11.14.1.1338 5 mods loaded, 5 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{8.0.42.1338} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1338.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{11.14.1.1338} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1338.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

fireplacecore{2.2.1.0} [Fireplace Core] (fireplacecore-deobf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

unlogicii{2.0.0.1} [unLogic II] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Loaded coremods (and transformers):

Profiler Position: N/A (disabled)

Player Count: 1 / 8; [EntityPlayerMP['Player531'/31, l='New World', x=602.96, y=4.00, z=807.56]]

Type: Integrated Server (map_client.txt)

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

[21:37:37] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-05-10_21.37.36-server.txt

[21:37:37] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.

[21:37:37] [server thread/INFO]: Saving chunks for level 'New World'/Nether

[21:37:37] [server thread/INFO]: Saving chunks for level 'New World'/The End

[21:37:37] [server thread/INFO] [FML]: Unloading dimension 0

[21:37:37] [server thread/INFO] [FML]: Unloading dimension -1

[21:37:37] [server thread/INFO] [FML]: Unloading dimension 1

[21:37:37] [server thread/INFO] [FML]: Applying holder lookups

[21:37:37] [server thread/INFO] [FML]: Holder lookups applied

[21:37:37] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.

[21:37:37] [Client thread/INFO] [FML]: Server terminated.

AL lib: (EE) alc_cleanup: 1 device not closed

Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

And my entity code:

 

 

/**
* 
* @author The_Fireplace
*
*/
public class EntityDestabilizedCoal extends EntityCoalCommon {
public EntityDestabilizedCoal(World worldIn) {
	super(worldIn);
}

public EntityDestabilizedCoal(World worldIn, EntityLivingBase throwerIn)
{
	super(worldIn, throwerIn);
}

public EntityDestabilizedCoal(World worldIn, double x, double y, double z)
{
	super(worldIn, x, y, z);
}

@Override
protected void executeImpact(MovingObjectPosition mop) {
	if (mop.entityHit != null)
	{
		mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getPlayerThrower()), 3.0F);
	}
	this.worldObj.createExplosion(this, mop.getBlockPos().getX(), mop.getBlockPos().getY(), mop.getBlockPos().getZ(), 1.5F, true);
}
}

 

 

Anyone know how to fix the issue? Any help is appreciated.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Superclass:

 

public class EntityCoalCommon extends EntityThrowable implements IProjectile {
protected int xTile = -1;
protected int yTile = -1;
protected int zTile = -1;
protected Block inTile;
protected boolean inGround;
public int throwableShake;
/** The entity that threw this throwable item. */
protected EntityLivingBase thrower;
protected String throwerName;
protected int ticksInGround;
protected int ticksInAir;

public EntityCoalCommon(World worldIn) {
	super(worldIn);
	this.setSize(0.25F, 0.25F);
}

public EntityCoalCommon(World worldIn, EntityLivingBase throwerIn)
{
	super(worldIn);
	this.thrower = throwerIn;
	this.setSize(0.25F, 0.25F);
	this.setLocationAndAngles(throwerIn.posX, throwerIn.posY + throwerIn.getEyeHeight(), throwerIn.posZ, throwerIn.rotationYaw, throwerIn.rotationPitch);
	this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
	this.posY -= 0.10000000149011612D;
	this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
	this.setPosition(this.posX, this.posY, this.posZ);
	float f = 0.4F;
	this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f;
	this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f;
	this.motionY = -MathHelper.sin((this.rotationPitch + this.getInaccuracy()) / 180.0F * (float)Math.PI) * f;
	this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.getVelocity(), 1.0F);
}

public EntityCoalCommon(World worldIn, double x, double y, double z)
{
	super(worldIn, x, y, z);
	this.ticksInGround = 0;
	this.setSize(0.25F, 0.25F);
	this.setPosition(x, y, z);
}

@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
	double d1 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
	d1 *= 64.0D;
	return distance < d1 * d1;
}

@Override
protected float getVelocity()
{
	return 0.5F;
}

@Override
protected float getInaccuracy()
{
	return 0.0F;
}

@Override
protected void onImpact(MovingObjectPosition mop) {
	if (!this.worldObj.isRemote)
	{
		this.executeImpact(mop);
		this.setDead();
	}
}

protected void executeImpact(MovingObjectPosition mop) {

}

@Override
public void setThrowableHeading(double x, double y, double z,
		float velocity, float inaccuracy) {
	float f2 = MathHelper.sqrt_double(x * x + y * y + z * z);
	x /= f2;
	y /= f2;
	z /= f2;
	x += this.rand.nextGaussian() * 0.007499999832361937D * inaccuracy;
	y += this.rand.nextGaussian() * 0.007499999832361937D * inaccuracy;
	z += this.rand.nextGaussian() * 0.007499999832361937D * inaccuracy;
	x *= velocity;
	y *= velocity;
	z *= velocity;
	this.motionX = x;
	this.motionY = y;
	this.motionZ = z;
	float f3 = MathHelper.sqrt_double(x * x + z * z);
	this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
	this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, f3) * 180.0D / Math.PI);
	this.ticksInGround = 0;
}

@Override
@SideOnly(Side.CLIENT)
public void setVelocity(double x, double y, double z)
{
	this.motionX = x;
	this.motionY = y;
	this.motionZ = z;

	if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
	{
		float f = MathHelper.sqrt_double(x * x + z * z);
		this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
		this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, f) * 180.0D / Math.PI);
	}
}

@Override
public void onUpdate()
{
	this.lastTickPosX = this.posX;
	this.lastTickPosY = this.posY;
	this.lastTickPosZ = this.posZ;
	super.onUpdate();

	if (this.throwableShake > 0)
	{
		--this.throwableShake;
	}

	if (this.inGround)
	{
		if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile)
		{
			++this.ticksInGround;

			if (this.ticksInGround == 1200)
			{
				this.setDead();
			}

			return;
		}

		this.inGround = false;
		this.motionX *= this.rand.nextFloat() * 0.2F;
		this.motionY *= this.rand.nextFloat() * 0.2F;
		this.motionZ *= this.rand.nextFloat() * 0.2F;
		this.ticksInGround = 0;
		this.ticksInAir = 0;
	}
	else
	{
		++this.ticksInAir;
	}

	Vec3 vec3 = new Vec3(this.posX, this.posY, this.posZ);
	Vec3 vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
	MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
	vec3 = new Vec3(this.posX, this.posY, this.posZ);
	vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

	if (movingobjectposition != null)
	{
		vec31 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
	}

	if (!this.worldObj.isRemote)
	{
		Entity entity = null;
		List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
		double d0 = 0.0D;
		EntityLivingBase entitylivingbase = this.getPlayerThrower();

		for (int j = 0; j < list.size(); ++j)
		{
			Entity entity1 = (Entity)list.get(j);

			if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5))
			{
				float f = 0.3F;
				AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f, f, f);
				MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);

				if (movingobjectposition1 != null)
				{
					double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

					if (d1 < d0 || d0 == 0.0D)
					{
						entity = entity1;
						d0 = d1;
					}
				}
			}
		}

		if (entity != null)
		{
			movingobjectposition = new MovingObjectPosition(entity);
		}
	}

	if (movingobjectposition != null)
	{
		if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.portal)
		{
			this.setInPortal();
		}
		else
		{
			this.onImpact(movingobjectposition);
		}
	}

	this.posX += this.motionX;
	this.posY += this.motionY;
	this.posZ += this.motionZ;
	float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
	this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

	while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
	{
		this.prevRotationPitch += 360.0F;
	}

	while (this.rotationYaw - this.prevRotationYaw < -180.0F)
	{
		this.prevRotationYaw -= 360.0F;
	}

	while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
	{
		this.prevRotationYaw += 360.0F;
	}

	this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
	this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
	float f2 = 0.99F;
	float f3 = this.getGravityVelocity();

	if (this.isInWater())
	{
		for (int i = 0; i < 4; ++i)
		{
			float f4 = 0.25F;
			this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ, new int[0]);
		}

		f2 = 0.8F;
	}else{
		for (int i = 0; i < 4; ++i)
		{
			float f4 = 0.25F;
			this.worldObj.spawnParticle(EnumParticleTypes.FLAME, this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ, new int[0]);
		}

		f2 = 0.99F;
	}

	this.motionX *= f2;
	this.motionY *= f2;
	this.motionZ *= f2;
	this.motionY -= f3;
	this.setPosition(this.posX, this.posY, this.posZ);
}

@Override
protected float getGravityVelocity()
{
	return 0.001F;//0.03F
}

@Override
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
	tagCompound.setShort("xTile", (short)this.xTile);
	tagCompound.setShort("yTile", (short)this.yTile);
	tagCompound.setShort("zTile", (short)this.zTile);
	ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
	tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
	tagCompound.setByte("shake", (byte)this.throwableShake);
	tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));

	if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower instanceof EntityPlayer)
	{
		this.throwerName = this.thrower.getName();
	}

	tagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName);
}

@Override
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
	this.xTile = tagCompund.getShort("xTile");
	this.yTile = tagCompund.getShort("yTile");
	this.zTile = tagCompund.getShort("zTile");

	if (tagCompund.hasKey("inTile", )
	{
		this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
	}
	else
	{
		this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
	}

	this.throwableShake = tagCompund.getByte("shake") & 255;
	this.inGround = tagCompund.getByte("inGround") == 1;
	this.throwerName = tagCompund.getString("ownerName");

	if (this.throwerName != null && this.throwerName.length() == 0)
	{
		this.throwerName = null;
	}
}

public EntityLivingBase getPlayerThrower()
{
	if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0)
	{
		this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName);
	}

	return this.thrower;
}
}

 

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Exactly what line the NPE got out?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Exactly what line the NPE got out?

As in, the line it is pointing to in the crash report?

this.worldObj.createExplosion(this, mop.getBlockPos().getX(), mop.getBlockPos().getY(), mop.getBlockPos().getZ(), 1.5F, true);

So only two possibilities are: worldObj is null(impossible), or mop.getBlockPos() is null(also impossible)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Exactly what line the NPE got out?

As in, the line it is pointing to in the crash report?

this.worldObj.createExplosion(this, mop.getBlockPos().getX(), mop.getBlockPos().getY(), mop.getBlockPos().getZ(), 1.5F, true);

So only two possibilities are: worldObj is null(impossible), or mop.getBlockPos() is null(also impossible)

Yeah, that is why I was stumped, too. Perhaps it will help figure it out that the following file for 1.7.10 worked. https://bitbucket.org/The_Fireplace/devons-random-things/src/f24522e68bb28fd2b065836a9f564eaf30e9dbc1/src/main/java/the_fireplace/devonmod/entities/EntityChargedCoal.java?at=master

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Exactly what line the NPE got out?

As in, the line it is pointing to in the crash report?

this.worldObj.createExplosion(this, mop.getBlockPos().getX(), mop.getBlockPos().getY(), mop.getBlockPos().getZ(), 1.5F, true);

So only two possibilities are: worldObj is null(impossible), or mop.getBlockPos() is null(also impossible)

Yeah, that is why I was stumped, too. Perhaps it will help figure it out that the following file for 1.7.10 worked. https://bitbucket.org/The_Fireplace/devons-random-things/src/f24522e68bb28fd2b065836a9f564eaf30e9dbc1/src/main/java/the_fireplace/devonmod/entities/EntityChargedCoal.java?at=master

Then.. Try debugging to find exactly what is null.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Exactly what line the NPE got out?

As in, the line it is pointing to in the crash report?

this.worldObj.createExplosion(this, mop.getBlockPos().getX(), mop.getBlockPos().getY(), mop.getBlockPos().getZ(), 1.5F, true);

So only two possibilities are: worldObj is null(impossible), or mop.getBlockPos() is null(also impossible)

Yeah, that is why I was stumped, too. Perhaps it will help figure it out that the following file for 1.7.10 worked. https://bitbucket.org/The_Fireplace/devons-random-things/src/f24522e68bb28fd2b065836a9f564eaf30e9dbc1/src/main/java/the_fireplace/devonmod/entities/EntityChargedCoal.java?at=master

Then.. Try debugging to find exactly what is null.

The crash tells you what is null! It is a NPE Ticking Entity. So the entity is null, try killing the entity after you create the explosion.

Posted

The crash tells you what is null! It is a NPE Ticking Entity. So the entity is null, try killing the entity after you create the explosion.

That is just a tag on the Crash when mc crashed while updating(ticking) an entity.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

my experience while working with entities is that when you get an NPE with Ticking Entity, usually it is your entity that is null.

Oh, I didn't know that can throw NPE while ticking entity.;

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

With how I've found ticking to work, adding a method to the list of things to do seems to tick an extra time. Could just be some faulty testing, but if that is the case, then when it ticks the entity for a worldObj, it will return null because it cant find the entity so the worldObj would also be null. So even if it is talking about worldObj, it is only null because the entity is null. and because the entity is null and causing the NPE to throw, it tags Ticking Entity, if the BlockPos was null, but the entity wasnt, it should say something else. Now if I'm wrong, I'm sure one of the forum moderators will correct me, but I am speaking from all the NPEs I've has with the Ticking Entity tag.

Posted

With how I've found ticking to work, adding a method to the list of things to do seems to tick an extra time. Could just be some faulty testing, but if that is the case, then when it ticks the entity for a worldObj, it will return null because it cant find the entity so the worldObj would also be null. So even if it is talking about worldObj, it is only null because the entity is null. and because the entity is null and causing the NPE to throw, it tags Ticking Entity, if the BlockPos was null, but the entity wasnt, it should say something else. Now if I'm wrong, I'm sure one of the forum moderators will correct me, but I am speaking from all the NPEs I've has with the Ticking Entity tag.

Wait, I think you missed point, 'this' cannot be null in any time.

GC only collects the died entity only when it is not running any code.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

I can't tell if what you are doing is bad or just coding style, but know one thing:

When your throwable hits something you still have entity (not yet dead).

 

There is no need to use mop.getBlockPos() to get the x/y/z of hit, you can simply use: this.posX, this.posY, this.posZ

 

That is probably your NPE, blockPos is only when thrown entity hits actual block, for entity it's different.

 

Following code:

onImpact() is called on both server and client.

if (mop.entityHit != null)
{
// Do stuff on entity, use its x/y/z or the direct x/y/z of throwable to make "explosions" in place hit, not the center of entity.
}
else // It's block.

 

EDIT:

The point is - you can't have both blockPos and Entity - mop is either one or the other.

 

I am basing this on code:

if (entity != null) // Entity is the one found by mop inside onUpdate()
{
movingobjectposition = new MovingObjectPosition(entity); // the original mop is overriden with one with entity in constructor
}

This is the mop with entity child-constructor - it has NO BlockPos.

public MovingObjectPosition(Entity p_i45482_1_, Vec3 p_i45482_2_)
{
        this.typeOfHit = MovingObjectPosition.MovingObjectType.ENTITY;
        this.entityHit = p_i45482_1_;
        this.hitVec = p_i45482_2_;
}

I don't know for sure, but code suggest that BlockPos is null when you hit entity :D

1.7.10 is no longer supported by forge, you are on your own.

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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