forked from Lum-Studio/Bedrock-Fluids-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperm_generator_sen.py
More file actions
50 lines (43 loc) · 1.5 KB
/
perm_generator_sen.py
File metadata and controls
50 lines (43 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import json
# Configuration
OUTPUT_FILE = "fluid_block_permutations.json"
FORMAT_VERSION = "1.16.100" # Permutation JSON format version
DEPTH_VALUES = [0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0]
def fluid_state(depth):
thresholds = [
(0.875, "full"),
(0.75, "flowing_0"),
(0.625, "flowing_1"),
(0.5, "flowing_2"),
(0.375, "flowing_3"),
(0.25, "flowing_4"),
(0.125, "flowing_5"),
(0, "empty")
]
for thresh, state in thresholds:
if depth >= thresh:
return state
# Possible slope values including diagonals.
SLOPE_VALUES = ["none", "n", "e", "s", "w", "ne", "nw", "se", "sw"]
permutations = []
for depth in DEPTH_VALUES:
base_state = fluid_state(depth)
percent = int(depth * 100)
for slope in SLOPE_VALUES:
# Geometry identifier pattern: geometry.custom.fluid.oil.<percent>_<slope>
geom_id = f"geometry.custom.fluid.oil.{percent}_{slope}"
condition = f"q.block_state('fluid_state') == '{base_state}' && q.block_state('slope') == '{slope}'"
entry = {
"condition": condition,
"components": {
"minecraft:geometry": geom_id
}
}
permutations.append(entry)
output = {
"format_version": FORMAT_VERSION,
"minecraft:client_block_permutations": permutations
}
with open(OUTPUT_FILE, "w") as f:
json.dump(output, f, indent=2)
print(f"Generated {len(permutations)} permutation entries in '{OUTPUT_FILE}'.")