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-04-04 05:20:19 +02:00
|
|
|
|
2015-03-29 15:29:05 +02:00
|
|
|
public class BlockUtil{
|
|
|
|
|
|
|
|
public static String createUnlocalizedName(Block block){
|
2015-04-04 05:20:19 +02:00
|
|
|
return ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName();
|
|
|
|
}
|
|
|
|
|
2015-07-02 10:45:15 +02:00
|
|
|
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);
|
2015-04-04 05:20:19 +02:00
|
|
|
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
|
|
|
}
|