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

24 lines
844 B
Java
Raw Normal View History

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 net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
2015-03-29 15:29:05 +02:00
public class BlockUtil{
public static String createUnlocalizedName(Block block){
return ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName();
}
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab){
2015-06-28 21:28:58 +02:00
block.setCreativeTab(addTab ? CreativeTab.instance : null);
block.setBlockName(createUnlocalizedName(block));
GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName());
2015-03-29 15:29:05 +02:00
}
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
2015-05-20 22:39:43 +02:00
register(block, itemBlock, true);
}
2015-03-29 15:29:05 +02:00
}