All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.IEntitySelector Maven / Gradle / Ivy

package net.minecraft.server;

import com.google.common.base.Predicate;

public class IEntitySelector {
	
	public static final Predicate a = Entity::isAlive;
	public static final Predicate b = entity -> entity.isAlive() && entity.passenger == null && entity.vehicle == null;
	public static final Predicate c = entity -> entity instanceof IInventory && entity.isAlive();
	public static final Predicate d = entity -> !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator();
	
	public static class EntitySelectorEquipable implements Predicate {
		private final ItemStack a;
		
		public EntitySelectorEquipable(ItemStack itemstack) {
			this.a = itemstack;
		}
		
		public boolean apply(Entity entity) {
			if (!entity.isAlive()) {
				return false;
			} else if (!(entity instanceof EntityLiving)) {
				return false;
			} else {
				EntityLiving entityliving = (EntityLiving) entity;
				
				return entityliving.getEquipment(EntityInsentient.c(this.a)) == null && (entityliving instanceof EntityInsentient ? ((EntityInsentient) entityliving).canPickUpLoot() : (entityliving instanceof EntityArmorStand || entityliving instanceof EntityHuman));
			}
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy