Advertisement
Scouter456

Untitled

Dec 3rd, 2022
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1.  @SubscribeEvent
  2.     public static void necklaceSummerAcornDeathPrevention(LivingDeathEvent event){
  3.         if(!(event.getEntity() instanceof Player)){
  4.             return;
  5.         }
  6.         Player player = (Player) event.getEntity();
  7.         if(player.getInventory().contains(DRItems.NECKLACEOFOAKS.get().getDefaultInstance())){
  8.             int oakNecklaceSlotId = Math.abs(player.getInventory().findSlotMatchingItem(DRItems.NECKLACEOFOAKS.get().getDefaultInstance()));
  9.             ItemStack oakNecklace = player.getInventory().getItem(oakNecklaceSlotId).copy();
  10.             if(oakNecklace.getTag().getBoolean("has_summer_acorn"))
  11.             {
  12.                 player.setHealth(4F);
  13.                 player.removeAllEffects();
  14.                 player.level.broadcastEntityEvent(player, (byte)35);
  15.                 oakNecklace.getTag().putBoolean("has_summer_acorn", false);
  16.                 oakNecklace.hurtAndBreak(1, player, null);
  17.                 event.setCanceled(true);
  18.             }
  19.  
  20.         }
  21.  
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement