mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
- Re-added achievements - Organised all imports (seemed all over the place) - Formatted all code (seemed very combined, used the TinkerStyle)
72 lines
1.7 KiB
Java
72 lines
1.7 KiB
Java
package tconstruct.blocks;
|
|
|
|
import cpw.mods.fml.relauncher.*;
|
|
import java.util.List;
|
|
import mantle.blocks.MantleBlock;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.item.*;
|
|
import net.minecraft.util.IIcon;
|
|
import tconstruct.library.TConstructRegistry;
|
|
|
|
public class TConstructBlock extends MantleBlock
|
|
{
|
|
public String[] textureNames;
|
|
public IIcon[] icons;
|
|
|
|
public TConstructBlock(Material material, float hardness, String[] tex)
|
|
{
|
|
super(material);
|
|
setHardness(hardness);
|
|
this.setCreativeTab(TConstructRegistry.blockTab);
|
|
textureNames = tex;
|
|
}
|
|
|
|
@Override
|
|
public int damageDropped (int meta)
|
|
{
|
|
return meta;
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons (IIconRegister iconRegister)
|
|
{
|
|
this.icons = new IIcon[textureNames.length];
|
|
|
|
for (int i = 0; i < this.icons.length; ++i)
|
|
{
|
|
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon (int side, int meta)
|
|
{
|
|
return meta < icons.length ? icons[meta] : icons[0];
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public int getSideTextureIndex (int side)
|
|
{
|
|
if (side == 0)
|
|
return 2;
|
|
if (side == 1)
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
// TODO getSubBlocks
|
|
@Override
|
|
public void getSubBlocks (Item block, CreativeTabs tab, List list)
|
|
{
|
|
for (int iter = 0; iter < icons.length; iter++)
|
|
{
|
|
list.add(new ItemStack(block, 1, iter));
|
|
}
|
|
}
|
|
}
|