Copper and Tin ore
This commit is contained in:
parent
cebb49555a
commit
46cd99cdf5
5 changed files with 151 additions and 1 deletions
124
src/main/java/techreborn/blocks/BlockOre2.java
Normal file
124
src/main/java/techreborn/blocks/BlockOre2.java
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
package techreborn.blocks;
|
||||||
|
|
||||||
|
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import reborncore.common.BaseBlock;
|
||||||
|
import reborncore.common.util.OreDrop;
|
||||||
|
import reborncore.common.util.OreDropSet;
|
||||||
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
import techreborn.init.ModBlocks;
|
||||||
|
import techreborn.items.ItemDusts;
|
||||||
|
import techreborn.items.ItemGems;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BlockOre2 extends BaseBlock implements ITexturedBlock {
|
||||||
|
|
||||||
|
public static ItemStack getOreByName(String name, int count) {
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
if (types[i].equals(name)) {
|
||||||
|
return new ItemStack(ModBlocks.ore, count, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new InvalidParameterException("The storage block " + name + " could not be found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getOreByName(String name) {
|
||||||
|
return getOreByName(name, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBlockState getBlockStateFromName(String name){
|
||||||
|
int index = -1;
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
if (types[i].equals(name)) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getStateFromMeta(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String[] types = new String[]
|
||||||
|
{"copper", "tin"};
|
||||||
|
|
||||||
|
public PropertyInteger METADATA;
|
||||||
|
|
||||||
|
public BlockOre2(Material material) {
|
||||||
|
super(material);
|
||||||
|
setUnlocalizedName("techreborn.ore2");
|
||||||
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
|
setHardness(2.0f);
|
||||||
|
setHarvestLevel("pickaxe", 2);
|
||||||
|
this.setDefaultState(this.blockState.getBaseState().withProperty(METADATA, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canSilkHarvest() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
|
return super.getPickBlock(target, world, pos, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int damageDropped(IBlockState state) {
|
||||||
|
int meta = getMetaFromState(state);
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||||
|
return "techreborn:blocks/ore/ore" + types[getMetaFromState(blockState)];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int amountOfStates() {
|
||||||
|
return types.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
|
return this.getDefaultState().withProperty(METADATA, meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state) {
|
||||||
|
return state.getValue(METADATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BlockState createBlockState() {
|
||||||
|
|
||||||
|
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
||||||
|
return new BlockState(this, METADATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -81,6 +81,7 @@ public class ModBlocks {
|
||||||
public static Block ElectricFurnace;
|
public static Block ElectricFurnace;
|
||||||
|
|
||||||
public static BlockOre ore;
|
public static BlockOre ore;
|
||||||
|
public static BlockOre2 ore2;
|
||||||
public static Block storage;
|
public static Block storage;
|
||||||
public static Block storage2;
|
public static Block storage2;
|
||||||
public static Block machineframe;
|
public static Block machineframe;
|
||||||
|
@ -156,6 +157,9 @@ public class ModBlocks {
|
||||||
|
|
||||||
ore = new BlockOre(Material.rock);
|
ore = new BlockOre(Material.rock);
|
||||||
GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore");
|
GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore");
|
||||||
|
|
||||||
|
ore2 = new BlockOre2(Material.rock);
|
||||||
|
GameRegistry.registerBlock(ore2, ItemBlockOre2.class, "techreborn.ore2");
|
||||||
|
|
||||||
storage = new BlockStorage(Material.iron);
|
storage = new BlockStorage(Material.iron);
|
||||||
GameRegistry.registerBlock(storage, ItemBlockStorage.class, "techreborn.storage");
|
GameRegistry.registerBlock(storage, ItemBlockStorage.class, "techreborn.storage");
|
||||||
|
|
|
@ -51,11 +51,16 @@ public class
|
||||||
addImplosionCompressorRecipes();
|
addImplosionCompressorRecipes();
|
||||||
addReactorRecipes();
|
addReactorRecipes();
|
||||||
addIc2Recipes();
|
addIc2Recipes();
|
||||||
|
addGrinderRecipes();
|
||||||
// DEBUG
|
// DEBUG
|
||||||
RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Items.diamond), new ItemStack(Blocks.dirt), 5, 20));
|
|
||||||
RecipeHandler.addRecipe(new ExtractorRecipe(new ItemStack(Items.diamond), new ItemStack(Blocks.dirt), 5, 20));
|
RecipeHandler.addRecipe(new ExtractorRecipe(new ItemStack(Items.diamond), new ItemStack(Blocks.dirt), 5, 20));
|
||||||
RecipeHandler.addRecipe(new CompressorRecipe(new ItemStack(Items.diamond), new ItemStack(Blocks.dirt), 5, 20));
|
RecipeHandler.addRecipe(new CompressorRecipe(new ItemStack(Items.diamond), new ItemStack(Blocks.dirt), 5, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addGrinderRecipes(){
|
||||||
|
RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore), ItemDusts.getDustByName("iron", 2), 100, 20));
|
||||||
|
RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore), ItemDusts.getDustByName("gold", 2), 100, 20));
|
||||||
|
}
|
||||||
|
|
||||||
static void addReactorRecipes(){
|
static void addReactorRecipes(){
|
||||||
FusionReactorRecipeHelper.registerRecipe(new FusionReactorRecipe(ItemCells.getCellByName("tritium"), ItemCells.getCellByName("deuterium"), ItemCells.getCellByName("helium"), 40000000, 32768, 1024));
|
FusionReactorRecipeHelper.registerRecipe(new FusionReactorRecipe(ItemCells.getCellByName("tritium"), ItemCells.getCellByName("deuterium"), ItemCells.getCellByName("helium"), 40000000, 32768, 1024));
|
||||||
|
|
15
src/main/java/techreborn/itemblocks/ItemBlockOre2.java
Normal file
15
src/main/java/techreborn/itemblocks/ItemBlockOre2.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package techreborn.itemblocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import reborncore.common.itemblock.ItemBlockBase;
|
||||||
|
import techreborn.blocks.BlockOre;
|
||||||
|
import techreborn.blocks.BlockOre2;
|
||||||
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
|
public class ItemBlockOre2 extends ItemBlockBase {
|
||||||
|
|
||||||
|
public ItemBlockOre2(Block block) {
|
||||||
|
super(ModBlocks.ore2, ModBlocks.ore2, BlockOre2.types);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -60,6 +60,8 @@ tile.techreborn.compressor.name=Compressor
|
||||||
tile.techreborn.electricfurnace.name=Electric Furnace
|
tile.techreborn.electricfurnace.name=Electric Furnace
|
||||||
tile.techreborn.machineFrame.advancedMachine.name=Advanced Machine Block
|
tile.techreborn.machineFrame.advancedMachine.name=Advanced Machine Block
|
||||||
tile.techreborn.machineFrame.machine.name=Machine Block
|
tile.techreborn.machineFrame.machine.name=Machine Block
|
||||||
|
tile.techreborn.ore2.copper.name=Copper Ore
|
||||||
|
tile.techreborn.ore2.tin.name=Tin Ore
|
||||||
|
|
||||||
#Blocks
|
#Blocks
|
||||||
tile.techreborn.rubberlog.name=Rubber Wood
|
tile.techreborn.rubberlog.name=Rubber Wood
|
||||||
|
|
Loading…
Add table
Reference in a new issue