public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage, boolean cancelOnZeroDamage) { if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) { return false; } final EnumMap<DamageModifier, Double> modifiers = new EnumMap<DamageModifier, Double>(DamageModifier.class); final EnumMap<DamageModifier, Function<? super Double, Double>> functions = new EnumMap(DamageModifier.class); modifiers.put(DamageModifier.BASE, damage); functions.put(DamageModifier.BASE, ZERO); final EntityDamageEvent event = handleEntityDamageEvent(entity, source, modifiers, functions); if (event == null) { return false; } return event.isCancelled() || (cancelOnZeroDamage && event.getDamage() == 0); }
/** * These entities are excluded from Activation range checks. * * @param entity * @param world * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) || ( entity.activationType == 2 && config.animalActivationRange == 0 ) || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) || entity instanceof EntityHuman || entity instanceof EntityProjectile || entity instanceof EntityEnderDragon || entity instanceof EntityComplexPart || entity instanceof EntityWither || entity instanceof EntityFireball || entity instanceof EntityWeather || entity instanceof EntityTNTPrimed || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworks ) { return true; } return false; }
public CraftEnderCrystal(CraftServer server, EntityEnderCrystal entity) { super(server, entity); }
@Override public EntityEnderCrystal getHandle() { return (EntityEnderCrystal) entity; }