Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. @SubscribeEvent
  2.     public static void entityGoalEvent(final EntityJoinWorldEvent event) {
  3.         Entity entity = event.getEntity();
  4.         if (entity instanceof CreeperEntity) {
  5.             CreeperEntity creeperEntity = (CreeperEntity) entity;
  6.             Set<PrioritizedGoal> targetGoals = ObfuscationReflectionHelper.getPrivateValue(GoalSelector.class,
  7.                     creeperEntity.targetSelector, "goals");
  8.             Iterator<PrioritizedGoal> i = targetGoals.iterator();
  9.             while (i.hasNext()) {
  10.                 i.next();
  11.                 i.remove();
  12.             }
  13.  
  14.             creeperEntity.targetSelector.addGoal(1, new DanceGoal(creeperEntity));
  15.             creeperEntity.targetSelector.addGoal(3, new HurtByTargetGoal(creeperEntity));
  16.             creeperEntity.addPotionEffect(new EffectInstance(Effects.GLOWING, 99999));
  17.         }
  18.     }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement