Date: 2024/08/06 11:43:26 UTC-07:00
Type: Denizen Script
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Run update_chunk def.ChunkX:31 def.ChunkZ:3 def.ChunkWorld:world_sky
update_chunk:
debug: false
type: task
script:
# Run update_chunk def.ChunkX:31 def.ChunkZ:3 def.ChunkWorld:world_sky
- define Toaster_Dev true
- if <[ChunkX].exists> = false:
- define ChunkX:0
- if <[ChunkZ].exists> = false:
- define ChunkZ:0
- if <[ChunkWorld].exists> = false:
- define ChunkWorld:world_sky
- define ProcessChunk <chunk[<[ChunkX]>,<[ChunkZ]>,<[ChunkWorld]>]>
- define MinX <[ChunkX]>
- define MinX:*:16
- define MinZ <[ChunkZ]>
- define MinZ:*:16
- define MaxX <[MinX]>
- define MaxX:+:15
- define MaxZ <[MinZ]>
- define MaxZ:+:15
# Debugging Information
- if <[Toaster_Dev]> = true:
- narrate "Updating Chunk: <[ProcessChunk]> Loaded: <chunk[<[ProcessChunk]>].is_loaded>"
- narrate "BoundingBox is: X:<[MinX]> - <[MaxX]> Z:<[MinZ]> - <[MaxZ]>"
# Load the chunk if not loaded
- if <chunk[<[ProcessChunk]>].is_loaded> = false:
- chunkload <[ProcessChunk]>
# Replace Blocks
- definemap block_replacements black_concrete:deepslate
- definemap saplings cherry_sapling:cherry mangrove_propagule:mangrove
- define blocks <[ProcessChunk].cuboid.blocks>
- foreach <[blocks]> as:block:
- define replace_y <[block].y>
- if <[block].material.name> = command_block:
- define command <[block].command_block>
- define parts <[command].split[ ]>
- define block_type <[parts].get[2]>
# Handle saplings and generate trees
- if <[block_type]> in <[saplings].keys>:
- modifyblock <[block]> air
- adjust <[block]> generate_tree:<[saplings.<[block_type]>]>
- else:
- define counter:3
- define counter_2:4
- while <[counter]> >= 3:
- modifyblock <[block]> <[block_type]>
- if <[parts].get[<[counter]>].exists>:
- if <[parts].get[<[counter_2]>].exists>:
- narrate <[parts].get[<[counter]>]>:<[parts].get[<[counter_2]>]>
- if <[parts].get[<[counter]>]> = "direction":
- adjustblock <[block]> direction:<[parts].get[<[counter_2]>]>
- if <[parts].get[<[counter]>]> = "waterlogged":
- adjustblock <[block]> waterlogged:<[parts].get[<[counter_2]>]>
- if <[parts].get[<[counter]>]> = "age":
- adjustblock <[block]> age:<[parts].get[<[counter_2]>]>
- else:
- define counter:0
- define counter:+:1
- define counter_2:+:1
# Replace blocks based on the replacement dictionary
- if <[block].material.name> in <[block_replacements].keys>:
- modifyblock <[block]> <[block_replacements.<[block].material.name>]>