GenFrogKing Posted April 21, 2015 Posted April 21, 2015 As the name suggests, I simply wish to have a block drop an item- specifically, this is an ore block meant to drop minerals when mined. (Below is the code.) I'm sure it's a simple fix, but I've been googling for a day now (minus time spent sleeping and at work) and scouring this forum without any luck. There's plenty of 1.7+ tutorials/code out there that use the getItemDropped(int metadata, Random random, int fortune) implementation from the Block class which has changed to getItemDropped(IBlockState state, Random random, int fortune). I updated to the new implementation, but the @Override above both getItemDropped and quantityDropped apparently doesn't belong even though Ctrl-clicking on them allows me to open them in the Block class directory. This is a bit frustrating. I'm using Eclipse and I'm a bit new to Java but not to coding (and I've been reading up with a Sam's). Thank you for any help! The Code package genfrogking.supercraft.init.blocks; import java.lang.annotation.Target; import genfrogking.supercraft.init.SupercraftItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import scala.util.Random; public class Block_Ore_Mithril extends Block { public Block_Ore_Mithril(Material materialIn) { super(materialIn); this.setResistance(25.0F); this.setHardness(5.0F); this.setHarvestLevel("pickaxe", 4); this.setLightLevel(1.0F); this.setLightOpacity(0); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return SupercraftItems.mithril_mineral; } @Override public int quantityDropped(Random rand) { return 1 + rand.nextInt(2); } } Sorry. I tried to put the code in a spoiler and code format, but the formatting options, when I was setting this post up, weren't working properly. Quote
GenFrogKing Posted April 21, 2015 Author Posted April 21, 2015 Yup, that was it. Thank you! When you say On 4/21/2015 at 6:17 AM, diesieben07 said: This is why you should not override manually. are you referring to auto-organizing (Ctrl-Shift-O) imports in Eclipse? It automatically imported scala for me instead of java; I didn't even notice! Fortunately, Eclipse noticed there was an error here. Quote
Recommended Posts
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.