Date: 2023/03/11 18:45:38 UTC-08: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
entity_manipulator_item:
debug: false
type: item
material: Lead
display name: Entity Manipulator
mechanisms:
unbreakable: true
flags:
active_manipulator: false
power: 15
entity_manipulator_inventory:
debug: false
type: inventory
inventory: chest
title: <&E><bold>Entity Manipulator
gui: true
slots:
- [rotate_facing_item] [] [] [] [] [] [] [] [inspector_gadget_item]
- [] [] [] [] [] [] [] [] []
entity_manipulator_command:
debug: false
type: command
name: entitymanipulator
description: A stick that lets you manipulate targeted entities.
usage: /entitymanipulator [<<>optional_amount<>>]
aliases:
- em
permission: give.entitymanipulator
script:
- if <context.args.is_empty>:
- give entity_manipulator_item quantity:1
- narrate "<&E>Right click while holding to select an active manipulator!"
- narrate "<&E>Default Power: 15 - Type <&6>'/em <<>#<>>'<&E> for a different amount!"
- if !<context.args.is_empty>:
- if <player.item_in_hand> matches entity_manipulator_item:
- if <context.args.size> > 1:
- narrate "<&c>Too many arguments provided.. Did you use the correct format?"
- if <context.args.size> == 1 && !<context.args.first.is_decimal>:
- narrate "<&c>Argument provided isn't a number"
- if <context.args.size> == 1 && <context.args.first.is_decimal>:
- narrate "<&E>Manipulator Power set to: <&6><context.args.first.round>"
- inventory flag slot:hand power:<context.args.first.round>
- else if <player.item_in_hand> !matches entity_manipulator_item:
- narrate "Hold the Manipulator in your main hand."
entity_manipulator_item_world:
debug: false
type: world
events:
# - Item Specific Logic
# Player selects item in toolbar.
after player scrolls their hotbar item:entity_manipulator_item:
- narrate "Active Manipulator: <player.inventory.slot[<context.new_slot>].flag[active_manipulator]>"
# Open Inventory and cancel world interaction.
on player right clicks block with:entity_manipulator_item:
- inventory open d:entity_manipulator_inventory
- determine cancelled
# Don't break any blocks.
on player left clicks block with:entity_manipulator_item:
- determine cancelled
# Cancel Damage Dealt to Entity. NPC's still receive a damage triggered event though!!
on player damages entity with:entity_manipulator_item bukkit_priority:high:
- determine cancelled
entity_manipulator_flagging_world:
debug: true
type: world
events:
# - Set Active Manipulation Flags:
# Rotate Item
after player clicks rotate_facing_item in entity_manipulator_inventory:
- if <player.item_in_hand> matches entity_manipulator_item:
- inventory flag slot:hand active_manipulator:rotate_facing
- narrate "<&E>Active Tool Set: <&6>Rotate Entity Clockwise!"
- narrate "<&E>Hold `Sneak` to reverse the rotation direction!"
- inventory close
after player clicks inspector_gadget_item in entity_manipulator_inventory:
- if <player.item_in_hand> matches entity_manipulator_item:
- inventory flag slot:hand active_manipulator:inspector_gadget
- narrate "<&E>Active Tool Set: <&6>Inspector Gadget!"
- inventory close
entity_manipulator_triggered_world:
debug: true
type: world
events:
# - Triggered Logic
on player animates ARM_SWING with:entity_manipulator_item:
- define power <player.item_in_hand.flag[power]>
- define target <player.target>
- if <player.is_sneaking>:
- define power -<player.item_in_hand.flag[power]>
- if <[target].exists>:
- if !<player.item_in_hand.flag[active_manipulator].is_truthy>:
- narrate "<&E>Right click to select a manipulator first!"
# Inspector Gadget Logic
- if <player.item_in_hand.flag[active_manipulator]> == inspector_gadget:
- narrate "<&E>Inspection Results:"
- narrate "<&F>Health: <&6><[target].health.round_to_precision[0.01]>/<[target].health_max>"
- narrate "<&F>X:<&6><[target].location.x.format_number[0.00].pad_left[6]> <&F>Y:<&6><[target].location.y.format_number[0.00].pad_left[6]> <&F>Z:<&6><[target].location.z.format_number[0.00].pad_left[6]>"
- narrate "<&F>Body Yaw: <&6><[target].body_yaw>"
- narrate "<&F>Head Yaw: <&6><[target].location.yaw> <&F>Head Pitch: <&6><[target].location.pitch>"
- narrate "<&F>Sleeping: <&6><[target].is_sleeping>"
- narrate "<&F>Sneaking: <&6><[target].is_sneaking>"
- narrate "<&F>Sitting: <&6><[target].is_sitting>"
- if <[target].item_in_hand> == <item[air]>:
- narrate "<&F>Holding: <&6>Air"
- else:
- if <[target].item_in_hand.has_display>:
- narrate "<&F>Holding: <&6><[target].item_in_hand.display>"
- else:
- narrate "<&F>Holding: <&6><[target].item_in_hand.material.name>"
# Rotation Tool Logic
- if <player.item_in_hand.flag[active_manipulator]> == rotate_facing:
- teleport <[target]> <[target].location.rotate_yaw[<[power]>]>
# Manipulation Item Containers!
inspector_gadget_item:
type: item
material: ender_eye
display name: Inspector Gadget
## adjust <player.target> head_angle:-180 eg
rotate_facing_item:
type: item
material: arrow
display name: Rotate Facing
rotate_body_item:
type: item
material: spectral_arrow
display name: Rotate Body