Greenadine

CustomEntityBat.java

Sep 17th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package me.greenadine.scarecrow.nms;
  2.  
  3.  
  4. import org.bukkit.entity.ArmorStand;
  5.  
  6. import com.google.common.base.Predicate;
  7.  
  8. import me.greenadine.scarecrow.Main;
  9. import net.minecraft.server.v1_12_R1.Entity;
  10. import net.minecraft.server.v1_12_R1.EntityCreature;
  11. import net.minecraft.server.v1_12_R1.World;
  12.  
  13. public class CustomEntityBat<T extends Entity> extends EntityCreature {
  14.    
  15.     @SuppressWarnings({ "unchecked", "rawtypes" })
  16.     public CustomEntityBat(World world, Main main)
  17.     {
  18.         super(world);
  19.        
  20.         this.goalSelector.a(new PathfinderGoalAvoidScarecrow(this, super.world, super.navigation, super.getBoundingBox(),  8.0F, 0.6D, 0.6D, (Class<T>) CustomEntityBat.class, super.lastX, super.lastY, super.lastZ
  21.                 , new Predicate<Entity>() {
  22.             @SuppressWarnings("unlikely-arg-type")
  23.             public boolean apply(Entity paramT) {
  24.                 if(paramT instanceof ArmorStand) {
  25.                     ArmorStand am = (ArmorStand) paramT;
  26.                     if(main.getScarecrows().contains(am)) {
  27.                         return true;
  28.                     } else {
  29.                         return false;
  30.                     }
  31.                 } else {
  32.                     return false;
  33.                 }
  34.             }
  35.         }));
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment