Skip to content

Commit d8e4b30

Browse files
committed
Build #7
more ores
1 parent a0c65c4 commit d8e4b30

File tree

5 files changed

+146
-16
lines changed

5 files changed

+146
-16
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.knoxhack.nethermetals.blocks;
2+
3+
import java.util.Random;
4+
5+
import net.minecraft.block.Block;
6+
import net.minecraft.block.material.Material;
7+
import net.minecraft.block.state.IBlockState;
8+
import net.minecraft.creativetab.CreativeTabs;
9+
import net.minecraft.item.Item;
10+
11+
public class ModBlockOre extends Block {
12+
13+
private Item drop;
14+
private int meta;
15+
private int least_quantity;
16+
private int most_quantity;
17+
18+
protected ModBlockOre(String unlocalizedName, Material mat, Item drop, int meta, int least_quantity, int most_quantity) {
19+
super(mat);
20+
this.drop = drop;
21+
this.meta = meta;
22+
this.least_quantity = least_quantity;
23+
this.most_quantity = most_quantity;
24+
this.setHarvestLevel("pickaxe", 1);
25+
this.setHardness(7.0f);
26+
this.setResistance(15.0f);
27+
this.setUnlocalizedName(unlocalizedName);
28+
this.setCreativeTab(CreativeTabs.tabBlock);
29+
}
30+
31+
protected ModBlockOre(String unlocalizedName, Material mat, Item drop, int least_quantity, int most_quantity) {
32+
this(unlocalizedName, mat, drop, 0, least_quantity, most_quantity);
33+
}
34+
35+
protected ModBlockOre(String unlocalizedName, Material mat, Item drop) {
36+
this(unlocalizedName, mat, drop, 1, 1);
37+
}
38+
39+
@Override
40+
public Item getItemDropped(IBlockState blockstate, Random random, int fortune) {
41+
return this.drop;
42+
}
43+
44+
@Override
45+
public int damageDropped(IBlockState blockstate) {
46+
return this.meta;
47+
}
48+
49+
@Override
50+
public int quantityDropped(IBlockState blockstate, int fortune, Random random) {
51+
if (this.least_quantity >= this.most_quantity)
52+
return this.least_quantity;
53+
return this.least_quantity + random.nextInt(this.most_quantity - this.least_quantity + fortune + 1);
54+
}
55+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.knoxhack.nethermetals.blocks;
2+
3+
import java.util.Random;
4+
5+
import net.minecraft.block.Block;
6+
import net.minecraft.block.material.Material;
7+
import net.minecraft.block.state.IBlockState;
8+
import net.minecraft.creativetab.CreativeTabs;
9+
import net.minecraft.item.Item;
10+
11+
public class ModBlockOre2 extends Block {
12+
13+
private Item drop;
14+
private int meta;
15+
private int least_quantity;
16+
private int most_quantity;
17+
18+
protected ModBlockOre2(String unlocalizedName, Material mat, Item drop, int meta, int least_quantity, int most_quantity) {
19+
super(mat);
20+
this.drop = drop;
21+
this.meta = meta;
22+
this.least_quantity = least_quantity;
23+
this.most_quantity = most_quantity;
24+
this.setHarvestLevel("pickaxe", 2);
25+
this.setHardness(10.0f);
26+
this.setResistance(15.0f);
27+
this.setUnlocalizedName(unlocalizedName);
28+
this.setCreativeTab(CreativeTabs.tabBlock);
29+
}
30+
31+
protected ModBlockOre2(String unlocalizedName, Material mat, Item drop, int least_quantity, int most_quantity) {
32+
this(unlocalizedName, mat, drop, 0, least_quantity, most_quantity);
33+
}
34+
35+
protected ModBlockOre2(String unlocalizedName, Material mat, Item drop) {
36+
this(unlocalizedName, mat, drop, 1, 1);
37+
}
38+
39+
@Override
40+
public Item getItemDropped(IBlockState blockstate, Random random, int fortune) {
41+
return this.drop;
42+
}
43+
44+
@Override
45+
public int damageDropped(IBlockState blockstate) {
46+
return this.meta;
47+
}
48+
49+
@Override
50+
public int quantityDropped(IBlockState blockstate, int fortune, Random random) {
51+
if (this.least_quantity >= this.most_quantity)
52+
return this.least_quantity;
53+
return this.least_quantity + random.nextInt(this.most_quantity - this.least_quantity + fortune + 1);
54+
}
55+
}

src/java/com/knoxhack/nethermetals/blocks/ModBlocks.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.knoxhack.nethermetals.blocks;
22

3+
import com.knoxhack.nethermetals.items.ModItems;
4+
35
import net.minecraft.block.Block;
6+
import net.minecraft.block.material.Material;
47
import net.minecraftforge.fml.common.registry.GameRegistry;
58

69
public final class ModBlocks {
@@ -13,13 +16,14 @@ public final class ModBlocks {
1316
public static Block netherzincOre;
1417

1518

19+
1620
public static void createBlocks() {
17-
GameRegistry.registerBlock(nethercopperOre = new BasicBlock("nether_copper_ore"), "nether_copper_ore");
18-
GameRegistry.registerBlock(nethertinOre = new BasicBlock("nether_tin_ore"), "nether_tin_ore");
19-
GameRegistry.registerBlock(netherleadOre = new BasicBlock("nether_lead_ore"), "nether_lead_ore");
20-
GameRegistry.registerBlock(nethersilverOre = new BasicBlock("nether_silver_ore"), "nether_silver_ore");
21-
GameRegistry.registerBlock(nethernickelOre = new BasicBlock("nether_nickel_ore"), "nether_nickel_ore");
22-
GameRegistry.registerBlock(netherzincOre = new BasicBlock("nether_zinc_ore"), "nether_zinc_ore");
21+
GameRegistry.registerBlock(nethercopperOre = new ModBlockOre("nether_copper_ore", Material.rock, ModItems.netheraxe, 2, 4), "nether_copper_ore");
22+
GameRegistry.registerBlock(nethertinOre = new ModBlockOre("nether_tin_ore", Material.rock, ModItems.netheraxe, 2, 4), "nether_tin_ore");
23+
GameRegistry.registerBlock(netherleadOre = new ModBlockOre("nether_lead_ore", Material.rock, ModItems.netheraxe, 2, 4), "nether_lead_ore");
24+
GameRegistry.registerBlock(nethersilverOre = new ModBlockOre2("nether_silver_ore", Material.rock, ModItems.netheraxe, 2, 4), "nether_silver_ore");
25+
GameRegistry.registerBlock(netherzincOre = new ModBlockOre("nether_zinc_ore", Material.rock, ModItems.netheraxe, 2, 4), "nether_zinc_ore");
26+
GameRegistry.registerBlock(nethernickelOre = new ModBlockOre("nether_nickel_ore", Material.rock, ModItems.netheraxe, 2, 4), "nether_nickel_ore");
2327

2428

2529

@@ -28,7 +32,6 @@ public static void createBlocks() {
2832

2933

3034

31-
3235
}
3336

3437

src/java/com/knoxhack/nethermetals/items/ModItems.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ public final class ModItems {
1717

1818

1919
public static void createItems() {
20-
GameRegistry.registerItem(netherpickaxe = new SwordItem("Nether_Pickaxe"), "Nether_Pickaxe");
21-
GameRegistry.registerItem(nethersword = new SwordItem("Nether_Sword"), "Nether_Sword");
22-
GameRegistry.registerItem(netherspade = new SwordItem("Nether_Spade"), "Nether_Spade");
23-
GameRegistry.registerItem(netherhoe = new SwordItem("Nether_Hoe"), "Nether_Hoe");
24-
GameRegistry.registerItem(netheraxe = new SwordItem("Nether_Axe"), "Nether_Axe");
25-
GameRegistry.registerItem(netherhelmet = new SwordItem("Nether_Helmet"), "Nether_Helmet");
26-
GameRegistry.registerItem(netherchestplate = new SwordItem("Nether_Chestplate"), "Nether_Chestplate");
27-
GameRegistry.registerItem(netherleggings = new SwordItem("Nether_Leggings"), "Nether_Leggings");
28-
GameRegistry.registerItem(netherboots = new SwordItem("Nether_Boots"), "Nether_Boots");
20+
GameRegistry.registerItem(netherpickaxe = new SwordItem("nether_Pickaxe"), "nether_Pickaxe");
21+
GameRegistry.registerItem(nethersword = new SwordItem("nether_Sword"), "nether_Sword");
22+
GameRegistry.registerItem(netherspade = new SwordItem("nether_Spade"), "nether_Spade");
23+
GameRegistry.registerItem(netherhoe = new SwordItem("nether_Hoe"), "nether_Hoe");
24+
GameRegistry.registerItem(netheraxe = new SwordItem("nether_Axe"), "nether_Axe");
25+
GameRegistry.registerItem(netherhelmet = new SwordItem("nether_Helmet"), "nether_Helmet");
26+
GameRegistry.registerItem(netherchestplate = new SwordItem("nether_Chestplate"), "nether_Chestplate");
27+
GameRegistry.registerItem(netherleggings = new SwordItem("nether_Leggings"), "nether_Leggings");
28+
GameRegistry.registerItem(netherboots = new SwordItem("nether_Boots"), "nether_Boots");
2929

3030

3131

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<en_US.lang - English localization file for the mod "Tutorial">
2+
3+
item.nether_copper_ore.name=Nether Copper Ore
4+
item.nether_tin_ore.name=Nether Tin Ore
5+
item.nether_lead_ore.name=Nether Lead Ore
6+
item.nether_silver_ore.name=Nether Silver Ore
7+
item.nether_zinc_ore.name=Nether Zinc Ore
8+
item.nether_nickel_ore.name=Nether Nickel Ore
9+
tile.nether_sword.name=Nether Sword
10+
tile.nether_pickaxe.name=Nether Pickaxe
11+
tile.nether_axe.name=Nether Axe
12+
tile.nether_hoe.name=Nether How
13+
tile.nether_spade.name=Nether Shovel
14+
tile.nether_helmet.name=Nether Helmet
15+
tile.nether_chestplate.name=Nether Chestplate
16+
tile.nether_leggings.name=Nether Leggings
17+
tile.nether_boots.name=Nether Boots

0 commit comments

Comments
 (0)