Posted September 27, 20196 yr Hi everyone, I just started to create mods and I would like to ask you something... Is it possible to create a block that drops itself only when it is broken by a specific item? If yes, how can I do it?
September 28, 20196 yr The short answer: Yes The long answer: What block and what item? If you want a modded block to only be harvestable by a vanilla item, you will use different methods than if you want a vanilla block to only be harvestable by a modded item. If you want a modded block to be harvested by a modded item, things should be pretty easy. In the case that you have a modded block to be harvested by a modded or non-modded item, I'm not totally sure, but I believe the preferred method is using a loot table. Maybe somebody else knows how to check for the item used to harvest a block in a block's loot table. There's also methods like canHarvestBlock and onBlockDestroyed in items like ShearsItem. Or harvestTool in Block.Properties, but I think that would require making a new ToolType if the item in question is not an axe or pickaxe. Edited September 28, 20196 yr by skyjay1
September 29, 20196 yr Author 10 hours ago, skyjay1 said: The short answer: Yes The long answer: What block and what item? If you want a modded block to only be harvestable by a vanilla item, you will use different methods than if you want a vanilla block to only be harvestable by a modded item. If you want a modded block to be harvested by a modded item, things should be pretty easy. In the case that you have a modded block to be harvested by a modded or non-modded item, I'm not totally sure, but I believe the preferred method is using a loot table. Maybe somebody else knows how to check for the item used to harvest a block in a block's loot table. There's also methods like canHarvestBlock and onBlockDestroyed in items like ShearsItem. Or harvestTool in Block.Properties, but I think that would require making a new ToolType if the item in question is not an axe or pickaxe. ok, so if I use a modded pickaxe to break a modded block how should I do?
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.