Skip to content

Commit f445256

Browse files
committed
✨ Add Structure Group visualization
1 parent d436ddb commit f445256

2 files changed

Lines changed: 40 additions & 12 deletions

File tree

src/lang/en.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ animated_java:
99
require:
1010
fs: Animated Java requires the fs module to export Data Packs & Resource Packs when exporting, to save and load Blueprints, to validate Blueprint settings, and to cache Minecraft assets.
1111

12+
outliner:
13+
structure_group:
14+
title: Structure Group (Will not create an entity)
15+
1216
action:
1317
open_blueprint_settings:
1418
name: Blueprint Settings

src/mods/groupMod.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
11
import { registerPatch, registerPropertyOverridePatch } from 'blockbench-patch-manager'
2-
import {
3-
activeProjectIsBlueprintFormat,
4-
type IBlueprintDisplayEntityConfigJSON,
5-
} from '../formats/blueprint'
2+
import { activeProjectIsBlueprintFormat } from '../formats/blueprint'
63
import { DisplayEntityConfig } from '../nodeConfigs'
74
import { sanitizeOutlinerElementName } from '../outliner/util'
5+
import type { IDisplayEntityConfigs } from '../systems/rigRenderer'
6+
import { localize } from '../util/lang'
87
import { DeepClonedObjectProperty } from '../util/property'
98

109
declare global {
1110
// @ts-expect-error - Broken BB types
1211
interface Group {
1312
onSummonFunction: string
14-
configs: {
15-
default: IBlueprintDisplayEntityConfigJSON
16-
/**
17-
* @key Variant UUID
18-
* @value Variant Bone Config
19-
*/
20-
variants: Record<string, IBlueprintDisplayEntityConfigJSON>
21-
}
13+
configs: IDisplayEntityConfigs
2214
}
2315
}
2416

17+
registerPropertyOverridePatch({
18+
id: `animated_java:structure-group-icon`,
19+
target: Group.prototype,
20+
key: 'icon',
21+
22+
get: function (this, original) {
23+
if (activeProjectIsBlueprintFormat()) {
24+
if (this.children.some(child => child instanceof Cube)) {
25+
return original
26+
}
27+
return 'account_tree'
28+
}
29+
return original
30+
},
31+
})
32+
33+
registerPropertyOverridePatch({
34+
id: `animated_java:structure-group-title`,
35+
target: Group.prototype,
36+
key: 'title',
37+
38+
get: function (this, original) {
39+
if (activeProjectIsBlueprintFormat()) {
40+
if (this.children.some(child => child instanceof Cube)) {
41+
return original
42+
}
43+
return localize('outliner.structure_group.title')
44+
}
45+
return original
46+
},
47+
})
48+
2549
// region Properties
2650
registerPatch({
2751
id: `animated_java:bone-properties`,

0 commit comments

Comments
 (0)