From d56cf36fb98282754d8adb2b1c7dae1f2fbd2e99 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 8 Feb 2023 23:26:21 +0700 Subject: [PATCH] AXES_BREAK_LEAVES_INSTANTLY config option --- src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt | 5 +++++ src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryAxeItem.kt | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt index e096700d2..44c4018cc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt @@ -237,6 +237,10 @@ object ServerConfig { } } + object Tools { + val AXES_BREAK_LEAVES_INSTANTLY: Boolean by specBuilder.define("AXES_BREAK_LEAVES_INSTANTLY", true) + } + init { // access instances so spec is built NanobotsRegeneration @@ -244,6 +248,7 @@ object ServerConfig { AndroidJumpBoost AndroidItemMagnet Shockwave + Tools specBuilder.pop() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryAxeItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryAxeItem.kt index b55940d8a..a2de91551 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryAxeItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryAxeItem.kt @@ -5,10 +5,11 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Tier import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.material.Material +import ru.dbotthepony.mc.otm.ServerConfig class MatteryAxeItem(pTier: Tier, pAttackDamageModifier: Float, pAttackSpeedModifier: Float, pProperties: Properties) : AxeItem(pTier, pAttackDamageModifier, pAttackSpeedModifier, pProperties) { override fun getDestroySpeed(pStack: ItemStack, pState: BlockState): Float { - if (pState.material == Material.LEAVES) + if (pState.material == Material.LEAVES && ServerConfig.Tools.AXES_BREAK_LEAVES_INSTANTLY) return 64f return super.getDestroySpeed(pStack, pState)