EntitySelectors .java

net.minecraft.util.EntitySelectors (class): members: selectInventories, NOT_SPECTATING, selectAnything, IS_STANDALONE, ArmoredMob. imports: IInventory.

net.minecraft.utilclass70 linescommon2.3 KB

API Surface (5)

boolean apply(Entity p_apply_1_)
boolean apply(Entity p_apply_1_)
boolean apply(Entity p_apply_1_)
boolean apply(Entity p_apply_1_)
boolean apply(Entity p_apply_1_)

Fields & Constants (4)

selectAnything
IS_STANDALONE
selectInventories
NOT_SPECTATING

Code Graph: Dependencies (7)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EntitySelectors.java70 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.util;
2
3
import com.google.common.base.Predicate;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.entity.EntityLiving;
6
import net.minecraft.entity.EntityLivingBase;
7
import net.minecraft.entity.item.EntityArmorStand;
8
import net.minecraft.entity.player.EntityPlayer;
9
import net.minecraft.inventory.IInventory;
10
import net.minecraft.item.ItemStack;
11
12
public final class EntitySelectors
13
{
14
    public static final Predicate<Entity> selectAnything = new Predicate<Entity>()
15
    {
16
        public boolean apply(Entity p_apply_1_)
17
        {
18
            return p_apply_1_.isEntityAlive();
19
        }
20
    };
21
    public static final Predicate<Entity> IS_STANDALONE = new Predicate<Entity>()
22
    {
23
        public boolean apply(Entity p_apply_1_)
24
        {
25
            return p_apply_1_.isEntityAlive() && p_apply_1_.riddenByEntity == null && p_apply_1_.ridingEntity == null;
26
        }
27
    };
28
    public static final Predicate<Entity> selectInventories = new Predicate<Entity>()
29
    {
30
        public boolean apply(Entity p_apply_1_)
31
        {
32
            return p_apply_1_ instanceof IInventory && p_apply_1_.isEntityAlive();
33
        }
34
    };
35
    public static final Predicate<Entity> NOT_SPECTATING = new Predicate<Entity>()
36
    {
37
        public boolean apply(Entity p_apply_1_)
38
        {
39
            return !(p_apply_1_ instanceof EntityPlayer) || !((EntityPlayer)p_apply_1_).isSpectator();
40
        }
41
    };
42
43
    public static class ArmoredMob implements Predicate<Entity>
44
    {
45
        private final ItemStack armor;
46
47
        public ArmoredMob(ItemStack armor)
48
        {
49
            this.armor = armor;
50
        }
51
52
        public boolean apply(Entity p_apply_1_)
53
        {
54
            if (!p_apply_1_.isEntityAlive())
55
            {
56
                return false;
57
            }
58
            else if (!(p_apply_1_ instanceof EntityLivingBase))
59
            {
60
                return false;
61
            }
62
            else
63
            {
64
                EntityLivingBase entitylivingbase = (EntityLivingBase)p_apply_1_;
65
                return entitylivingbase.getEquipmentInSlot(EntityLiving.getArmorPosition(this.armor)) != null ? false : (entitylivingbase instanceof EntityLiving ? ((EntityLiving)entitylivingbase).canPickUpLoot() : (entitylivingbase instanceof EntityArmorStand ? true : entitylivingbase instanceof EntityPlayer));
66
            }
67
        }
68
    }
69
}
70

Deobfuscated MCP 1.8.9 source of EntitySelectors from Marcelektro/MavenMCP-1.8.9 (net/minecraft/util/EntitySelectors.java), stored verbatim.