Skip to content

Instantly share code, notes, and snippets.

@LexManos
Created June 19, 2017 20:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LexManos/86e88c591c34dfcb34845268200fbd98 to your computer and use it in GitHub Desktop.
Save LexManos/86e88c591c34dfcb34845268200fbd98 to your computer and use it in GitHub Desktop.
@ObjectHolder(CustomModelBlock.name)
public static final Block CUSTOM_MODEL_BLOCK = null;
@ObjectHolder(OBJTesseractBlock.name)
public static final Block TESSERACT_BLOCK = null;
@ObjectHolder(OBJVertexColoring1.name)
public static final Block VERTEX_COLOR_1 = null;
@ObjectHolder(OBJVertexColoring2.name)
public static final Block VERTEX_COLOR_2 = null;
@ObjectHolder(OBJDirectionBlock.name)
public static final Block DIRECTION = null;
@ObjectHolder(OBJDirectionEye.name)
public static final Block DIRECTION_EYE = null;
@ObjectHolder(OBJDynamicEye.name)
public static final Block DYNAMIC_EYE = null;
@ObjectHolder(OBJCustomDataBlock.name)
public static final Block CUSTOM_DATA = null;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
if (!ENABLED)
return;
logger = event.getModLog();
}
@Mod.EventBusSubscriber(modid = MODID)
public static class Registration
{
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event)
{
if (!ENABLED)
return;
event.getRegistry().registerAll(
new CustomModelBlock(),
new OBJTesseractBlock(),
new OBJVertexColoring1(),
new OBJVertexColoring2(),
new OBJDirectionBlock(),
//new OBJDirectionEye(),
//new OBJDynamicEye(),
new OBJCustomDataBlock()
);
GameRegistry.registerTileEntity(OBJTesseractTileEntity.class, OBJTesseractBlock.name);
GameRegistry.registerTileEntity(OBJVertexColoring2TileEntity.class, OBJVertexColoring2.name);
//GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name);
}
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event)
{
if (!ENABLED)
return;
Block[] blocks = {
CUSTOM_MODEL_BLOCK,
TESSERACT_BLOCK,
VERTEX_COLOR_1,
VERTEX_COLOR_2,
DIRECTION,
//DIRECTION_EYE,
//DYNAMIC_EYE,
CUSTOM_DATA
};
for (Block block : blocks)
event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}
@SubscribeEvent
public static void registerModels(ModelRegistryEvent event)
{
if (!ENABLED)
return;
B3DLoader.INSTANCE.addDomain(MODID.toLowerCase());
OBJLoader.INSTANCE.addDomain(MODID.toLowerCase());
Block[] blocks = {
CUSTOM_MODEL_BLOCK,
TESSERACT_BLOCK,
VERTEX_COLOR_1,
VERTEX_COLOR_2,
DIRECTION,
//DIRECTION_EYE,
//DYNAMIC_EYE,
CUSTOM_DATA
};
for (Block block : blocks)
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment