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-05 01:43:41 +00:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
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-04-03 07:13:50 +00:00
|
|
|
import net.minecraft.item.ItemBlock;
|
2016-03-01 12:58:03 +00:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2016-04-03 07:13:50 +00:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2017-06-19 22:02:18 +00:00
|
|
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
2015-12-15 18:49:19 +00:00
|
|
|
import net.minecraftforge.client.model.ModelLoader;
|
2017-06-19 22:02:18 +00:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
2015-12-15 18:49:19 +00:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2017-06-19 22:02:18 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
2015-12-15 18:49:19 +00:00
|
|
|
|
2016-11-22 20:12:13 +00:00
|
|
|
@Mod(modid = MultiLayerModelDebug.MODID, name = "ForgeDebugMultiLayerModel", version = MultiLayerModelDebug.VERSION, acceptableRemoteVersions = "*")
|
2015-12-15 18:49:19 +00:00
|
|
|
public class MultiLayerModelDebug
|
|
|
|
{
|
2017-06-19 22:02:18 +00:00
|
|
|
private static final boolean ENABLED = true;
|
2015-12-15 18:49:19 +00:00
|
|
|
public static final String MODID = "forgedebugmultilayermodel";
|
|
|
|
public static final String VERSION = "0.0";
|
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
private static final String blockName = "test_layer_block";
|
2016-04-03 07:13:50 +00:00
|
|
|
private static final ResourceLocation blockId = new ResourceLocation(MODID, blockName);
|
2017-06-19 22:02:18 +00:00
|
|
|
@ObjectHolder(blockName)
|
|
|
|
public static final Block TEST_BLOCK = null;
|
2015-12-15 18:49:19 +00:00
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
@Mod.EventBusSubscriber(modid = MODID)
|
|
|
|
public static class Registration
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2017-06-19 22:02:18 +00:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2017-06-19 22:02:18 +00:00
|
|
|
if (!ENABLED)
|
|
|
|
return;
|
|
|
|
event.getRegistry().register(
|
|
|
|
new Block(Material.WOOD)
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2017-06-19 22:02:18 +00:00
|
|
|
{
|
|
|
|
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
|
|
|
setUnlocalizedName(MODID + "." + blockName);
|
|
|
|
setRegistryName(blockId);
|
|
|
|
}
|
2015-12-15 18:49:19 +00:00
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
@Override
|
|
|
|
public boolean isOpaqueCube(IBlockState state)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2015-12-15 18:49:19 +00:00
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
@Override
|
|
|
|
public boolean isFullCube(IBlockState state)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2015-12-15 19:20:12 +00:00
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
@Override
|
|
|
|
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
|
|
|
|
{
|
|
|
|
return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT;
|
|
|
|
}
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|
2017-06-19 22:02:18 +00:00
|
|
|
);
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerItems(RegistryEvent.Register<Item> event)
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2017-06-19 22:02:18 +00:00
|
|
|
event.getRegistry().register(new ItemBlock(TEST_BLOCK).setRegistryName(TEST_BLOCK.getRegistryName()));
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|
|
|
|
|
2017-06-19 22:02:18 +00:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerModels(ModelRegistryEvent event)
|
|
|
|
{
|
|
|
|
if (!ENABLED)
|
|
|
|
return;
|
|
|
|
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TEST_BLOCK), 0, new ModelResourceLocation(blockId, "inventory"));
|
|
|
|
}
|
2017-05-29 09:10:40 +00:00
|
|
|
}
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|