Jump to content

Recommended Posts

Posted

I'm trying to make an item that affects entities within a radius around the player using World#getEntitiesWithinAABB and AxisAlignedBB#expand, but the game crashes whenever I try to create the List<EntityLiving> of entities to affect.

 

Here's the crash log:

[16:18:18] [Client thread/FATAL]: Reported exception thrown!
[16:32:44] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Ticking entity
at net.minecraft.world.World.updateEntities(World.java:1837) ~[World.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2176) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1080) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at com.ferret.myfirstmod.items.ItemIceMask.onArmorTick(ItemIceMask.java:85) ~[itemIceMask.class:?]
at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:358) ~[inventoryPlayer.class:?]
at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:623) ~[EntityPlayer.class:?]
at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:913) ~[EntityPlayerSP.class:?]
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1828) ~[EntityLivingBase.class:?]
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:334) ~[EntityPlayer.class:?]
at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:165) ~[EntityPlayerSP.class:?]
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031) ~[World.class:?]
at net.minecraft.world.World.updateEntity(World.java:1997) ~[World.class:?]
at net.minecraft.world.World.updateEntities(World.java:1823) ~[World.class:?]
... 12 more

And the method in question:

public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
{
	if(KeyBindings.ability.isPressed())
	{
		if(!world.getEntitiesWithinAABB(EntityLiving.class, player.getBoundingBox().expand(10, 10, 10)).isEmpty()) // the problematic line
		{
			List<EntityLiving> entities = world.getEntitiesWithinAABB(EntityLiving.class, player.getBoundingBox().expand(10, 10, 10));
			for(EntityLiving entity : entities)
			{
				if(!entity.equals(player))
				{
					entity.addPotionEffect(new PotionEffect(2, 2000, 99));
				}
			}
		}
	}
}

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.