Jump to content

[1.8] [SOLVED] createExplosion results in an endless loop


Ferrettomato

Recommended Posts

I'm attempting to create an explosion in the world when LivingAttackEvent is triggered and certain criteria are met, but, when said criteria are met, the console spams the debug println and subsequently spits out an apparently endless error message that repeats the same few lines. Could someone please explain what's wrong with this?

 

The event (with unrelated parts omitted):

@SubscribeEvent
public void onHit(LivingAttackEvent event)
{
	if(event.entityLiving instanceof EntityPlayer)
	{
		if(event.source.getSourceOfDamage() != null)
		{
			if(event.entityLiving.getCurrentArmor(2) != null)
			{
				if(event.entityLiving.getCurrentArmor(2).getItem() instanceof ItemInlayArmor)
				{
					ItemStack armor = event.entityLiving.getCurrentArmor(2);
					if(armor.hasTagCompound())
					{
						if(armor.getTagCompound().getString("id").equals("minecraft:gunpowder"))
						{
							System.out.println("BANG!");
							event.entityLiving.worldObj.createExplosion(event.source.getSourceOfDamage(), event.source.getSourceOfDamage().posX, event.source.getSourceOfDamage().posY, event.source.getSourceOfDamage().posZ, 1F, true);
						}

One section of the repeating error:

at com.ferret.relics.handlers.RelicEventHandler.onHit(RelicEventHandler.java:120) ~[RelicEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_11_RelicEventHandler_onHit_LivingAttackEvent.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?]
at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:341) ~[ForgeHooks.class:?]
at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1125) ~[EntityPlayer.class:?]
at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:594) ~[EntityPlayerMP.class:?]
at net.minecraft.world.Explosion.doExplosionA(Explosion.java:166) ~[Explosion.class:?]
at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:1087) ~[WorldServer.class:?]
at net.minecraft.world.World.createExplosion(World.java:2362) ~[World.class:?]
at com.ferret.relics.handlers.RelicEventHandler.onHit(RelicEventHandler.java:120) ~[RelicEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_11_RelicEventHandler_onHit_LivingAttackEvent.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?]
at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:341) ~[ForgeHooks.class:?]
at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1125) ~[EntityPlayer.class:?]
at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:594) ~[EntityPlayerMP.class:?]
at net.minecraft.world.Explosion.doExplosionA(Explosion.java:166) ~[Explosion.class:?]
at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:1087) ~[WorldServer.class:?]
at net.minecraft.world.World.createExplosion(World.java:2362) ~[World.class:?]

Link to comment
Share on other sites

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.