Skip to content

Commit

Permalink
Fixed block mining speed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Jul 13, 2020
1 parent 35b13ad commit 9df06a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
13 changes: 0 additions & 13 deletions mods/default/blocks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ mod:block {
id = "dirt",
name = "Dirt",
tiles = "dirt.png",
harvest_requirements = 2,
}

mod:block {
Expand All @@ -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",
Expand All @@ -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 {
Expand All @@ -89,7 +86,6 @@ mod:block {
id = "sand",
name = "Sand",
tiles = "sand.png",
harvest_requirements = 2,
}

mod:block {
Expand All @@ -112,7 +108,6 @@ mod:block {
tiles = "glass.png",
draw_type = "glass",
is_opaque = false,
harvest_requirements = 1,
}

mod:block {
Expand All @@ -133,7 +128,6 @@ mod:block {
tiles = "oak_planks.png",

hardness = 1,
harvest_requirements = 4,

groups = {
default_planks = 1
Expand All @@ -145,7 +139,6 @@ mod:block {
name = "Glowstone",
tiles = "glowstone.png",
is_light_source = true,
harvest_requirements = 1,
}

mod:block {
Expand Down Expand Up @@ -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
Expand All @@ -207,8 +199,6 @@ mod:block {
name = "Oak Wood Slab",
tiles = "oak_planks.png",

harvest_requirements = 4,

draw_type = "boundingbox",
is_opaque = false,

Expand Down Expand Up @@ -248,7 +238,6 @@ mod:block {
id = "soul_sand",
name = "Soul Sand",
tiles = "soul_sand.png",
harvest_requirements = 2,
}

mod:block {
Expand Down Expand Up @@ -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"} },
Expand All @@ -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},
Expand Down
5 changes: 4 additions & 1 deletion source/common/world/BlockState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}; }
Expand Down

0 comments on commit 9df06a4

Please sign in to comment.