Skip to content

Commit 7a22aab

Browse files
committed
use predicate to check blocks
1 parent dffdfd9 commit 7a22aab

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

gm4_apple_trees/beet.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ id: gm4_apple_trees
22
name: Apple Trees
33
version: 2.5.X
44

5+
require:
6+
- bolt
7+
58
data_pack:
69
load: .
710

gm4_apple_trees/data/gm4_apple_trees/function/sapling/generate_tree.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
# place jigsaw gm4_apple_trees:apple_trees gm4_apple_trees:trunk 2 ~ ~1 ~
77
# jigsaw generation not usable after world-gen due to inherent position-based randomizaton
8-
execute store result score $blocks_moved gm4_apple_data run clone ~-4 ~1 ~-4 ~4 ~7 ~4 ~-4 ~1 ~-4 filtered #gm4_apple_trees:tree_placeable force
9-
execute unless score $blocks_moved gm4_apple_data matches 567 run return fail
8+
execute unless predicate gm4_apple_trees:valid_placement run return fail
109
function gm4_apple_trees:sapling/grow/generate_random_tree
1110
execute if block ~ ~-1 ~ grass_block run setblock ~ ~-1 ~ dirt
1211
execute positioned ~ ~1 ~ as @e[type=armor_stand,tag=gm4_apple_uninitialized,distance=..6] run function gm4_apple_trees:leaf/initialize
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
check = []
2+
for x in range(-4,5):
3+
for y in range(1,8):
4+
for z in range(-4,5):
5+
check.append(
6+
{
7+
"condition": "minecraft:location_check",
8+
"offsetX": x,
9+
"offsetY": y,
10+
"offsetZ": z,
11+
"predicate": {
12+
"block": {
13+
"blocks": "#gm4_apple_trees:tree_placeable"
14+
}
15+
}
16+
}
17+
)
18+
19+
{
20+
"condition": "minecraft:all_of",
21+
"terms": check
22+
}

0 commit comments

Comments
 (0)