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

Hey, I am having a few issues with my mod, can't figure out what to do about blockID and itemID, I have the following code:

 

package apex.blocks;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class MagicOre extends Block {

public MagicOre(Material material) {
	super(material);

	setHardness(3.0F);
	setStepSound(soundTypeStone);
	setCreativeTab(CreativeTabs.tabBlock);
	setBlockTextureName("apex:magic_ore");
	setBlockName("magicOre");

}

public int idDropped(int par1, Random par2Random, int par3){
	int drop = par2Random.nextInt(7);
	if (drop == 0){
		return apex.ApexCore.whiteDust.itemID;
	}else if (drop == 1){
		return apex.ApexCore.blueDust.itemID;
	}else if (drop == 2){
		return apex.ApexCore.purpleDust.itemID;
	}else if (drop == 3){
		return apex.ApexCore.brownDust.itemID;
	}else if (drop == 4){
		return apex.ApexCore.magicDust.itemID;
	}else if (drop == 5){
		return apex.ApexCore.pinkDust.itemID;
	}else if (drop == 6){
		return apex.ApexCore.redDust.itemID;
	}else{
		return apex.ApexCore.yellowDustA.itemID;
	}
}
@SideOnly(Side.CLIENT)

protected boolean canSilkHarvest(){
	return true;
}

//Drops 3-8 XP Orbs on block break.
public void dropBlockAsItemWithChance(World world, int par2, int par3, int par4, int par5, float par6, int par7){
	super.dropBlockAsItemWithChance(world, par2, par3, par4, par5, par6, par7);

	if (this.idDropped(par5, world.rand, par7) != this.blockID){
		int j1 = 0;
		j1 = MathHelper.getRandomIntegerInRange(world.rand, 3, ;

		this.dropXpOnBlockBreak(world, par2, par3, par4, j1);
	}
}
}

 

For my items I have itemID, and blockID, there are no more IDs, so what do I change them to? :/

Reference your blocks and items as blocks and items, not as ids. Ids no longer exist in 1.7. Also, if you used override annotations you would realize that idDropped no longer exists and has been changed to this:

public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
    {

If you really want help, give that modder a thank you.

 

Modders LOVE thank yous.

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.