Skip to content

Commit 7fc7743

Browse files
committed
script header
1 parent 32921fd commit 7fc7743

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

scripts/dmodels.dsc

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
# +---------------------------
2+
# |
3+
# | D e n i z en M o d e l s
4+
# | AKA DModels - dynamically animated models in minecraft
5+
# |
6+
# +---------------------------
7+
#
8+
# This takes BlockBench "BBModel" files, converts them (via external program) to resource pack + Denizen-compatible file,
9+
# then is able to display them in minecraft and even animate them, by spawning and moving invisible armor stands with resource pack items on their heads.
10+
#
11+
# Installation:
12+
# 1: Add "models.dsc" to your "plugins/Denizen/scripts" and "/ex reload"
13+
# 2: Make sure you have DenizenModelsConverter.exe on hand, either downloaded or compiled yourself from https://github.com/mcmonkeyprojects/DenizenModels
14+
# 3: Note that you must know the basics of operating resource packs - the pack content will be generated for you, but you must know how to configure the "mcmeta" pack file and how to install a pack on your client
15+
#
16+
# Usage:
17+
# 1: Create a model using blockbench - https://www.blockbench.net/
18+
# Create as a 'Generic Model'
19+
# Make basically anything you want
20+
# Make sure pivot points are as centered as possible to minimize glitchiness from animations
21+
# (animations around a distant pivot point require the armor stand move and turn at the same time, which can lose sync with itself)
22+
# Animate freely, make sure the animation names are clear
23+
# 2: Save the ".bbmodel" file
24+
# 3: Use the DenizenModelsConverter program to convert the bbmodel to a ".dmodel.yml" and a resource pack
25+
# 4: Save the ".dmodel.yml" file into "plugins/Denizen/data/models"
26+
# 5: Load the resource pack on your client (or include it in your server's automatic resource pack)
27+
# 6: Spawn your model and control it using the Denizen scripting API documented below
28+
#
29+
# API usage examples:
30+
# # First load a model
31+
# - ~run dmodels_load_model def.model_name:goat
32+
# # Then you can spawn it
33+
# - run dmodels_spawn_model def.model_name:goat def.location:<player.location> save:spawned
34+
# - define root <entry[spawned].created_queue.determination.first>
35+
# # To move the whole model
36+
# - teleport <[root]> <player.location>
37+
# - run dmodels_reset_model_position def.root_entity:<[root]>
38+
# # To start an automatic animation
39+
# - run dmodels_animate def.root_entity:<[root]> def.animation:idle
40+
# # To end an automatic animation
41+
# - run dmodels_end_animation def.root_entity:<[root]>
42+
# # To move the entity to a single frame of an animation (timespot is a decimal number of seconds from the start of the animation)
43+
# - run dmodels_move_to_frame def.root_entity:<[root]> def.animation:idle def.timespot:0.5
44+
45+
146

247
dmodel_part_stand:
348
type: entity
@@ -65,7 +110,7 @@ dmodels_spawn_model:
65110
- flag <entry[root].spawned_entity> dmodel_anim_part.<[id]>:->:<entry[spawned].spawned_entity>
66111
- determine <entry[root].spawned_entity>
67112

68-
dmodels_correct_to_default_position:
113+
dmodels_reset_model_position:
69114
type: task
70115
debug: false
71116
definitions: root_entity
@@ -74,12 +119,22 @@ dmodels_correct_to_default_position:
74119
- adjust <[part]> armor_pose:[head=<[part].flag[dmodel_def_pose]>]
75120
- teleport <[part]> <[root_entity].location.add[<[part].flag[dmodel_def_offset]>]>
76121

122+
dmodels_end_animation:
123+
type: task
124+
debug: false
125+
definitions: root_entity
126+
script:
127+
- flag <[root_entity]> dmodels_animation_id:!
128+
- flag <[root_entity]> dmodels_anim_time:0
129+
- flag server dmodels_anim_active.<[root_entity].uuid>:!
130+
- run dmodels_reset_model_position def.root_entity:<[root_entity]>
131+
77132
dmodels_animate:
78133
type: task
79134
debug: false
80135
definitions: root_entity|animation
81136
script:
82-
- run dmodels_correct_to_default_position def.root_entity:<[root_entity]>
137+
- run dmodels_reset_model_position def.root_entity:<[root_entity]>
83138
- define animation_data <server.flag[dmodels_data.animations_<[root_entity].flag[dmodel_model_id]>.<[animation]>]||null>
84139
- if <[animation_data]> == null:
85140
- debug error "[DModels] Cannot animate entity <[root_entity].uuid> due to model <[root_entity].flag[dmodel_model_id]> not having an animation named <[animation]>"
@@ -104,7 +159,7 @@ dmodels_move_to_frame:
104159
- if <[root_entity].has_flag[dmodels_default_animation]>:
105160
- run dmodels_animate def.root_entity:<[root_entity]> def.animation:<[root_entity].flag[dmodels_default_animation]>
106161
- else:
107-
- run dmodels_correct_to_default_position def.root_entity:<[root_entity]>
162+
- run dmodels_reset_model_position def.root_entity:<[root_entity]>
108163
- stop
109164
- case hold:
110165
- define timespot <[animation_data.length]>

0 commit comments

Comments
 (0)