ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/blocks/base/BlockBase.java
2015-12-30 22:02:17 +01:00

59 lines
1.6 KiB
Java

/*
* This file ("BlockBase.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
*
* © 2015 Ellpeck
*/
package de.ellpeck.actuallyadditions.blocks.base;
import cpw.mods.fml.common.registry.GameRegistry;
import de.ellpeck.actuallyadditions.creative.CreativeTab;
import de.ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
public class BlockBase extends Block{
private String name;
public BlockBase(Material material, String name){
super(material);
this.name = name;
this.register();
}
private void register(){
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
}
protected String getBaseName(){
return this.name;
}
protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class;
}
public boolean shouldAddCreative(){
return true;
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.common;
}
}