Java Code Examples for net.minecraft.item.Item.getPropertyGetter()

The following are Jave code examples for showing how to use getPropertyGetter() of the net.minecraft.item.Item class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Backmemed   File: ItemOverride.java   Source Code and License Vote up 6 votes
boolean matchesItemStack(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase livingEntity)
{
    Item item = stack.getItem();

    for (Entry<ResourceLocation, Float> entry : this.mapResourceValues.entrySet())
    {
        IItemPropertyGetter iitempropertygetter = item.getPropertyGetter((ResourceLocation)entry.getKey());

        if (iitempropertygetter == null || iitempropertygetter.apply(stack, worldIn, livingEntity) < ((Float)entry.getValue()).floatValue())
        {
            return false;
        }
    }

    return true;
}
 
Example 2
Project: CustomWorldGen   File: ItemOverride.java   Source Code and License Vote up 6 votes
boolean matchesItemStack(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase livingEntity)
{
    Item item = stack.getItem();

    for (Entry<ResourceLocation, Float> entry : this.mapResourceValues.entrySet())
    {
        IItemPropertyGetter iitempropertygetter = item.getPropertyGetter((ResourceLocation)entry.getKey());

        if (iitempropertygetter == null || iitempropertygetter.apply(stack, worldIn, livingEntity) < ((Float)entry.getValue()).floatValue())
        {
            return false;
        }
    }

    return true;
}