Skip to content

Commit 4d9f480

Browse files
committed
initial script file for testing with
1 parent ccca38a commit 4d9f480

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Denizen Models
66
This takes the form of two components:
77

88
- DenizenModelsConverter
9+
- `DenizenModelsConverter.sln` and the `DenizenModelsConverter` directory
910
- External program, written in C#
1011
- Needs to be compiled via Visual Studio 2022
1112
- Only tested on Windows 11 currently, but theoretically works anywhere
@@ -14,6 +15,7 @@ This takes the form of two components:
1415
- A `.dmodel.yml` file for the Minecraft server to read
1516
- Planned to eventually be replaced by entirely on-server Denizen scripts eventually
1617
- The Denizen script
18+
- `scripts/` directory `.dsc` files
1719
- Runs on your minecraft server using [Denizen](https://github.com/DenizenScript/Denizen)
1820
- Reads the `.dmodel.yml` file
1921
- Can spawn the models and animate them

scripts/dmodels.dsc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
model_part_stand:
3+
type: entity
4+
debug: false
5+
entity_type: armor_stand
6+
mechanisms:
7+
marker: true
8+
gravity: false
9+
visible: false
10+
custom_name_visible: true
11+
custom_name: part
12+
13+
spawn_model:
14+
type: task
15+
debug: false
16+
definitions: model_name|location
17+
script:
18+
- define location <[location].center>
19+
- define yamlid dmodels_<[model_name]>
20+
- define filename data/models/<[model_name]>.dmodel.yml
21+
- if !<server.has_file[<[filename]>]>:
22+
- debug error "Invalid model <[model_name]>, file does not exist: <[filename]>, cannot load"
23+
- stop
24+
- ~yaml id:<[yamlid]> load:<[filename]>
25+
- define parts <yaml[<[yamlid]>].read[models]>
26+
- yaml unload id:<[yamlid]>
27+
- foreach <[parts]> key:id as:part:
28+
- if <[part.empty]||false>:
29+
- foreach next
30+
- define rots <[part.rotation].split[,].parse[to_radians]>
31+
# Idk wtf is with the scale here. It's somewhere in the range of 25 to 26. 25.45 seems closest in one of my tests,
32+
# but I think that's minecraft packet location imprecision at fault so it's probably just 26.
33+
- define offset <location[<[part.origin]>].div[26].rotate_around_y[<util.pi>]>
34+
- define pose [head=<[rots].get[1].mul[-1]>,<[rots].get[2].mul[-1]>,<[rots].get[3]>]
35+
- spawn model_part_stand[equipment=[helmet=<[part.item]>];armor_pose=<[pose]>] <[location].add[<[offset]>]> save:spawned

0 commit comments

Comments
 (0)