2018-03-28 05:09:10 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2019-02-10 22:57:03 +00:00
|
|
|
* Copyright (c) 2016-2019.
|
2018-03-28 05:09:10 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2019-08-24 00:31:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2019-07-21 01:04:00 +00:00
|
|
|
|
2018-03-28 05:09:10 +00:00
|
|
|
|
|
|
|
package net.minecraftforge.debug.client.model;
|
2015-12-15 18:49:19 +00:00
|
|
|
|
|
|
|
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;
|
2019-02-14 23:08:53 +00:00
|
|
|
import net.minecraft.client.renderer.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;
|
2018-06-11 01:12:46 +00:00
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
2017-06-19 22:02:18 +00:00
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
2015-12-15 18:49:19 +00:00
|
|
|
|
2019-03-23 00:33:18 +00:00
|
|
|
//@Mod(modid = MultiLayerModelTest.MODID, name = "ForgeDebugMultiLayerModel", version = MultiLayerModelTest.VERSION, acceptableRemoteVersions = "*")
|
2018-03-28 05:09:10 +00:00
|
|
|
public class MultiLayerModelTest
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
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
|
|
|
|
2019-03-23 00:33:18 +00:00
|
|
|
//@Mod.EventBusSubscriber(modid = MODID)
|
2017-06-19 22:02:18 +00:00
|
|
|
public static class Registration
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2018-06-11 01:12:46 +00:00
|
|
|
@net.minecraftforge.eventbus.api.SubscribeEvent
|
2017-06-19 22:02:18 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2018-06-11 01:12:46 +00:00
|
|
|
@net.minecraftforge.eventbus.api.SubscribeEvent
|
2017-06-19 22:02:18 +00:00
|
|
|
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
|
|
|
}
|
2019-07-21 01:04:00 +00:00
|
|
|
*/
|