Jump to content

Recommended Posts

Posted

Hi I was wondering how would I set the harvest level of my ore if I have all the in one class before I would use

 

setHarvestLevel("pickaxe", 3);

but that makes it so all the ore harvest level is 3 but now I have my ore like normal Minecraft. where they are all handled in the same class

 

public Item getItemDropped(int par1, Random par2Random, int par3){
return this == TVBlocksOre.cryoniumOre ? TVItems.cryoniumGem :(this == TVBlocksOre.morganiteOre ? TVItems.morganiteGem :(this == TVBlocksOre.tourmalineOre ? TVItems.tourmalineGem : Item.getItemFromBlock(this)));
}

 

 

how would I now make it so cryoniumOre  needs a iron pick to harvest and lets say tourmalineOre  needs diamond pick

 

thanks

Posted

The harvest levels are defined in the item's ToolMaterial. I think they are the first number. The ToolMaterials can be found in Item. Note that the diamond material is called emerald.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

So how would I got about making it work with my custom ore blocks since I don't see anywhere it links the ToolMaterial to the normal minecraft ores

Posted

If you have an ore that should only be broken by diamond, set the harvest level to 3 since that is diamond's harvest level. If it should only be broken by iron or above, set the harvest level to 2 since that is iron's harvest level.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

yeah but I have done all my of ore in one class so I don't have 100s of classes my ore code is like

 

Ore Code

 

package net.tamaverse.blocks;

import java.util.Random;

import cpw.mods.fml.client.*;
import cpw.mods.fml.client.registry.*;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.asm.*;
import cpw.mods.fml.common.asm.transformers.*;
import cpw.mods.fml.common.discovery.*;
import cpw.mods.fml.common.discovery.asm.*;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.functions.*;
import cpw.mods.fml.common.network.*;
import cpw.mods.fml.common.registry.*;
import cpw.mods.fml.common.toposort.*;
import cpw.mods.fml.common.versioning.*;
import cpw.mods.fml.relauncher.*;
import cpw.mods.fml.server.*;
import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.client.*;
import net.minecraft.client.audio.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.client.model.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.settings.*;
import net.minecraft.command.*;
import net.minecraft.crash.*;
import net.minecraft.creativetab.*;
import net.minecraft.dispenser.*;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.boss.*;
import net.minecraft.entity.effect.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.item.crafting.*;
import net.minecraft.nbt.*;
import net.minecraft.network.*;
import net.minecraft.network.rcon.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.profiler.*;
import net.minecraft.server.*;
import net.minecraft.server.dedicated.*;
import net.minecraft.server.gui.*;
import net.minecraft.server.integrated.*;
import net.minecraft.server.management.*;
import net.minecraft.src.*;
import net.minecraft.stats.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.village.*;
import net.minecraft.world.*;
import net.minecraft.world.biome.*;
import net.minecraft.world.chunk.*;
import net.minecraft.world.chunk.storage.*;
import net.minecraft.world.demo.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.layer.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.storage.*;
import net.minecraftforge.classloading.*;
import net.minecraftforge.client.*;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.entity.item.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.minecart.*;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.world.*;
import net.minecraftforge.oredict.*;
import net.minecraftforge.transformers.*;
import net.minecraft.init.*;
import net.tamaverse.creative.TamaVerseCreative;
import net.tamaverse.items.TVItems;

public class TamaVerseOre extends Block
{
public TamaVerseOre() 
{		
	super(Material.rock);	
	this.setCreativeTab(TamaVerseCreative.tamaVerseBlocks);
	setStepSound(Block.soundTypePiston);
	//setHarvestLevel("pickaxe", 3);
}
public Item getItemDropped(int par1, Random par2Random, int par3){
return this == TVBlocksOre.cryoniumOre ? TVItems.cryoniumGem :(this == TVBlocksOre.morganiteOre ? TVItems.morganiteGem :(this == TVBlocksOre.tourmalineOre ? TVItems.tourmalineGem : Item.getItemFromBlock(this)));
}
public int quantityDropped(Random par1Random){
    return this == TVBlocksOre.tourmalineOre ? 4 + par1Random.nextInt(5) : 1;
}

    public int quantityDroppedWithBonus(int p_149679_1_, Random p_149679_2_)
    {
        if (p_149679_1_ > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, p_149679_2_, p_149679_1_))
        {
            int j = p_149679_2_.nextInt(p_149679_1_ + 2) - 1;

            if (j < 0)
            {
                j = 0;
            }

            return this.quantityDropped(p_149679_2_) * (j + 1);
        }
        else
        {
            return this.quantityDropped(p_149679_2_);
        }
    }
    
    public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
    {
        super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
    }
    private Random rand = new Random();
    
    @Override
    public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
    {
        if (this.getItemDropped(p_149690_5_, rand, p_149690_7_) != Item.getItemFromBlock(this))
        {
            int j1 = 0;

            if (this == TVBlocksOre.cryoniumOre)
            {
                j1 = MathHelper.getRandomIntegerInRange(rand,4, ;
            }
            else if (this == TVBlocksOre.morganiteOre)
            {
                j1 = MathHelper.getRandomIntegerInRange(rand, 4, 6);
            }  
            else if (this == TVBlocksOre.tourmalineOre)
            {
                j1 = MathHelper.getRandomIntegerInRange(rand, 2, 4);
            } 

            return j1;
        }
        return 0;
    }
    public int damageDropped(int p_149692_1_)
    {
        return this == TVBlocksOre.tourmalineOre ? 4 : 0;
    }

}

 

 

so if I set the harvest level to 3 it sets them all to diamond and I want different levels

Posted

In the block class there is a function getHarvestLevel(metadata)

Just return the harvestlevel according to the metadata you get and don't set it in the constructor.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.