Added all gtechs ores

This commit is contained in:
Gig 2015-04-11 16:21:49 +01:00
parent 2281511a20
commit e87908dc03
4 changed files with 107 additions and 0 deletions

View file

@ -1,6 +1,8 @@
package techreborn;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockQuantumChest;
import techreborn.blocks.BlockQuantumTank;
import techreborn.blocks.BlockThermalGenerator;
@ -9,6 +11,7 @@ import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileQuantumTank;
import net.minecraft.item.Item;
import techreborn.itemblocks.ItemBlockOre;
import techreborn.items.ItemDusts;
import techreborn.tiles.TileThermalGenerator;
import cpw.mods.fml.common.Mod;
@ -22,6 +25,7 @@ public class Core {
public static Block thermalGenerator;
public static Block quantumTank;
public static Block quantumChest;
public static Block ore;
public static Item dusts;
@ -42,6 +46,9 @@ public class Core {
quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance);
GameRegistry.registerBlock(quantumChest, "techreborn.quantumChest");
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
ore = new BlockOre(Material.rock);
GameRegistry.registerBlock(ore, ItemBlockOre.class, "ore");
dusts = new ItemDusts();
GameRegistry.registerItem(dusts, "dust");

View file

@ -0,0 +1,84 @@
package techreborn.blocks;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import techreborn.client.TechRebornCreativeTab;
import ic2.core.coremod.Setup;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockOre extends Block{
public static final String[] types = new String[]
{
"Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar", "Sphalerite",
"Tungston","Sheldonite", "Olivine", "Sodalite"
};
private IIcon[] textures;
public BlockOre(Material material)
{
super(material);
setBlockName("ore");
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(1f);
}
@Override
public Item getItemDropped(int par1, Random random, int par2)
{
return Item.getItemFromBlock(this);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
{
for (int meta = 0; meta < types.length; meta++) {
list.add(new ItemStack(item, 1, meta));
}
}
@Override
public int damageDropped(int metaData)
{
return metaData;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) {
textures[i] = iconRegister.registerIcon("cbmreborn:" + types[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metaData)
{
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
return textures[metaData];
} else {
return textures[metaData];
}
}
}

View file

@ -0,0 +1,15 @@
package techreborn.itemblocks;
import techreborn.Core;
import techreborn.blocks.BlockOre;
import net.minecraft.block.Block;
import net.minecraft.item.ItemMultiTexture;
public class ItemBlockOre extends ItemMultiTexture{
public ItemBlockOre(Block block)
{
super(Core.ore, Core.ore, BlockOre.types);
}
}

View file

@ -8,6 +8,7 @@ public class ItemTR extends Item{
public ItemTR()
{
setNoRepair();
setCreativeTab(TechRebornCreativeTab.instance);
}