2015-12-15 21:49:19 +03:00
|
|
|
package net.minecraftforge.debug;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.block.material.Material;
|
2016-03-05 04:43:41 +03:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
2016-03-01 04:58:03 -08:00
|
|
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
2015-12-15 21:49:19 +03:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.item.Item;
|
2016-04-03 10:13:50 +03:00
|
|
|
import net.minecraft.item.ItemBlock;
|
2016-03-01 04:58:03 -08:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2016-04-03 10:13:50 +03:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-12-15 21:49:19 +03: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";
|
|
|
|
|
|
2016-04-03 10:13:50 +03:00
|
|
|
private static String blockName = "test_layer_block";
|
|
|
|
|
private static final ResourceLocation blockId = new ResourceLocation(MODID, blockName);
|
2015-12-15 21:49:19 +03:00
|
|
|
|
2016-01-02 09:59:14 +03:00
|
|
|
@SidedProxy
|
2015-12-15 21:49:19 +03:00
|
|
|
public static CommonProxy proxy;
|
|
|
|
|
|
|
|
|
|
public static class CommonProxy
|
|
|
|
|
{
|
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
|
{
|
2016-04-03 10:13:50 +03:00
|
|
|
GameRegistry.register(new Block(Material.wood)
|
2015-12-15 21:49:19 +03:00
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
setCreativeTab(CreativeTabs.tabBlock);
|
|
|
|
|
setUnlocalizedName(MODID + "." + blockName);
|
2016-04-03 10:13:50 +03:00
|
|
|
setRegistryName(blockId);
|
2015-12-15 21:49:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2016-03-05 04:43:41 +03:00
|
|
|
public boolean isOpaqueCube(IBlockState state) { return false; }
|
2015-12-15 21:49:19 +03:00
|
|
|
|
|
|
|
|
@Override
|
2016-03-05 04:43:41 +03:00
|
|
|
public boolean isFullCube(IBlockState state) { return false; }
|
2015-12-15 22:20:12 +03:00
|
|
|
|
2015-12-15 21:49:19 +03:00
|
|
|
@Override
|
2016-03-01 04:58:03 -08:00
|
|
|
public boolean canRenderInLayer(BlockRenderLayer layer)
|
2015-12-15 21:49:19 +03:00
|
|
|
{
|
2016-03-01 04:58:03 -08:00
|
|
|
return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT;
|
2015-12-15 21:49:19 +03:00
|
|
|
}
|
2016-04-03 10:13:50 +03:00
|
|
|
});
|
|
|
|
|
GameRegistry.register(new ItemBlock(Block.blockRegistry.getObject(blockId)).setRegistryName(blockId));
|
2015-12-15 21:49:19 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-02 09:59:14 +03:00
|
|
|
public static class ServerProxy extends CommonProxy {}
|
|
|
|
|
|
2015-12-15 21:49:19 +03:00
|
|
|
public static class ClientProxy extends CommonProxy
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
|
{
|
|
|
|
|
super.preInit(event);
|
2016-04-03 10:13:50 +03:00
|
|
|
ModelLoader.setCustomModelResourceLocation(Item.itemRegistry.getObject(blockId), 0, new ModelResourceLocation(blockId, "inventory"));
|
2015-12-15 21:49:19 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); }
|
|
|
|
|
}
|