Java Code Examples for net.minecraftforge.fml.common.registry.GameRegistry#registerBlock()

The following examples show how to use net.minecraftforge.fml.common.registry.GameRegistry#registerBlock() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void registerNovaBlock(BlockFactory blockFactory) {
	FWBlock blockWrapper = new FWBlock(blockFactory);
	blockFactoryMap.put(blockFactory, blockWrapper);
	String blockId = blockFactory.getID();
	if (!blockId.contains(":"))
		blockId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + blockId;
	GameRegistry.registerBlock(blockWrapper, FWItemBlock.class, blockId);
	NovaMinecraft.proxy.postRegisterBlock(blockWrapper);

	if (blockWrapper.dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
		//Add into creative tab
		Category category = blockWrapper.dummy.components.get(Category.class);
		blockWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, blockWrapper));
	}

	Game.logger().info("Registered block: {}", blockFactory.getID());
}
 
Example 2
Source File: Fluids.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static BlockFluidBase registerFluidBlock(Fluid f, BlockFluidBase block, String name) {
	block.setUnlocalizedName(BaseMetals.MODID+"."+name);
	GameRegistry.registerBlock(block, name);
	block.setCreativeTab(CreativeTabs.MISC);
	FluidRegistry.addBucketForFluid(f);
	fluidBlocks.put(f, block);
	fluidBlockNames.put(block, name);
	return block;
}
 
Example 3
Source File: Mobycraft.java    From mobycraft with Apache License 2.0 4 votes vote down vote up
private void registerBlock(Block block, String name) {
	GameRegistry.registerBlock(block, name);
	mesher.register(Item.getItemFromBlock(block), 0,
			new ModelResourceLocation("moby:" + name, "inventory"));
}
 
Example 4
Source File: TeleportBlocks.java    From ModdingTutorials with GNU General Public License v2.0 4 votes vote down vote up
public static void register()
{
	GameRegistry.registerBlock(coord_transporter, coord_transporter.getUnlocalizedName().substring(5));
}
 
Example 5
Source File: TeleportBlocks.java    From ModdingTutorials with GNU General Public License v2.0 4 votes vote down vote up
public static void register()
{
	GameRegistry.registerBlock(coord_transporter, coord_transporter.getUnlocalizedName().substring(5));
}