Search in sources :

Example 76 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project ForestryMC by ForestryMC.

the class ItemBackpack method registerModel.

@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
    EnumBackpackType t = type == EnumBackpackType.NATURALIST ? EnumBackpackType.NORMAL : type;
    String typeTag = "backpacks/" + t.toString().toLowerCase(Locale.ENGLISH);
    models = new ModelResourceLocation[4];
    models[0] = new ModelResourceLocation("forestry:" + typeTag + "_neutral", "inventory");
    models[1] = new ModelResourceLocation("forestry:" + typeTag + "_locked", "inventory");
    models[2] = new ModelResourceLocation("forestry:" + typeTag + "_receive", "inventory");
    models[3] = new ModelResourceLocation("forestry:" + typeTag + "_resupply", "inventory");
    ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + typeTag + "_neutral"));
    ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + typeTag + "_locked"));
    ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + typeTag + "_receive"));
    ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + typeTag + "_resupply"));
    manager.registerItemModel(item, new BackpackMeshDefinition());
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) EnumBackpackType(forestry.api.storage.EnumBackpackType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 77 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project ForestryMC by ForestryMC.

the class ItemCrated method registerModel.

@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
    if (contained.isEmpty()) {
        manager.registerItemModel(item, 0);
        manager.registerItemModel(item, 1, "crate-filled");
    } else {
        ModelResourceLocation modelLocation = new ModelResourceLocation("forestry:crate-filled", "crate-filled");
        ModelLoader.setCustomModelResourceLocation(item, 0, modelLocation);
        ModelBakery.registerItemVariants(item, modelLocation);
    }
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 78 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project ForestryMC by ForestryMC.

the class ProxyRenderClient method registerFluidStateMapper.

@Override
public void registerFluidStateMapper(Block block, Fluids fluid) {
    final ModelResourceLocation fluidLocation = new ModelResourceLocation("forestry:blockforestryfluid", fluid.getTag());
    StateMapperBase ignoreState = new FluidStateMapper(fluidLocation);
    ModelLoader.setCustomStateMapper(block, ignoreState);
    ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(block), new FluidItemMeshDefinition(fluidLocation));
    ModelBakery.registerItemVariants(Item.getItemFromBlock(block), fluidLocation);
}
Also used : StateMapperBase(net.minecraft.client.renderer.block.statemap.StateMapperBase) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 79 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project TechReborn by TechReborn.

the class RegisterItemJsons method registerBlockstateMultiItem.

private static void registerBlockstateMultiItem(Item item, String variantName, String path) {
    ResourceLocation loc = new ResourceLocation("techreborn", path);
    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "type=" + variantName));
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 80 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project TechReborn by TechReborn.

the class FluidBlockModelHandler method registerFluidBlockModel.

private static void registerFluidBlockModel(BlockFluidTechReborn block) {
    String name = block.getUnlocalizedName().substring(5).toLowerCase();
    Item item = Item.getItemFromBlock(block);
    ModelResourceLocation location = new ModelResourceLocation(new ResourceLocation(ModInfo.MOD_ID.toLowerCase(), "fluids"), name);
    ModelLoader.registerItemVariants(item);
    ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {

        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return location;
        }
    });
    ModelLoader.setCustomStateMapper(block, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return location;
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) StateMapperBase(net.minecraft.client.renderer.block.statemap.StateMapperBase) Item(net.minecraft.item.Item) IBlockState(net.minecraft.block.state.IBlockState) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)320 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)129 ResourceLocation (net.minecraft.util.ResourceLocation)101 Item (net.minecraft.item.Item)55 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)52 IBlockState (net.minecraft.block.state.IBlockState)48 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)26 ArrayList (java.util.ArrayList)25 Block (net.minecraft.block.Block)21 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)20 ItemStack (net.minecraft.item.ItemStack)16 EnumFacing (net.minecraft.util.EnumFacing)13 Map (java.util.Map)12 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)11 IModel (net.minecraftforge.client.model.IModel)11 Nonnull (javax.annotation.Nonnull)10 IProperty (net.minecraft.block.properties.IProperty)9 Side (net.minecraftforge.fml.relauncher.Side)9 DefaultStateMapper (net.minecraft.client.renderer.block.statemap.DefaultStateMapper)8 RenderItem (net.minecraft.client.renderer.RenderItem)7