Posted March 24, 201510 yr I do not know/ cannot find which event to use to check what block i am breaking to change what the block drops. @SubscribeEvent public void onDrops(BlockEvent.HarvestDropsEvent event) { if (event.harvester.getHeldItem().getItem() == ToolsPPItems.brick_pickaxe) { event.drops.clear(); event.drops.add(new ItemStack(Items.iron_ingot)); } } that function works to change every block to drop an iron ingot. ive seen plenty of posts across the internet from days of googling with a Block block argument in the HarvestDropsEvent class constructor, but it no longer has this: I've looked in World and EntityPlayer but cannot find anything that points to the exact block that is being broken. //HarvestDropsEvent that is called everytime a block is broken public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, List<ItemStack> drops, EntityPlayer harvester, boolean isSilkTouching) { super(world, pos, state); this.fortuneLevel = fortuneLevel; this.dropChance = dropChance; this.drops = drops; this.isSilkTouching = isSilkTouching; this.harvester = harvester; } I am very new at modding minecraft, I just started a couple days ago. thank you for your help.
March 24, 201510 yr Author i tried if (event.state.getBlock() == Blocks.iron_ore..... but it didnt work, no errors or anything just dropped iron ore instead of an ingot
March 24, 201510 yr Hi These two links will probably tell you all you ever wanted to know about block mining (as well as a lot you had no idea you didn't want to know) http://greyminecraftcoder.blogspot.ch/2015/01/mining-blocks-with-tools.html http://greyminecraftcoder.blogspot.ch/2015/01/summary-of-logic-flow-when-mining-blocks.html -TGG
March 24, 201510 yr also breakpoints arent working in eclipse This article might help? http://www.vogella.com/tutorials/EclipseDebugging/article.html -TGG
April 15, 201510 yr I am still having trouble with this. Would you kindly put the corrected source code up?
April 15, 201510 yr Post your current code. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
April 15, 201510 yr package atijaf.Reinforcement.init; import net.minecraft.init.Blocks; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class BlockEventHandler{ @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onDrops(BlockEvent.BreakEvent event){ if (event.state.getBlock() == Blocks.diamond_ore){ //drop ReinItems.diamond_shard //drop Items.diamond } } } Am I suppose to call this method from somewhere? Or is is okay to be untouched.
April 15, 201510 yr Do not call event handler methods yourself. and, HarvestDropsEvent should be used to change drops, since you cannot change drops with BreakEvent. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
October 17, 20177 yr 21 hours ago, Differentiation said: 1.8 is no longer supported on this Forum... Well too bad! BTW i have my own problem : I am trying to make a custom tnt and my textures dont work. Can anyone help?
October 18, 20177 yr 14 hours ago, diesieben07 said: Nobody ever said this. Don't just make up rules. Then why did Draco18s tell me that 1.10.2 is soon to be unsupported as well?
October 19, 20177 yr 18 hours ago, diesieben07 said: Nobody ever said this. Don't just make up rules. If you have your own problem, make your own thread. I did
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.