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:

 

  Reveal hidden contents

 

And my entity code:

 

  Reveal hidden contents

 

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:

 

  Reveal hidden contents

 

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
  On 5/11/2015 at 3:48 AM, The_Fireplace said:

  Quote

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
  On 5/11/2015 at 3:53 AM, Abastro said:

  Quote

  Quote

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
  On 5/11/2015 at 4:01 AM, The_Fireplace said:

  Quote

  Quote

  Quote

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
  On 5/11/2015 at 4:12 AM, Abastro said:

  Quote

  Quote

  Quote

  Quote

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
  On 5/11/2015 at 4:45 AM, saxon564 said:

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
  On 5/11/2015 at 4:53 AM, saxon564 said:

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
  On 5/11/2015 at 5:20 AM, saxon564 said:

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

  Quote

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

    • Sorry for the late response, but the game opened and I made a world but it's stuck at 0% Here's the latest.log https://mclo.gs/peEb1R8 I disabled The Factory Must Grow and soulsweapons
    • Hey everyone! Two of my friends downloaded this modpack and are having an issue with the blocks loading in correctly. Grass looks like bamboo, waystones look like two barrels stacked on eachother, and wheat looks like water and stairs. What is this problem? How can we fix it? Neither of my other friends or myself had this issue. 
    • I removed Yung's cave biome mod and It wasnt in one of those biomes however the log file said the same line (([25Apr2025 21:20:15.500] [Flywheel Task Executor #5/WARN] [Embeddium-MixinTaintDetector/]: Mod(s) [oculus] are modifying Embeddium class me.jellysquid.mods.sodium.client.render.vertex.serializers.VertexSerializerRegistryImpl, which may cause instability.))
    • Note: i had a couple of ideas, but i just don't know how to execute them. The main idea was to make the new block (let's exemplify with a mixer) be essentially a clone of the mechanical mixer (different texture tho) that would have a different recipe type (instead of mixing, advanced_mixing) and i would copy all the create mod recipes and edit the processing time while also adding the tier dependent ones.
    • Hi! Before everything, thank you for even reading. I'm coming here in need of help making a few aspects for a create mod addon. It's an addon that aims to add almost the full periodic table with realistic ways of obtaining all the elements and capability of almost full automation. For what purpose? A techy armor and to go to the moon and rocky planets of the solar system. It'll have 3 different tiers of machines (mixer, millstone, crushing wheels): basic (just the normal create mod machines but renamed), advanced (25% faster and has recipes only possible for this tier and above) end elite (75% faster than basic and recipes only available for this tier). The problem is, I'm not a coder. I know less than the basics. I know how to do everything else but these machine tiers and i need some help if you can.
  • Topics

×
×
  • Create New...

Important Information

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