Jump to content

[SOLVED]Ore harvest level question


tamanor

Recommended Posts

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I've been trying to give a little transparency to a block and a custom model, but I'm running into the same issue with the transparency of the block Some guides say I use ItemBlockRenderTypes.setRenderLayer in a ClientEvent class but its deprecated, I already tried to set a Properties in Properties.copy(Blocks.FLOWERPOT) But the render in game still doesn't has transparency, only as an Item  
    • My friends and I are modding to survive But recently I want to use cmd to open the server instead of making the single player game public But when I used two methods to start the server, I encountered two problems first A I used forge to install the server files Created using the original server jar The server was installed successfully and the mod was also loaded successfully. But after I replaced the world file with my survival map, I found that the mod items inside disappeared but could be taken from creation again. So I tried to install the server using forge first B I have studied forge for a long time but successfully installed it. But when I put in mods it crashed But mods can be installed on the server   我和我的朋友們正在mod為了生存 但是最近我想用cmd打開伺服器而不是把單人遊戲公開 但是當我使用兩種方法啟動伺服器時,我遇到了兩個問題 首先AI使用forge安裝伺服器檔案使用原始伺服器jar 建立伺服器已成功安裝,mod 也已成功載入。但是當我用我的生存地圖替換世界文件後,我發現裡面的mod物品消失了,但可以再次從創建中取出。所以我嘗試先使用forge安裝伺服器,BI研究了forge很久但成功安裝了它。但是當我安裝 mods 時它崩潰了但是 mods 可以安裝在伺服器上 我和我的朋友正在mod生存 但最近我想使用cmd開啟伺服器而不是單人遊戲公開   但是當我使用了兩種方法開啟伺服器時遇到了兩種問題   第1個A 我使用了forge安裝伺服器文件 在使用原版伺服器jar建立    伺服器安裝成功 mod也順利加載  但是我將我的生存地圖替換世界文件後發現裡面的mod物品消失了但可以再次從創造拿取  所以我嘗試使用forge安裝伺服器   第2個B forge我研究了很久但也成功安裝了 但是當我放入 mods 之後發生了崩潰 但是mods在1A伺服器上是可以安裝的 Ps 我用谷歌翻譯 so    
    • That’s probably not it because as I stated I’ve done it before. I did it like deadass 10 - 20 times when trying to learn to make this mod pack because I kept wanting to reset my profiles and such. So it definitely works, it looks like maybe the creephosting files were the things that couldn’t be reached I tried reading the crash log
    • I don't know if this is the right place or not, but I have put together a custom modpack and I am in need of others to help me. It's a questing modpack with a lore book i'm currently writing out through Patchouli, and i am in need of somebody who will assist me in making the quests for the pack. It's a Zombie apocalypse modpack inspired by Deceasedcraft  with a tinge of magic and RPG mechanics via Mine and slash. Is there anybody willing to assist me as i'm one person building a modpack I could also use help with optimizations since that's not really my strong suite. 
    • File a report to SPYRECOVERY36 @ gmail com he can legitimately assist in proper review and recovery of all your assets that was stolen. Endeavor to submit your request for a refund to his mail . He also spy and hack any device remotely without any trace. Contact via spyrecovery36 @ gm ail com  
  • Topics

×
×
  • Create New...

Important Information

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