ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java

35 lines
1.2 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
* This file ("BlockUtil.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* <EFBFBD> 2015 Ellpeck
*/
2015-03-29 15:29:05 +02:00
package ellpeck.actuallyadditions.util;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.creative.CreativeTab;
import ellpeck.actuallyadditions.items.ItemBlockBase;
2015-03-29 15:29:05 +02:00
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
2015-03-29 15:29:05 +02:00
public class BlockUtil{
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
2015-10-25 14:30:59 +01:00
block.setCreativeTab(CreativeTab.instance);
block.setBlockName(createUnlocalizedName(block));
GameRegistry.registerBlock(block, itemBlock, ((IActAddItemOrBlock)block).getName());
2015-03-29 15:29:05 +02:00
}
2015-10-03 10:19:40 +02:00
public static String createUnlocalizedName(Block block){
return ModUtil.MOD_ID_LOWER+"."+((IActAddItemOrBlock)block).getName();
2015-05-20 22:39:43 +02:00
}
2015-10-23 16:54:33 +02:00
public static void register(Block block){
2015-10-25 14:30:59 +01:00
register(block, ItemBlockBase.class);
2015-10-23 16:54:33 +02:00
}
2015-03-29 15:29:05 +02:00
}