Posted June 8, 201510 yr 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:?]
June 8, 201510 yr I am not sure, but it might be that an explosion triggers LivingAttackEvent.. so in your condition you might want to check if the source is an explosion and if it is do nothing
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.