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

What is the material obsidian uses? I want to add a new ore to the game that can only be mined with a diamond pickaxe but what ever material I set it as I can mine it with all the pickaxes. I even set the resistance to 2000.0F but that does not help ether.

You would need to use something such as:

this.isToolEffective(type, metadata);

To set that tool(although im not sure how to get the type of pick but when i find that i will tell you)

 

~Drok

  • Author

I am having a new problem now. I was using miecraft code from the blocks classes to test out my block and I was just having it drop 2 clay balls. But now I have my own custom item that I want it to drop. How do I make it drop 2 of my Itemcristal on destruction?

You need to return the Item you want dropped and an integer of how much.

 

Don't forget to use @Override to make sure you typed the method names and signature correctly.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

  • Author

Ok this is my code for the ore. As you can see I want to have it drop Itemcristal that is my item that I added to the game. I want it to 2 of them but it is not excepting my item. I have the cristal.java imported and my main java imported(cristalore.java). But it will not except Itemcristal

 

 

 

package net.Cristalore.mod.ore;

 

import java.util.Random;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.Cristalore.mod.cristalore;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.Cristalore.mod.items.cristal;

 

 

public class Cristaloreblock extends Block {

 

 

public Cristaloreblock(Material material) {

super(material);

 

this.setHardness(10.0F);

this.setResistance(2000.0F);

this.setHarvestLevel("pickaxe", 3);

this.setStepSound(soundTypePiston);

this.setCreativeTab(CreativeTabs.tabBlock);}

 

 

 

 

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

    {

        return Itemcristal;

    }

 

    /**

    * Returns the quantity of items to drop on block destruction.

    */

    public int quantityDropped(Random p_149745_1_)

    {

        return 2;

 

}

 

@SideOnly(Side.CLIENT)

public void registerBlockIcons(IIconRegister iconRegister){

this.blockIcon = iconRegister.registerIcon(cristalore.modid + ":" + this.getUnlocalizedName().substring(5));

}

 

}

 

Try

public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
        
	return MainModFile.Itemcristal;
    }

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.