The Meaning of Life, the Universe, and Everything.
Join Date:
5/29/2011
Posts:
320
Minecraft:
Machina
Member Details
Using forge, I tried a few things to drop an item instead of a block, the blocks have a harvest level that is needed to actually get the blocks, so I want to switch it from dropping block to an item instead.
I tried
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Main.Sapphire;
}
This one worked in 1.6.2
public int idDropped(int par1, Random par2Random, int par3)
{
return Main.Sapphire;
}
public int quantityDropped(Random random)
{
return 1;
}
My question is what am I doing wrong?
Rollback Post to RevisionRollBack
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
The Meaning of Life, the Universe, and Everything.
Join Date:
5/29/2011
Posts:
320
Minecraft:
Machina
Member Details
Bumping for I am in need
Rollback Post to RevisionRollBack
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
Your code is fine, which means that you're screwing up somewhere else. Show me your whole Block class, along with the class where you declare the block.
Your code is fine, which means that you're screwing up somewhere else. Show me your whole Block class, along with the class where you declare the block.
public static Block sapphireore;
sapphireore = new SapphireOre(Material.rock).setBlockName("sapphireore").setHardness(4.0F).setBlockTextureName(modid + ":" + "sapphireore").setStepSound(Block.soundTypeStone).setCreativeTab(ptab);
GameRegistry.registerBlock(sapphireore, "sapphireore");
Rollback Post to RevisionRollBack
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
.itemID doesnt exist anymore right? isnt it .getItem()? EDIT: Your code is fine, here is the methods form BlockSnowNBlock from vanilla
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Items.snowball; }
EDIT2: I just tried for my code, drop an item from a block and it works fine. here is the class:
package nl.nijenhuis.cc4.blocks.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import nl.nijenhuis.cc4.CocoCraft4; import nl.nijenhuis.cc4.items.CocoCraftItems; import nl.nijenhuis.cc4.reference.Reference; public class AmethystOre extends Block { public AmethystOre() { super(Material.iron); setBlockName("amethystOre"); setBlockTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setCreativeTab(CocoCraft4.tabCocoCraft); setHardness(3f); } public Item getItemDropped(int i, Random rand, int j) { return CocoCraftItems.gemAmethyst; } }
This fixed it, thank you very much.
Rollback Post to RevisionRollBack
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
I tried
This one worked in 1.6.2
My question is what am I doing wrong?
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
and declare it in the main class
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence
Or did you mean that you want the block to drop an item depending on the harvest level of the tool?
Yes, I want it to get the item depending on the harvest level.
This fixed it, thank you very much.
Hello darkness, my old friend I've come to talk with you again because a vision softly creeping left its seeds while I was sleeping and the vision that was planted in my brain still remains within the sound of silence