/* * This file ("BlockWallAA.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 ellpeck.actuallyadditions.blocks.base; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockWall; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List; public class BlockWallAA extends BlockWall { private String name; private Block baseBlock; private int meta; public BlockWallAA(String name, Block base, int meta){ super(base); this.baseBlock = base; this.name = name; this.meta = meta; this.register(); } public BlockWallAA(String name, Block base){ this(name, base, 0); } 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); } } public boolean shouldAddCreative(){ return true; } protected String getBaseName(){ return this.name; } protected Class getItemBlock(){ return ItemBlockBase.class; } public EnumRarity getRarity(ItemStack stack){ return EnumRarity.common; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta){ return this.baseBlock.getIcon(side, this.meta); } @SuppressWarnings("unchecked") @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list){ list.add(new ItemStack(item, 1, 0)); } @Override public int damageDropped(int meta){ return meta; } }