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

The following are Jave code examples for showing how to use hasCustomProperties() 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.
+ Save this method
Example 1
Project: Backmemed   File: RenderItem.java   View Source Code Vote up 6 votes
public IBakedModel getItemModelWithOverrides(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entitylivingbaseIn)
{
    IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
    Item item = stack.getItem();

    if (Config.isCustomItems() && item != null && item.hasCustomProperties())
    {
        this.modelLocation = ibakedmodel.getOverrides().applyOverride(stack, worldIn, entitylivingbaseIn);
    }

    if (Reflector.ForgeItemOverrideList_handleItemState.exists())
    {
        return (IBakedModel)Reflector.call(ibakedmodel.getOverrides(), Reflector.ForgeItemOverrideList_handleItemState, new Object[] {ibakedmodel, stack, worldIn, entitylivingbaseIn});
    }
    else if (item != null && item.hasCustomProperties())
    {
        ResourceLocation resourcelocation = ibakedmodel.getOverrides().applyOverride(stack, worldIn, entitylivingbaseIn);
        return resourcelocation == null ? ibakedmodel : this.itemModelMesher.getModelManager().getModel(new ModelResourceLocation(resourcelocation, "inventory"));
    }
    else
    {
        return ibakedmodel;
    }
}
 
Example 2
Project: Backmemed   File: ModelBakery.java   View Source Code Vote up 5 votes
private void loadItemModels()
{
    this.registerVariantNames();

    for (Item item : Item.REGISTRY)
    {
        for (String s : this.getVariantNames(item))
        {
            ResourceLocation resourcelocation = this.getItemLocation(s);
            ResourceLocation resourcelocation1 = (ResourceLocation)Item.REGISTRY.getNameForObject(item);
            this.loadItemModel(s, resourcelocation, resourcelocation1);

            if (item.hasCustomProperties())
            {
                ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);

                if (modelblock != null)
                {
                    for (ResourceLocation resourcelocation2 : modelblock.getOverrideLocations())
                    {
                        this.loadItemModel(resourcelocation2.toString(), resourcelocation2, resourcelocation1);
                    }
                }
            }
        }
    }
}
 
Example 3
Project: CustomWorldGen   File: ModelBakery.java   View Source Code Vote up 5 votes
protected void loadItemModels()
{
    this.registerVariantNames();

    for (Item item : Item.REGISTRY)
    {
        for (String s : this.getVariantNames(item))
        {
            ResourceLocation resourcelocation = this.getItemLocation(s);
            ResourceLocation resourcelocation1 = (ResourceLocation)Item.REGISTRY.getNameForObject(item);
            this.loadItemModel(s, resourcelocation, resourcelocation1);

            if (item.hasCustomProperties())
            {
                ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);

                if (modelblock != null)
                {
                    for (ResourceLocation resourcelocation2 : modelblock.getOverrideLocations())
                    {
                        this.loadItemModel(resourcelocation2.toString(), resourcelocation2, resourcelocation1);
                    }
                }
            }
        }
    }
}