Jump to content

[Solved] Multiplying Drops based on Fortune Level


XDdrummer

Recommended Posts

So, I am using getItemDropped(...) to set the items dropped from my blocks. However, I want it to multiply based on fortune - Is this automatic? And if not, what do I have to do to multiply it, considering the fact that it returns an Item, and I'm not sure how to give multiple items without an ItemStack?

 

My block code:

 

package us.xddrummer.harmonyrpg.blocks;

 

import java.util.Random;

 

import us.xddrummer.harmonyrpg.HarmonyRPG;

import us.xddrummer.harmonyrpg.init.HarmonyItems;

import us.xddrummer.harmonyrpg.modinfo.ItemTypes;

import us.xddrummer.harmonyrpg.modinfo.ModInfo;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

public class AgateOre extends Block{

 

public AgateOre() {

super(Material.rock);

this.setHardness(3.0f);

this.setHarvestLevel("pickaxe", ItemTypes.stoneLevel);

this.setResistance(3.0f);

this.setCreativeTab(HarmonyRPG.harmonyBlocksTab);

this.setBlockTextureName(ModInfo.MODID + ":oreAgate");

}

 

@Override

public Item getItemDropped(int metadata, Random random, int fortune){

return HarmonyItems.agate;

}

}

 

 

Thanks!

Link to comment
Share on other sites

getItemDropped(...) is the call to decide what item a block drops.

 

use

quantityDropped(Random random)

for non fortune drops.

 

The method you are interested in is

quantityDropped(int meta, int fortune, Random random)
{
return quantityDroppedWithBonus(fortune, random);
}

 

You will want to override

public int quantityDroppedWithBonus(int p_149679_1_, Random p_149679_2_)

to return something with the fortune value rather than the default

return this.quantityDropped(p_149679_2_);

 

My, this needs to be mapped doesn't it maybe I could go name some variables

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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