Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

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

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.