2014-09-27 03:31:58 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
|
* Copyright (c) 2012 cpw.
|
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
|
* are made available under the terms of the GNU Public License v3.0
|
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
|
* http://www.gnu.org/licenses/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* Contributors:
|
|
|
|
|
* cpw - initial API and implementation
|
|
|
|
|
******************************************************************************/
|
2014-09-26 01:40:09 +02:00
|
|
|
package cpw.mods.ironchest.client;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.client.Minecraft;
|
2014-09-27 03:31:58 +02:00
|
|
|
import net.minecraft.client.renderer.ItemModelMesher;
|
2014-09-26 01:40:09 +02:00
|
|
|
import net.minecraft.client.resources.model.ModelResourceLocation;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public class ModelHelper
|
|
|
|
|
{
|
2014-09-27 03:31:58 +02:00
|
|
|
public static void registerItem(Item item, int metadata, String itemName)
|
2014-09-26 01:40:09 +02:00
|
|
|
{
|
2014-09-27 03:31:58 +02:00
|
|
|
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
|
|
|
|
mesher.register(item, metadata, new ModelResourceLocation(itemName, "inventory"));
|
2014-09-26 01:40:09 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-27 03:31:58 +02:00
|
|
|
public static void registerBlock(Block block, int metadata, String blockName)
|
2014-09-26 01:40:09 +02:00
|
|
|
{
|
2014-09-27 03:31:58 +02:00
|
|
|
registerItem(Item.getItemFromBlock(block), metadata, blockName);
|
2014-09-26 01:40:09 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-27 03:31:58 +02:00
|
|
|
public static void registerBlock(Block block, String blockName)
|
2014-09-26 01:40:09 +02:00
|
|
|
{
|
2014-09-27 03:31:58 +02:00
|
|
|
registerBlock(block, 0, blockName);
|
2014-09-26 01:40:09 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-27 03:31:58 +02:00
|
|
|
public static void registerItem(Item item, String itemName)
|
2014-09-26 01:40:09 +02:00
|
|
|
{
|
2014-09-27 03:31:58 +02:00
|
|
|
registerItem(item, 0, itemName);
|
2014-09-26 01:40:09 +02:00
|
|
|
}
|
|
|
|
|
}
|