Date: 2025/09/09 16:06:48 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
set_model:
type: task
definitions: display
script:
- define loc <player.location.add[0,0,0]>
- modifyblock <[loc]> stone
- spawn entity display_entity <[loc]>
- note <[display]> as:custom_model_display
- adjust <[display]> custom_model_data:123
ModelPlacingSystemInventory:
type: inventory
inventory: chest
title: <script[inventory_data].data_key[small].parsed>
gui: true
slots:
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
Model_Placing_System_Data:
type: data
models:
bench_model:
name: Bench
description: a nice bench model
item: stone
model_id: 1001
box_model:
name: Box
description: a nice box model
item: stone
model_id: 1057
chair_model:
name: Chair
description: a nice chair model
item: stone
model_id: 1060
open_ModelPlacingInventory:
type: task
script:
- define inventory <inventory[modelplacingsysteminventory]>
- define models_data <script[model_placing_system_data].data_key[models]>
- define slot 11
- inventory set d:<[inventory]> slot:23 o:<item[barrier].with[display=<red><bold>Close]>
- foreach <[models_data]> key:model as:value:
- define model_name <[value.name]>
- inventory set d:<[inventory]> slot:<[slot]> o:<item[<[value.item]>].with[custom_model_data=<[value.model_id]>;display=<yellow><[value.name]>;lore=<empty>|<gray><[value.description]>|<empty>|<yellow>Click Here].with_flag[model:<[model]>]>
- define slot:++
- if <[slot]> < 17:
- repeat <[slot]> from:<[slot]> as:num:
- if <[slot]> >= 18:
- repeat stop
- define slot:++
- inventory open destination:<[inventory]>
ModelPlacingPurchaseConfirm:
type: inventory
inventory: chest
title: <script[inventory_data].data_key[small].parsed>
gui: true
slots:
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
open_model_placing_purchase_confirm:
type: task
definitions: model
script:
- define inventory <inventory[modelplacingpurchaseconfirm]>
- define models_data <script[model_placing_system_data].data_key[models]>
- define model_data <[models_data.<[model]>]>
- inventory set d:<[inventory]> slot:13 o:<item[green_wool].with[display=<green>Confirm;lore=<yellow><[model_data.description]>].with_flag[model:<[model]>]>
- inventory set d:<[inventory]> slot:15 o:<item[red_wool].with[display=<red>Cancel]>
- inventory open destination:<[inventory]>
ModelPlacingHandler:
type: world
debug: false
events:
on player clicks item in ModelPlacingSystemInventory:
- stop if:<context.clicked_inventory.equals[<player.inventory>]>
- define item <context.item>
- define slot <context.slot>
- define model <[item].flag[model]>
- stop if:<[item].equals[<item[air]>]>
- if <[slot].equals[23]>:
- inventory close
- if <[item].has_flag[model]>:
- run open_model_placing_purchase_confirm def:<[model]>
on player clicks item in modelplacingpurchaseconfirm:
- stop if:<context.clicked_inventory.equals[<player.inventory>]>
- define item <context.item>
- define slot <context.slot>
- define model <[item].flag[model]>
- stop if:<[item].equals[<item[air]>]>
- if <[slot].equals[15]>:
- run open_modelplacinginventory
- if <[slot].equals[13]>:
- run ModelConfirmPurchase def:<[model]>
on player right clicks block:
- stop if:<context.item.equals[<item[air]>]>
- if <context.item.has_flag[model]>:
- define item <context.item>
- define model <[item].flag[model]>
- define loc <player.location.up[0.8].points_between[<player.eye_location.ray_trace[entities=*;ignore=<player>;fluids=false;nonsolids=false;default=air;range=20]>].distance[2]>
- modifyblock <[loc]> barrier
- spawn entity display_entity <[loc]> save:entity
- define display <entry[entity].spawned_entity>
- note <[display]> as:<[model.name]>
- adjust <[display]> custom_model_data:<[model.model_id]>
on player places stone:
- define model_id <player.item_in_hand.custom_model_data>
- define size <map[1001:3;1057:2;1060:2].get[<[model_id]>]||1>
- define base <context.location.center>
- define base_x <[base].x.round>
- define base_y <[base].y.round>
- define base_z <[base].z.round>
# Spawn model
- define model_loc <[base].add[0, 0.1, 0]>
- spawn item_display[scale=1,5,1.5,1.5;item=<player.item_in_hand>] <[model_loc]> save:model
# Place barriers according to size
- repeat <[size]> as:x:
- repeat <[size]> as:z:
- define offset_x <[x].sub[<[size].div[2].round_down>]>
- define offset_z <[z].sub[<[size].div[2].round_down>]>
- define loc <location[<[base_x].add[<[offset_x]>]>,<[base_y]>,<[base_z].add[<[offset_z]>]>]>
- modifyblock <[loc]> barrier
- take item:<player.item_in_hand>
ModelConfirmPurchase:
type: task
definitions: model
script:
- define inventory <inventory[moidelplacingpurchaseconfirm]>
- define models_data <script[model_placing_system_data].data_key[models]>
- define model_data <[models_data.<[model]>]>
- inventory close
- give <item[<[model_data.item]>].with[custom_model_data=<[model_data.model_id]>].with_flag[model:<[model_data]>].with[display=<[model_data.name]>;lore=<[model_data.description]>]> quantity:1
- narrate "<green>You have got <[model_data.name]>"