jayhillx

LifeBindingEffect 02

May 10th, 2021 (edited)
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. public void performEffect(LivingEntity entity, int amplifier) {
  2. CompoundNBT entityData = entity.getPersistentData();
  3. if (!(entityData.getBoolean("lifebinding.lifeBound"))) {
  4. if (entity.isPotionActive(LifeBindingPotion.LIFE_BINDING_EFFECT.get())) {
  5. for (LivingEntity livingEntity : entity.world.getEntitiesWithinAABB(LivingEntity.class,
  6. entity.getBoundingBox().grow(3.0D))) {
  7.  
  8. if (livingEntity.isAlive() && livingEntity != entity) {
  9. if (!(livingEntity instanceof PlayerEntity)) {
  10.  
  11. entityData.putBoolean("lifebinding.lifeBound", true);
  12. livingEntity.removePotionEffect(LifeBindingPotion.LIFE_BINDING_EFFECT.get());
  13. livingEntity.getEntityWorld().playSound(null, (livingEntity).getPosition(),
  14. SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.HOSTILE, 0.5F, 1.0F);
  15. ((ServerWorld)livingEntity.world).spawnParticle(ParticleTypes.EXPLOSION, livingEntity.getPosX(),
  16. livingEntity.getPosYHeight(1.0D), livingEntity.getPosZ(), 8, 2.0D, 2.0D, 2.0D, 0.5D);
  17. }
  18. }
  19. }
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment