Advertisement
jayhillx

LifeBindingEvents

May 3rd, 2021
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. protected final Random rand = new Random();
  2.  
  3. @SubscribeEvent
  4. public void onPlayerConsumePotion(PlayerEvent event) {
  5. PlayerEntity player = event.getPlayer();
  6.  
  7. if (player.isPotionActive(LifeBindingPotion.LIFE_BINDING_EFFECT.get())) {
  8. if (player.getServer() != null) {
  9. player.world.getClosestPlayer(player, 3.0D); {
  10.  
  11. player.removePotionEffect(LifeBindingPotion.LIFE_BINDING_EFFECT.get());
  12. player.world.addParticle(ParticleTypes.SMOKE, player.getPosX() + this.rand.nextDouble() / 2.0D,
  13. player.getPosYHeight(0.5D), player.getPosZ() + this.rand.nextDouble() / 2.0D, 0.0D, this.rand.nextDouble() / 5.0D,
  14. 0.0D);
  15.  
  16. player.world.addParticle(ParticleTypes.EXPLOSION, player.getPosX() + this.rand.nextDouble() / 2.0D,
  17. player.getPosYHeight(1.0D), player.getPosZ() + this.rand.nextDouble() / 2.0D, 0.0D, this.rand.nextDouble() / 5.0D,
  18. 0.0D);
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement