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
|
|
|
*/
|
|
|
|
|
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;
|
2019-12-27 21:30:16 +00:00
|
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
|
|
|
import net.minecraft.item.BlockItem;
|
2015-12-15 18:49:19 +00:00
|
|
|
import net.minecraft.item.Item;
|
2019-12-27 21:30:16 +00:00
|
|
|
import net.minecraft.item.ItemGroup;
|
2016-04-03 07:13:50 +00:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
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;
|
2019-12-27 21:30:16 +00:00
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
|
|
|
import net.minecraftforge.registries.ObjectHolder;
|
2015-12-15 18:49:19 +00:00
|
|
|
|
2019-12-27 21:30:16 +00:00
|
|
|
@Mod(MultiLayerModelTest.MODID)
|
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-12-27 21:30:16 +00:00
|
|
|
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
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(
|
2020-02-26 03:45:14 +00:00
|
|
|
new Block(Block.Properties.create(Material.WOOD).notSolid())
|
2015-12-15 18:49:19 +00:00
|
|
|
{
|
2019-12-27 21:30:16 +00:00
|
|
|
}.setRegistryName(blockId)
|
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
|
|
|
{
|
2019-12-27 21:30:16 +00:00
|
|
|
if (!ENABLED)
|
|
|
|
return;
|
|
|
|
event.getRegistry().register(new BlockItem(TEST_BLOCK, new Item.Properties().group(ItemGroup.MISC)).setRegistryName(TEST_BLOCK.getRegistryName()));
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|
|
|
|
|
2019-12-27 21:30:16 +00:00
|
|
|
@net.minecraftforge.eventbus.api.SubscribeEvent
|
|
|
|
public static void clientSetup(FMLClientSetupEvent event)
|
2017-06-19 22:02:18 +00:00
|
|
|
{
|
|
|
|
if (!ENABLED)
|
|
|
|
return;
|
2019-12-27 21:30:16 +00:00
|
|
|
RenderTypeLookup.setRenderLayer(TEST_BLOCK, (layer) -> {
|
2020-02-26 03:45:14 +00:00
|
|
|
return layer == RenderType.getSolid() || layer == RenderType.getTranslucent();
|
2019-12-27 21:30:16 +00:00
|
|
|
});
|
2017-06-19 22:02:18 +00:00
|
|
|
}
|
2017-05-29 09:10:40 +00:00
|
|
|
}
|
2015-12-15 18:49:19 +00:00
|
|
|
}
|