001package net.minecraft.block;
002
003import java.util.Iterator;
004import net.minecraft.block.material.Material;
005import net.minecraft.entity.item.EntityItem;
006import net.minecraft.util.MathHelper;
007import net.minecraft.world.World;
008
009public class BlockPressurePlateWeighted extends BlockBasePressurePlate
010{
011    private final int field_94357_a;
012
013    protected BlockPressurePlateWeighted(int par1, String par2Str, Material par3Material, int par4)
014    {
015        super(par1, par2Str, par3Material);
016        this.field_94357_a = par4;
017    }
018
019    protected int func_94351_d(World par1World, int par2, int par3, int par4)
020    {
021        int l = 0;
022        Iterator iterator = par1World.getEntitiesWithinAABB(EntityItem.class, this.func_94352_a(par2, par3, par4)).iterator();
023
024        while (iterator.hasNext())
025        {
026            EntityItem entityitem = (EntityItem)iterator.next();
027            l += entityitem.getEntityItem().stackSize;
028
029            if (l >= this.field_94357_a)
030            {
031                break;
032            }
033        }
034
035        if (l <= 0)
036        {
037            return 0;
038        }
039        else
040        {
041            float f = (float)Math.min(this.field_94357_a, l) / (float)this.field_94357_a;
042            return MathHelper.ceiling_float_int(f * 15.0F);
043        }
044    }
045
046    protected int func_94350_c(int par1)
047    {
048        return par1;
049    }
050
051    protected int func_94355_d(int par1)
052    {
053        return par1;
054    }
055
056    /**
057     * How many world ticks before ticking
058     */
059    public int tickRate(World par1World)
060    {
061        return 10;
062    }
063}