Jump to content

Concussion909

Members
  • Posts

    8
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Concussion909's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. This is the if statement I used to make the potion effect end at 0 if (event.entityLiving.isPotionActive(MainClass.MobDeflector)) {
  2. Not for this one, but I found a solution to it anyway
  3. Its the only patch to stop the potion effect, but it is no longer working... The potion is reaching 0:00 and then disappears from the inventory menu but the potion effect stays active... Is there any way to make the potion effect properly end after hitting 0:00
  4. Thanks for pointing out that mistake, And the EntityLivingBase was stopping at 0:00 and not ending the effect, so used the manual way... I'm still in need of a vague way of completing the task since LivingAttackEvent I think would work better for a monster to take damage (I'm new at coding in general)
  5. package net.ValkyrieMod.Events; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSource; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.ValkyrieMod.main.MainClass; import net.minecraft.entity.*; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; public class PotionEvent { @SubscribeEvent public void onEntityUpdate(LivingUpdateEvent e){ if(e.entityLiving.isPotionActive(MainClass.MobDeflector)){ if(e.entityLiving.getActivePotionEffect(MainClass.MobDeflector).getDuration() == 0){ e.entityLiving.removePotionEffect(MainClass.MobDeflector.id); return; } } else if(e.entityLiving.worldObj.rand.nextInt(30) == 0){ if (e.entity instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer) e.entity; if (e.source.getSourceOfDamage() != null && e.source.getSourceOfDamage() instanceof EntityMob); { EntityMob mob = (EntityMob) e.source.getSourceOfDamage(); }}}}}
  6. I'm trying to create a potion effect so it will give any mob which is attacking the player, damage, however the player remains unharmed from the attack. I've tried a few different ways of doing so, and none have worked so far.. I've tried to use getsourceof damage, but it refuses to recognise the e.source... Newest method I've tried else if(e.entityLiving.worldObj.rand.nextInt(30) == 0){ if (e.entity instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer) e.entity; if (e.source.getSourceOfDamage() != null && e.source.getSourceOfDamage() instanceof EntityMob); { EntityMob mob = (EntityMob) e.source.getSourceOfDamage();
×
×
  • Create New...

Important Information

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