Jump to content
(AMC)

Minecraft mod pack created for Asterion Minecraft

This is a legacy project. Support for this project was discontinued in January 2016.

While Ginever Entertainment no longer provides any official support for this project, you may be able to find help within the wider Ginever community. For more information, feel free to ask in the forums or in our Discord server.

Sign in to follow this  
AMC-751 (Bug)

NullPointerException in EntityTippedArrow.arrowHit

Description

Had this sent to me by Tyler Bisso:

java.lang.NullPointerException: Ticking entity
	at net.minecraft.item.ItemPotion.func_77832_l(ItemPotion.java:61)
	at robbit.backcraft.entity.projectile.EntityTippedArrow.arrowHit(EntityTippedArrow.java:163)
	at net.minecraft.entity.projectile.EntityArrow.func_70071_h_(EntityArrow.java:360)
	at robbit.backcraft.entity.projectile.EntityTippedArrow.func_70071_h_(EntityTippedArrow.java:78)
	at net.minecraft.world.World.func_72866_a(World.java:2341)
	at net.minecraft.world.World.func_72870_g(World.java:2294)
	at net.minecraft.world.World.func_72939_s(World.java:2132)
	at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2147)
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1062)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:985)
	at net.minecraft.client.main.Main.main(Main.java:194)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

Related Issues

This issue is not related to any other issues

User Feedback

Recommended Comments

Tinytimrob
Issue Creator Current Assignee Project Manager Programming Lead

Posted

Marked issue as in development

Early investigation indicates the NPE was thrown when calling hasTagCompound on ItemStack which was passed into getEffects function of ItemPotion (see here lines 56-62)

	/**
	 * Returns a list of potion effects for the specified itemstack.
	 */
	public List getEffects(ItemStack p_77832_1_)
	{
		if (p_77832_1_.hasTagCompound() && p_77832_1_.getTagCompound().hasKey("CustomPotionEffects", 9))
		{

from the arrowHit function of EntityTippedArrow (see lines 158-163)

	@Override
	protected void arrowHit(EntityLivingBase living)
	{
		super.arrowHit(living);

		List effects = Items.potionitem.getEffects(potion);

This would indicate the potion variable was null. This should be impossible, since the potion variable is never replaced with null, and it is initialized to a valid stack in the entityInit function:

	@Override
	protected void entityInit()
	{
		super.entityInit();
		this.potion = new ItemStack(Items.potionitem, 1, 0);

The potion variable is never sync'd to the client, as it has no need for the data. Therefore, the only way it could be null from what I could see is if entityInit was never called, which seems unlikely, given that it's called by the constructor.

The alternative is that the tag compound is null and the NPE is being thrown by calling hasKey, but hasTagCompound only returns true if it ISN'T null, so that would seem impossible too.

Consequently, I'm not sure at all right now what would trigger this crash.

Share this comment


Link to comment
Share on other sites
Tinytimrob
Issue Creator Current Assignee Project Manager Programming Lead

Posted

Marked issue as fixed in version SNAPSHOT (b781f280de2e)

I wrapped the arrowHit function so that it only executes on server side (netsync should sync the potion effect to client) and only if potion!=null. Should fix the problem

Share this comment


Link to comment
Share on other sites
Tinytimrob
Issue Creator Current Assignee Project Manager Programming Lead

Posted

Marked issue as resolved in version Fondant 27 DEV9.4 [r5106] (7f4e6fccce4c)

Resolved in 27 DEV9.4

Share this comment


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Create a new GineverAccount today. It's easy!

Register a new account

Sign In with GineverAccount 5.1

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...