001package net.minecraft.block;
002
003import java.util.Iterator;
004import java.util.List;
005import net.minecraft.block.material.Material;
006import net.minecraft.entity.Entity;
007import net.minecraft.entity.EntityLiving;
008import net.minecraft.entity.player.EntityPlayer;
009import net.minecraft.world.World;
010
011public class BlockPressurePlate extends BlockBasePressurePlate
012{
013    /** The mob type that can trigger this pressure plate. */
014    private EnumMobType triggerMobType;
015
016    protected BlockPressurePlate(int par1, String par2Str, Material par3Material, EnumMobType par4EnumMobType)
017    {
018        super(par1, par2Str, par3Material);
019        this.triggerMobType = par4EnumMobType;
020    }
021
022    protected int func_94355_d(int par1)
023    {
024        return par1 > 0 ? 1 : 0;
025    }
026
027    protected int func_94350_c(int par1)
028    {
029        return par1 == 1 ? 15 : 0;
030    }
031
032    protected int func_94351_d(World par1World, int par2, int par3, int par4)
033    {
034        List list = null;
035
036        if (this.triggerMobType == EnumMobType.everything)
037        {
038            list = par1World.getEntitiesWithinAABBExcludingEntity((Entity)null, this.func_94352_a(par2, par3, par4));
039        }
040
041        if (this.triggerMobType == EnumMobType.mobs)
042        {
043            list = par1World.getEntitiesWithinAABB(EntityLiving.class, this.func_94352_a(par2, par3, par4));
044        }
045
046        if (this.triggerMobType == EnumMobType.players)
047        {
048            list = par1World.getEntitiesWithinAABB(EntityPlayer.class, this.func_94352_a(par2, par3, par4));
049        }
050
051        if (!list.isEmpty())
052        {
053            Iterator iterator = list.iterator();
054
055            while (iterator.hasNext())
056            {
057                Entity entity = (Entity)iterator.next();
058
059                if (!entity.doesEntityNotTriggerPressurePlate())
060                {
061                    return 15;
062                }
063            }
064        }
065
066        return 0;
067    }
068}