Last active
August 20, 2019 07:54
-
-
Save GrunclePug/1d63a52b31c151cf16f2db2dd4bb50fd to your computer and use it in GitHub Desktop.
EggCraft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import java.util.Random; | |
import net.minecraft.block.Block; | |
import net.minecraft.block.material.Material; | |
import net.minecraft.item.Item; | |
/** | |
* Egg Ore Block | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class BlockEggOre extends Block | |
{ | |
/** | |
* Constructor | |
* @param material the Material of the block | |
*/ | |
protected BlockEggOre(Material material) | |
{ | |
super(material); | |
this.setHardness(3F); | |
this.setResistance(3F); | |
this.setHarvestLevel("pickaxe", 2); | |
this.setStepSound(this.soundTypeStone); | |
} | |
@Override | |
/** | |
* Accessor for Item dropped | |
* | |
* @return Item dropped | |
*/ | |
public Item getItemDropped(int metadata, Random rand, int fortune) | |
{ | |
return EggCraft.itemUnrefinedEgg; | |
} | |
@Override | |
/** | |
* Accessor for Quantity of Item dropped | |
* | |
* @return Quantity of Item dropped | |
*/ | |
public int quantityDropped(Random rand) | |
{ | |
return 1 + rand.nextInt(2); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import com.gruncle.eggcraft.item.ItemReinforcedEggArmour; | |
import com.gruncle.eggcraft.item.ItemReinforcedEggAxe; | |
import com.gruncle.eggcraft.item.ItemReinforcedEggHoe; | |
import com.gruncle.eggcraft.item.ItemReinforcedEggPickaxe; | |
import com.gruncle.eggcraft.item.ItemReinforcedEggShovel; | |
import com.gruncle.eggcraft.item.ItemReinforcedEggSword; | |
import cpw.mods.fml.common.Mod; | |
import cpw.mods.fml.common.Mod.EventHandler; | |
import cpw.mods.fml.common.event.FMLInitializationEvent; | |
import cpw.mods.fml.common.event.FMLPostInitializationEvent; | |
import cpw.mods.fml.common.event.FMLPreInitializationEvent; | |
import cpw.mods.fml.common.registry.GameRegistry; | |
import net.minecraft.block.Block; | |
import net.minecraft.block.material.Material; | |
import net.minecraft.creativetab.CreativeTabs; | |
import net.minecraft.init.Items; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemArmor; | |
import net.minecraft.item.ItemFood; | |
import net.minecraft.item.ItemStack; | |
import net.minecraftforge.common.util.EnumHelper; | |
@Mod(modid = "ec", name = "EggCraft", version = "1.0") | |
/** | |
* EggCraft Mod 1.7.10 | |
* | |
* @author grunclepug | |
* @version 1.0 | |
* Date Started: Aug 18, 2019 | |
*/ | |
public class EggCraft | |
{ | |
//Constants | |
public static final Item.ToolMaterial REINFORCED_EGG_TOOL_MATERIAL = EnumHelper.addToolMaterial("REINFORCED_EGG_TOOL_MATERIAL", 2, 1200, 7.0F, 2.5F, 10); | |
public static final ItemArmor.ArmorMaterial REINFORCED_EGG_ARMOUR_MATERIAL = EnumHelper.addArmorMaterial("REINFORCED_EGG_ARMOUR_MATERIAL", 30, new int[] {2,7,5,3}, 10); | |
//Items | |
public static Item itemUnrefinedEgg; | |
public static Item itemEggGear; | |
public static Item itemReinforcedEgg; | |
public static Item itemEggStick; | |
//Food Item | |
public static Item itemFriedEgg; | |
//Tools | |
public static Item reinforcedEggPickaxe; | |
public static Item reinforcedEggSword; | |
public static Item reinforcedEggAxe; | |
public static Item reinforcedEggShovel; | |
public static Item reinforcedEggHoe; | |
//Armour | |
public static Item reinforcedEggHelmet; | |
public static Item reinforcedEggChestplate; | |
public static Item reinforcedEggLeggings; | |
public static Item reinforcedEggBoots; | |
//Blocks | |
public static Block blockEggOre; | |
@EventHandler | |
/** | |
* Pre Initialization | |
* @param event FMLPreInitializationEvent | |
*/ | |
public void preInit(FMLPreInitializationEvent event) | |
{ | |
//Item Initialization | |
itemUnrefinedEgg = new ItemUnrefinedEgg().setUnlocalizedName("ItemUnrefinedEgg").setTextureName("ec:itemUnrefinedEgg").setCreativeTab(tabEggCraft); | |
itemEggGear = new ItemEggGear().setUnlocalizedName("ItemEggGear").setTextureName("ec:itemEggGear").setCreativeTab(tabEggCraft); | |
itemReinforcedEgg = new ItemReinforcedEgg().setUnlocalizedName("ItemReinforcedEgg").setTextureName("ec:itemReinforcedEgg").setCreativeTab(tabEggCraft); | |
itemEggStick = new ItemEggStick().setUnlocalizedName("ItemEggStick").setTextureName("ec:itemEggStick").setCreativeTab(tabEggCraft); | |
//Food Item Initialization | |
itemFriedEgg = new ItemFood(6, 0.6F, true).setUnlocalizedName("ItemFriedEgg").setTextureName("ec:itemFriedEgg").setCreativeTab(tabEggCraft); | |
//Tool Initialization | |
reinforcedEggPickaxe = new ItemReinforcedEggPickaxe(REINFORCED_EGG_TOOL_MATERIAL).setUnlocalizedName("ItemReinforcedEggPickaxe").setTextureName("ec:itemReinforcedEggPickaxe").setCreativeTab(tabEggCraft); | |
reinforcedEggSword = new ItemReinforcedEggSword(REINFORCED_EGG_TOOL_MATERIAL).setUnlocalizedName("ItemReinforcedEggSword").setTextureName("ec:itemReinforcedEggSword").setCreativeTab(tabEggCraft); | |
reinforcedEggAxe = new ItemReinforcedEggAxe(REINFORCED_EGG_TOOL_MATERIAL).setUnlocalizedName("ItemReinforcedEggAxe").setTextureName("ec:itemReinforcedEggAxe").setCreativeTab(tabEggCraft); | |
reinforcedEggShovel = new ItemReinforcedEggShovel(REINFORCED_EGG_TOOL_MATERIAL).setUnlocalizedName("ItemReinforcedEggShovel").setTextureName("ec:itemReinforcedEggShovel").setCreativeTab(tabEggCraft); | |
reinforcedEggHoe = new ItemReinforcedEggHoe(REINFORCED_EGG_TOOL_MATERIAL).setUnlocalizedName("ItemReinforcedEggHoe").setTextureName("ec:itemReinforcedEggHoe").setCreativeTab(tabEggCraft); | |
//Armour Initialization | |
reinforcedEggHelmet = new ItemReinforcedEggArmour(REINFORCED_EGG_ARMOUR_MATERIAL, 0, 0).setUnlocalizedName("ItemReinforcedEggHelmet").setTextureName("ec:itemReinforcedEggHelmet").setCreativeTab(tabEggCraft); | |
reinforcedEggChestplate = new ItemReinforcedEggArmour(REINFORCED_EGG_ARMOUR_MATERIAL, 0, 1).setUnlocalizedName("ItemReinforcedEggChestplate").setTextureName("ec:itemReinforcedEggChestplate").setCreativeTab(tabEggCraft); | |
reinforcedEggLeggings = new ItemReinforcedEggArmour(REINFORCED_EGG_ARMOUR_MATERIAL, 0, 2).setUnlocalizedName("ItemReinforcedEggLeggings").setTextureName("ec:itemReinforcedEggLeggings").setCreativeTab(tabEggCraft); | |
reinforcedEggBoots = new ItemReinforcedEggArmour(REINFORCED_EGG_ARMOUR_MATERIAL, 0, 3).setUnlocalizedName("ItemReinforcedEggBoots").setTextureName("ec:itemReinforcedEggBoots").setCreativeTab(tabEggCraft); | |
//Block Initialization | |
blockEggOre = new BlockEggOre(Material.rock).setBlockName("BlockEggOre").setBlockTextureName("ec:blockEggOre").setCreativeTab(tabEggCraft); | |
//Item Registry | |
GameRegistry.registerItem(itemUnrefinedEgg, itemUnrefinedEgg.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(itemEggGear, itemEggGear.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(itemFriedEgg, itemFriedEgg.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(itemReinforcedEgg, itemReinforcedEgg.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(itemEggStick, itemEggStick.getUnlocalizedName().substring(5)); | |
//Tool Registry | |
GameRegistry.registerItem(reinforcedEggPickaxe, reinforcedEggPickaxe.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggSword, reinforcedEggSword.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggAxe, reinforcedEggAxe.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggShovel, reinforcedEggShovel.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggHoe, reinforcedEggHoe.getUnlocalizedName().substring(5)); | |
//Armour Registry | |
GameRegistry.registerItem(reinforcedEggHelmet, reinforcedEggHelmet.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggChestplate, reinforcedEggChestplate.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggLeggings, reinforcedEggLeggings.getUnlocalizedName().substring(5)); | |
GameRegistry.registerItem(reinforcedEggBoots, reinforcedEggBoots.getUnlocalizedName().substring(5)); | |
//Block Registry | |
GameRegistry.registerBlock(blockEggOre, blockEggOre.getUnlocalizedName().substring(5)); | |
//Ore Generation Registry | |
GameRegistry.registerWorldGenerator(new OreGeneration(), 0); | |
} | |
@EventHandler | |
/** | |
* Initialization | |
* @param event FMLInitializationEvent | |
*/ | |
public void init(FMLInitializationEvent event) | |
{ | |
//Item Crafting | |
GameRegistry.addRecipe(new ItemStack(itemEggGear), new Object[] {" E ", "E E", " E ", 'E', Items.egg}); | |
GameRegistry.addRecipe(new ItemStack(itemReinforcedEgg), new Object[] {" I ", "IEI", " I ", 'I', Items.iron_ingot, 'E', Items.egg}); | |
GameRegistry.addShapedRecipe(new ItemStack(itemEggStick, 2), new Object[] {"E", "E", 'E', Items.egg}); | |
//Tool Crafting | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggPickaxe), new Object[] {"RRR", " E ", " E ", 'R', itemReinforcedEgg, 'E', itemEggStick}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggSword), new Object[] {" R ", " R ", " E ", 'R', itemReinforcedEgg, 'E', itemEggStick}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggAxe), new Object[] {"RR ", "RE ", " E ", 'R', itemReinforcedEgg, 'E', itemEggStick}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggShovel), new Object[] {" R ", " E ", " E ", 'R', itemReinforcedEgg, 'E', itemEggStick}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggHoe), new Object[] {"RR ", " E ", " E ", 'R', itemReinforcedEgg, 'E', itemEggStick}); | |
//Armour Crafting | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggHelmet), new Object[] {"EEE", "E E", " ", 'E', itemReinforcedEgg}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggChestplate), new Object[] {"E E", "EEE", "EEE", 'E', itemReinforcedEgg}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggLeggings), new Object[] {"EEE", "E E", "E E", 'E', itemReinforcedEgg}); | |
GameRegistry.addRecipe(new ItemStack(reinforcedEggBoots), new Object[] {" ", "E E", "E E", 'E', itemReinforcedEgg}); | |
//Smelting | |
GameRegistry.addSmelting(itemUnrefinedEgg, new ItemStack(Items.egg), 0); | |
GameRegistry.addSmelting(Items.egg, new ItemStack(itemFriedEgg), 0); | |
} | |
@EventHandler | |
/** | |
* Post Initialization | |
* @param event FMLPostInitializationEvent | |
*/ | |
public void postInit(FMLPostInitializationEvent event) | |
{ | |
} | |
//Creative Tab | |
public static CreativeTabs tabEggCraft = new CreativeTabs("tabEggCraft") | |
{ | |
@Override | |
/** | |
* Accessor for Creative Tab Icon Item | |
* @return Creative Tab Icon Item | |
*/ | |
public Item getTabIconItem() | |
{ | |
return new ItemStack(itemReinforcedEgg).getItem(); | |
} | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
item.ItemUnrefinedEgg.name=Unrefined Egg | |
item.ItemEggGear.name=Egg Gear | |
item.ItemFriedEgg.name=Fried Egg | |
item.ItemReinforcedEgg.name=Reinforced Egg | |
item.ItemEggStick.name=Egg Stick | |
item.ItemReinforcedEggPickaxe.name=Reinforced Egg Pickaxe | |
item.ItemReinforcedEggSword.name=Reinforced Egg Sword | |
item.ItemReinforcedEggAxe.name=Reinforced Egg Axe | |
item.ItemReinforcedEggShovel.name=Reinforced Egg Shovel | |
item.ItemReinforcedEggHoe.name=Reinforced Egg Hoe | |
item.ItemReinforcedEggHelmet.name=Reinforced Egg Helmet | |
item.ItemReinforcedEggChestplate.name=Reinforced Egg Chestplate | |
item.ItemReinforcedEggLeggings.name=Reinforced Egg Leggings | |
item.ItemReinforcedEggBoots.name=Reinforced Egg Boots | |
tile.BlockEggOre.name=Egg Ore | |
itemGroup.tabEggCraft=EggCraft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import net.minecraft.item.Item; | |
/** | |
* Egg Gear Item | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemEggGear extends Item | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import net.minecraft.item.Item; | |
/** | |
* Egg Stick Item | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemEggStick extends Item | |
{ | |
/** | |
* Default Constructor | |
*/ | |
public ItemEggStick() | |
{ | |
this.setFull3D(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import net.minecraft.item.Item; | |
/** | |
* Reinforced Egg Item | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEgg extends Item | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft.item; | |
import net.minecraft.entity.Entity; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemArmor; | |
import net.minecraft.item.ItemStack; | |
/** | |
* Reinforced Egg Armour | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEggArmour extends ItemArmor | |
{ | |
/** | |
* Constructor | |
* @param material Material of armour | |
* @param renderIndex Render Index | |
* @param type Type of armour: 0=helmet, 1=chestplate, 2=leggings, 3=boots | |
*/ | |
public ItemReinforcedEggArmour(ArmorMaterial material, int renderIndex, int type) | |
{ | |
super(material, renderIndex, type); | |
} | |
@Override | |
/** | |
* Accessor for armour textures | |
* @return The armour textures | |
*/ | |
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) | |
{ | |
if(this.armorType == 2) | |
{ | |
return "ec:textures/models/armor/reinforcedEgg_layer_2.png"; | |
} | |
return "ec:textures/models/armor/reinforcedEgg_layer_1.png"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft.item; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemAxe; | |
/** | |
* Reinforced Egg Axe Tool | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEggAxe extends ItemAxe | |
{ | |
/** | |
* Constructor | |
* @param material ToolMaterial for tool | |
*/ | |
public ItemReinforcedEggAxe(ToolMaterial material) | |
{ | |
super(material); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft.item; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemHoe; | |
/** | |
* Reinforced Egg Hoe Tool | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEggHoe extends ItemHoe | |
{ | |
/** | |
* Constructor | |
* @param material ToolMaterial for tool | |
*/ | |
public ItemReinforcedEggHoe(ToolMaterial material) | |
{ | |
super(material); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft.item; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemPickaxe; | |
/** | |
* Reinforced Egg Pickaxe Tool | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEggPickaxe extends ItemPickaxe | |
{ | |
/** | |
* Constructor | |
* @param material ToolMaterial for tool | |
*/ | |
public ItemReinforcedEggPickaxe(ToolMaterial material) | |
{ | |
super(material); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft.item; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemSpade; | |
/** | |
* Reinforced Egg Shovel Tool | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEggShovel extends ItemSpade | |
{ | |
/** | |
* Constructor | |
* @param material ToolMaterial for tool | |
*/ | |
public ItemReinforcedEggShovel(ToolMaterial material) | |
{ | |
super(material); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft.item; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemSword; | |
/** | |
* Reinforced Egg Sword Tool | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemReinforcedEggSword extends ItemSword | |
{ | |
/** | |
* Constructor | |
* @param material ToolMaterial for tool | |
*/ | |
public ItemReinforcedEggSword(ToolMaterial material) | |
{ | |
super(material); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import net.minecraft.item.Item; | |
/** | |
* Unrefined Egg Item | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class ItemUnrefinedEgg extends Item | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gruncle.eggcraft; | |
import java.util.Random; | |
import cpw.mods.fml.common.IWorldGenerator; | |
import net.minecraft.block.Block; | |
import net.minecraft.init.Blocks; | |
import net.minecraft.world.World; | |
import net.minecraft.world.chunk.IChunkProvider; | |
import net.minecraft.world.gen.feature.WorldGenMinable; | |
/** | |
* Ore Generation | |
* | |
* @author grunclepug | |
* @version 1.0 | |
*/ | |
public class OreGeneration implements IWorldGenerator | |
{ | |
//Constants | |
public static final int MAX_WORLD_HEIGHT = 256; | |
@Override | |
/** | |
* Generate ores in all dimensions | |
* @param random Randomization | |
* @param chunkX For chunk location | |
* @param chunkZ For chunk location | |
* @param world The World | |
* @param chunkGenerator IChunkProvider | |
* @param chunkProvider IChunkProvider | |
*/ | |
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) | |
{ | |
switch(world.provider.dimensionId) | |
{ | |
case -1: | |
generateNether(world, random, chunkX, chunkZ); | |
break; | |
case 0: | |
generateOverworld(world, random, chunkX, chunkZ); | |
break; | |
case 1: | |
generateEnd(world, random, chunkX, chunkZ); | |
break; | |
default: | |
break; | |
} | |
} | |
/** | |
* Generate the Nether | |
* @param world The World | |
* @param rand Randomization | |
* @param x For chunk location | |
* @param z For chunk location | |
*/ | |
public void generateNether(World world, Random rand, int x, int z) | |
{ | |
} | |
/** | |
* Generate the Overworld | |
* @param world The World | |
* @param rand Randomization | |
* @param x For chunk location | |
* @param z For chunk location | |
*/ | |
public void generateOverworld(World world, Random rand, int x, int z) | |
{ | |
generateOre(EggCraft.blockEggOre, world, rand, x, z, 2, 10, 35, 0, 90, Blocks.stone); | |
} | |
/** | |
* Generate the End | |
* @param world The World | |
* @param rand Randomization | |
* @param x For chunk location | |
* @param z For chunk location | |
*/ | |
public void generateEnd(World world, Random rand, int x, int z) | |
{ | |
} | |
/** | |
* Generate ore | |
* @param block The Ore | |
* @param world The World | |
* @param rand Randomization | |
* @param chunkX For chunk location | |
* @param chunkZ For chunk location | |
* @param minVeinSize Minimum vein size | |
* @param maxVeinSize Maximum vein size | |
* @param chance Chance for the ore to spawn | |
* @param minY Minimum Y value | |
* @param maxY Maximum Y value | |
* @param generateIn The block to generate the ore in | |
*/ | |
public void generateOre(Block block, World world, Random rand, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn) | |
{ | |
if (minY < 0 || maxY > MAX_WORLD_HEIGHT || minY > maxY) | |
throw new IllegalArgumentException("Illegal Height Arguments For Ore Generation"); | |
int veinSize = minVeinSize + rand.nextInt(maxVeinSize - minVeinSize); | |
int heightRange = maxY - minY; | |
WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn); | |
for(int i = 0; i < chance; i++) | |
{ | |
int xRand = chunkX * 16 + rand.nextInt(16); | |
int yRand = rand.nextInt(heightRange) + minY; | |
int zRand = chunkZ * 16 + rand.nextInt(16); | |
gen.generate(world, rand, xRand, yRand, zRand); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment