From 9df06a4a88334dfc2f94a536abfd7ce4dc6271b2 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Mon, 13 Jul 2020 06:26:21 +0200 Subject: [PATCH] Fixed block mining speed. --- mods/default/blocks.lua | 13 ------------- source/common/world/BlockState.hpp | 5 ++++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/mods/default/blocks.lua b/mods/default/blocks.lua index 256691be8..db7f9e148 100644 --- a/mods/default/blocks.lua +++ b/mods/default/blocks.lua @@ -29,7 +29,6 @@ mod:block { id = "dirt", name = "Dirt", tiles = "dirt.png", - harvest_requirements = 2, } mod:block { @@ -46,7 +45,6 @@ mod:block { name = "Grass", tiles = {"grass_block_top.png", "dirt.png", "grass_block_side.png"}, color_multiplier = {129, 191, 91, 255}, - harvest_requirements = 2, item_drop = { id = mod:id()..":dirt", @@ -70,7 +68,6 @@ mod:block { id = "oak_wood", name = "Oak Wood", tiles = {"oak_log_top.png", "oak_log.png"}, - harvest_requirements = 4, } mod:block { @@ -89,7 +86,6 @@ mod:block { id = "sand", name = "Sand", tiles = "sand.png", - harvest_requirements = 2, } mod:block { @@ -112,7 +108,6 @@ mod:block { tiles = "glass.png", draw_type = "glass", is_opaque = false, - harvest_requirements = 1, } mod:block { @@ -133,7 +128,6 @@ mod:block { tiles = "oak_planks.png", hardness = 1, - harvest_requirements = 4, groups = { default_planks = 1 @@ -145,7 +139,6 @@ mod:block { name = "Glowstone", tiles = "glowstone.png", is_light_source = true, - harvest_requirements = 1, } mod:block { @@ -195,7 +188,6 @@ mod:block { id = "clay", name = "Clay", tiles = "clay.png", - harvest_requirements = 2, item_drop = { id = mod:id()..":clay_ball", amount = 4 @@ -207,8 +199,6 @@ mod:block { name = "Oak Wood Slab", tiles = "oak_planks.png", - harvest_requirements = 4, - draw_type = "boundingbox", is_opaque = false, @@ -248,7 +238,6 @@ mod:block { id = "soul_sand", name = "Soul Sand", tiles = "soul_sand.png", - harvest_requirements = 2, } mod:block { @@ -346,7 +335,6 @@ mod:block { name = "Farmland", tiles = {"farmland_dry.png", "dirt.png", "dirt.png"}, is_opaque = false, - harvest_requirements = 2, states = { { alt_tiles = {"farmland_wet.png", "dirt.png", "dirt.png"} }, @@ -361,7 +349,6 @@ mod:block { name = "Grass Path", tiles = {"grass_path_top.png", "dirt.png", "grass_path_side.png"}, is_opaque = false, - harvest_requirements = 2, draw_type = "boundingbox", bounding_box = {0, 0, 0, 1, 1, 15 / 16}, diff --git a/source/common/world/BlockState.hpp b/source/common/world/BlockState.hpp index 98ee2ebec..04235fcee 100644 --- a/source/common/world/BlockState.hpp +++ b/source/common/world/BlockState.hpp @@ -93,7 +93,10 @@ class BlockState : public gk::ISerializable { u16 id() const { return m_id; } float timeToBreak(u8 harvestCapability, float miningSpeed) const { - return (harvestRequirements() & harvestCapability) ? 1.5 * m_hardness / miningSpeed : 5 * m_hardness; + if ((harvestRequirements() & harvestCapability) || (harvestCapability == 0 && harvestRequirements() == 0)) + return 1.5 * m_hardness / miningSpeed; + else + return 5 * m_hardness; } ItemStack getItemDrop() const { return {m_itemDrop, m_itemDropAmount}; }