-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix destroy speed on tools not calculating additional bonuses
- Loading branch information
Showing
7 changed files
with
79 additions
and
37 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/java/com/autovw/advancednetherite/common/AdvancedUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.autovw.advancednetherite.common; | ||
|
||
import com.autovw.advancednetherite.config.Config; | ||
import com.autovw.advancednetherite.core.util.ModToolTiers; | ||
import net.minecraft.world.item.DiggerItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Tier; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
/** | ||
* @author Autovw | ||
*/ | ||
public class AdvancedUtil { | ||
/** | ||
* Helper method for applying the appropriate block destroy speed to tools | ||
* @param originalSpeed The original destroy speed | ||
* @param stack Tool stack | ||
* @param state State of block being broken | ||
* @return New destroy speed | ||
*/ | ||
public static float getDestroySpeed(float originalSpeed, ItemStack stack, BlockState state) { | ||
float newSpeed = originalSpeed; | ||
|
||
if (stack.getItem() instanceof DiggerItem diggerItem) { | ||
Tier tier = diggerItem.getTier(); | ||
|
||
if (diggerItem.isCorrectToolForDrops(stack, state)) { | ||
if (tier == ModToolTiers.NETHERITE_IRON) | ||
newSpeed *= Config.ToolProperties.ironBreakingSpeedMultiplier.get(); | ||
if (tier == ModToolTiers.NETHERITE_GOLD) | ||
newSpeed *= Config.ToolProperties.goldBreakingSpeedMultiplier.get(); | ||
if (tier == ModToolTiers.NETHERITE_EMERALD) | ||
newSpeed *= Config.ToolProperties.emeraldBreakingSpeedMultiplier.get(); | ||
if (tier == ModToolTiers.NETHERITE_DIAMOND) | ||
newSpeed *= Config.ToolProperties.diamondBreakingSpeedMultiplier.get(); | ||
} | ||
} | ||
|
||
return newSpeed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters