Skip to content

Commit 531b7ba

Browse files
committed
Added 'Grass Path' block, which is possible to create with any shovel.
1 parent 7497b6b commit 531b7ba

File tree

6 files changed

+42
-3
lines changed

6 files changed

+42
-3
lines changed

mods/default/blocks.lua

+9
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,15 @@ mod:block {
343343
bounding_box = {0, 0, 0, 1, 1, 15 / 16},
344344
}
345345

346+
mod:block {
347+
id = "grass_path",
348+
name = "Grass Path",
349+
tiles = {"grass_path_top.png", "dirt.png", "grass_path_side.png"},
350+
351+
draw_type = "boundingbox",
352+
bounding_box = {0, 0, 0, 1, 1, 15 / 16},
353+
}
354+
346355
dofile("blocks/workbench.lua")
347356
dofile("blocks/furnace.lua")
348357
dofile("blocks/door.lua")

mods/default/items.lua

+33-3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ mod:item {
6565
tiles = "stone_shovel.png",
6666
mining_speed = 4,
6767
harvest_capability = 2,
68+
69+
on_item_activated = function(pos, block, player, world, client, server, screen_width, screen_height, gui_scale)
70+
if block:string_id() == "default:grass" then
71+
world:set_block_from_str(pos.x, pos.y, pos.z, "default:grass_path")
72+
end
73+
end
6874
}
6975

7076
mod:item {
@@ -133,6 +139,12 @@ mod:item {
133139
tiles = "wooden_shovel.png",
134140
mining_speed = 2,
135141
harvest_capability = 2,
142+
143+
on_item_activated = function(pos, block, player, world, client, server, screen_width, screen_height, gui_scale)
144+
if block:string_id() == "default:grass" then
145+
world:set_block_from_str(pos.x, pos.y, pos.z, "default:grass_path")
146+
end
147+
end
136148
}
137149

138150
mod:item {
@@ -204,7 +216,13 @@ mod:item {
204216
name = "Iron Shovel",
205217
tiles = "iron_shovel.png",
206218
mining_speed = 6,
207-
harvest_capability = 2
219+
harvest_capability = 2,
220+
221+
on_item_activated = function(pos, block, player, world, client, server, screen_width, screen_height, gui_scale)
222+
if block:string_id() == "default:grass" then
223+
world:set_block_from_str(pos.x, pos.y, pos.z, "default:grass_path")
224+
end
225+
end
208226
}
209227

210228
mod:item {
@@ -246,7 +264,13 @@ mod:item {
246264
name = "Diamond Shovel",
247265
tiles = "diamond_shovel.png",
248266
mining_speed = 8,
249-
harvest_capability = 2
267+
harvest_capability = 2,
268+
269+
on_item_activated = function(pos, block, player, world, client, server, screen_width, screen_height, gui_scale)
270+
if block:string_id() == "default:grass" then
271+
world:set_block_from_str(pos.x, pos.y, pos.z, "default:grass_path")
272+
end
273+
end
250274
}
251275

252276
mod:item {
@@ -288,5 +312,11 @@ mod:item {
288312
name = "Golden Shovel",
289313
tiles = "golden_shovel.png",
290314
mining_speed = 10,
291-
harvest_capability = 2
315+
harvest_capability = 2,
316+
317+
on_item_activated = function(pos, block, player, world, client, server, screen_width, screen_height, gui_scale)
318+
if block:string_id() == "default:grass" then
319+
world:set_block_from_str(pos.x, pos.y, pos.z, "default:grass_path")
320+
end
321+
end
292322
}
2.46 KB
Loading
19.2 KB
Loading
406 Bytes
Loading
796 Bytes
Loading

0 commit comments

Comments
 (0)