2015-12-15 18:49:19 +00:00
|
|
|
package net.minecraftforge.debug;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
2016-03-01 12:58:03 +00:00
|
|
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
2015-12-15 18:49:19 +00:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.Item;
|
2016-03-01 12:58:03 +00:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2015-12-15 18:49:19 +00:00
|
|
|
import net.minecraftforge.client.model.ModelLoader;
|
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
|
|
|
import net.minecraftforge.fml.common.SidedProxy;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
|
|
|
|
|
|
@Mod(modid = MultiLayerModelDebug.MODID, version = MultiLayerModelDebug.VERSION)
|
|
|
|
public class MultiLayerModelDebug
|
|
|
|
{
|
|
|
|
public static final String MODID = "forgedebugmultilayermodel";
|
|
|
|
public static final String VERSION = "0.0";
|
|
|
|
|
|
|
|
public static String blockName = "test_layer_block";
|
|
|
|
|
2016-01-02 06:59:14 +00:00
|
|
|
@SidedProxy
|
2015-12-15 18:49:19 +00:00
|
|
|
public static CommonProxy proxy;
|
|
|
|
|
|
|
|
public static class CommonProxy
|
|
|
|
{
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
{
|
|
|
|
GameRegistry.registerBlock(new Block(Material.wood)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setCreativeTab(CreativeTabs.tabBlock);
|
|
|
|
setUnlocalizedName(MODID + "." + blockName);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isOpaqueCube() { return false; }
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isFullCube() { return false; }
|
2015-12-15 19:20:12 +00:00
|
|
|
|
2015-12-15 18:49:19 +00:00
|
|
|
@Override
|
2016-03-01 12:58:03 +00:00
|
|
|
public boolean canRenderInLayer(BlockRenderLayer layer)
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2016-03-01 12:58:03 +00:00
|
|
|
return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT;
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|
|
|
|
}, blockName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-02 06:59:14 +00:00
|
|
|
public static class ServerProxy extends CommonProxy {}
|
|
|
|
|
2015-12-15 18:49:19 +00:00
|
|
|
public static class ClientProxy extends CommonProxy
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
{
|
|
|
|
super.preInit(event);
|
|
|
|
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); }
|
|
|
|
}
|