Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Concussion909

Members
  • Joined

  • Last visited

Everything posted by Concussion909

  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();

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.