Skip to content

Commit 596ad8e

Browse files
committed
Entity Names
1 parent 6a91dba commit 596ad8e

File tree

5 files changed

+137
-176
lines changed

5 files changed

+137
-176
lines changed

exporters/datapackExporter/exporter/datapackGen/animatedJavaFolderGen.ts

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function getExportVersionId() {
88
}
99

1010
export function generateAnimatedJavaFolder() {
11-
const { formatStr, generateSearchTree, roundToN } = AnimatedJava.API
11+
const { formatStr, generateSearchTree, roundToN, JsonText } = AnimatedJava.API
1212
const { NbtString, NbtList, NbtTag } = AnimatedJava.API.deepslate
1313
const { exporterSettings, renderedAnimations, rig } = G.exportData
1414

@@ -169,14 +169,35 @@ export function generateAnimatedJavaFolder() {
169169

170170
for (const [uuid, camera] of Object.entries(rig.nodeMap)) {
171171
if (camera.type !== 'camera') continue
172-
const cameraNbt = (NbtTag.fromString(camera.nbt) as NbtCompound).set(
173-
'Tags',
174-
new NbtList([
175-
new NbtString(G.TAGS.cameraTarget),
176-
new NbtString(formatStr(G.TAGS.namedCameraTarget, [camera.name])),
177-
new NbtString(G.TAGS.new),
178-
])
179-
)
172+
const cameraNbt = (NbtTag.fromString(camera.nbt) as NbtCompound)
173+
.set(
174+
'Tags',
175+
new NbtList([
176+
new NbtString(G.TAGS.cameraTarget),
177+
new NbtString(formatStr(G.TAGS.namedCameraTarget, [camera.name])),
178+
new NbtString(G.TAGS.new),
179+
])
180+
)
181+
.set(
182+
'CustomName',
183+
new NbtString(
184+
new JsonText([
185+
{ text: '[', color: 'gray' },
186+
{ text: 'AJ', color: 'aqua' },
187+
`] `,
188+
[
189+
'',
190+
{ text: `${G.NAMESPACE}`, color: 'light_purple' },
191+
`.`,
192+
{ text: `cameraTarget`, color: 'white' },
193+
`[`,
194+
{ text: `${camera.name}`, color: 'yellow' },
195+
`]`,
196+
],
197+
]).toString()
198+
)
199+
)
200+
180201
summonFolder
181202
.newFolder(`camera_${camera.name}`)
182203
// ANCHOR - func AJ_NAMESPACE:summon/camera_${camera.name}/as_origin
@@ -203,14 +224,34 @@ export function generateAnimatedJavaFolder() {
203224

204225
for (const [uuid, locator] of Object.entries(rig.nodeMap)) {
205226
if (locator.type !== 'locator') continue
206-
const locatorNbt = (NbtTag.fromString(locator.nbt) as NbtCompound).set(
207-
'Tags',
208-
new NbtList([
209-
new NbtString(G.TAGS.locatorTarget),
210-
new NbtString(formatStr(G.TAGS.namedLocatorTarget, [locator.name])),
211-
new NbtString(G.TAGS.new),
212-
])
213-
)
227+
const locatorNbt = (NbtTag.fromString(locator.nbt) as NbtCompound)
228+
.set(
229+
'Tags',
230+
new NbtList([
231+
new NbtString(G.TAGS.locatorTarget),
232+
new NbtString(formatStr(G.TAGS.namedLocatorTarget, [locator.name])),
233+
new NbtString(G.TAGS.new),
234+
])
235+
)
236+
.set(
237+
'CustomName',
238+
new NbtString(
239+
new JsonText([
240+
{ text: '[', color: 'gray' },
241+
{ text: 'AJ', color: 'aqua' },
242+
`] `,
243+
[
244+
'',
245+
{ text: `${G.NAMESPACE}`, color: 'light_purple' },
246+
`.`,
247+
{ text: `locatorTarget`, color: 'white' },
248+
`[`,
249+
{ text: `${locator.name}`, color: 'yellow' },
250+
`]`,
251+
],
252+
]).toString()
253+
)
254+
)
214255
summonFolder
215256
.newFolder(`locator_${locator.name}`)
216257
// ANCHOR - func AJ_NAMESPACE:summon/locator_${locator.name}/as_origin

exporters/datapackExporter/exporter/datapackGen/globals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ExportData } from '../datapackGen'
22
import { getEntityTypes, getScoreboard, getTags, loopModes } from './data'
3-
import { loadTellrawMessages } from './tellrawMessages'
3+
import { loadTellrawMessages } from './jsonText'
44

55
export class Globals {
66
static exportData: ExportData

exporters/datapackExporter/exporter/datapackGen/tellrawMessages.ts renamed to exporters/datapackExporter/exporter/datapackGen/jsonText.ts

File renamed without changes.

exporters/datapackExporter/exporter/datapackGen/namespaceFolderGen.ts

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function tagJsonMerger(a: any, b: any) {
88
}
99

1010
export function generateNamespaceFolder() {
11-
const { formatStr } = AnimatedJava.API
11+
const { formatStr, JsonText } = AnimatedJava.API
1212
const { NbtCompound, NbtInt, NbtTag, NbtList, NbtString, NbtByte } = AnimatedJava.API.deepslate
1313
const { projectSettings, renderedAnimations, exporterSettings, rig } = G.exportData
1414
const { matrixToNbtFloatArray } = loadUtil()
@@ -163,6 +163,25 @@ export function generateNamespaceFolder() {
163163
)
164164
)
165165
)
166+
.set(
167+
'CustomName',
168+
new NbtString(
169+
new JsonText([
170+
{ text: '[', color: 'gray' },
171+
{ text: 'AJ', color: 'aqua' },
172+
`] `,
173+
[
174+
'',
175+
{ text: `${G.NAMESPACE}`, color: 'light_purple' },
176+
`.`,
177+
{ text: `bone`, color: 'white' },
178+
`[`,
179+
{ text: `${bone.name}`, color: 'yellow' },
180+
`]`,
181+
],
182+
]).toString()
183+
)
184+
)
166185
// FIXME - This doesn't account for animations, and it SHOULD
167186
const maxHeight = Math.max(
168187
Math.abs(bone.boundingBox.min.y),
@@ -202,6 +221,25 @@ export function generateNamespaceFolder() {
202221
.set('Count', new NbtByte(1))
203222
.set('tag', new NbtCompound().set('CustomModelData', new NbtInt(1)))
204223
)
224+
.set(
225+
'CustomName',
226+
new NbtString(
227+
new JsonText([
228+
{ text: '[', color: 'gray' },
229+
{ text: 'AJ', color: 'aqua' },
230+
`] `,
231+
[
232+
'',
233+
{ text: `${G.NAMESPACE}`, color: 'light_purple' },
234+
`.`,
235+
{ text: `locator`, color: 'white' },
236+
`[`,
237+
{ text: `${bone.name}`, color: 'yellow' },
238+
`]`,
239+
],
240+
]).toString()
241+
)
242+
)
205243
break
206244
}
207245
case 'camera': {
@@ -223,6 +261,25 @@ export function generateNamespaceFolder() {
223261
.set('Count', new NbtByte(1))
224262
.set('tag', new NbtCompound().set('CustomModelData', new NbtInt(1)))
225263
)
264+
.set(
265+
'CustomName',
266+
new NbtString(
267+
new JsonText([
268+
{ text: '[', color: 'gray' },
269+
{ text: 'AJ', color: 'aqua' },
270+
`] `,
271+
[
272+
'',
273+
{ text: `${G.NAMESPACE}`, color: 'light_purple' },
274+
`.`,
275+
{ text: `camera`, color: 'white' },
276+
`[`,
277+
{ text: `${bone.name}`, color: 'yellow' },
278+
`]`,
279+
],
280+
]).toString()
281+
)
282+
)
226283
break
227284
}
228285
default: {
@@ -246,6 +303,25 @@ export function generateNamespaceFolder() {
246303
summonTags.add(new NbtString(G.TAGS.globalRigRoot))
247304
summonNbt.set('Tags', summonTags)
248305

306+
if (!summonNbt.get('CustomName')) {
307+
summonNbt.set(
308+
'CustomName',
309+
new NbtString(
310+
new JsonText([
311+
{ text: '[', color: 'gray' },
312+
{ text: 'AJ', color: 'aqua' },
313+
`] `,
314+
[
315+
'',
316+
{ text: `${G.NAMESPACE}`, color: 'light_purple' },
317+
`.`,
318+
{ text: `root`, color: 'white' },
319+
],
320+
]).toString()
321+
)
322+
)
323+
}
324+
249325
const variantSummonFolder = functionsFolder
250326
// ANCHOR - function NAMESPACE:summon
251327
.chainNewFile('summon.mcfunction', [

0 commit comments

Comments
 (0)