@@ -17,7 +17,7 @@ import { sanitizeOutlinerElementName } from './util'
17
17
const ERROR_OUTLINE_MATERIAL = Canvas . outlineMaterial . clone ( )
18
18
ERROR_OUTLINE_MATERIAL . color . set ( '#ff0000' )
19
19
20
- interface VanillaBlockDisplayOptions {
20
+ interface BlockDisplayOptions {
21
21
name ?: string
22
22
block ?: string
23
23
position ?: ArrayVector3
@@ -26,12 +26,12 @@ interface VanillaBlockDisplayOptions {
26
26
visibility ?: boolean
27
27
}
28
28
29
- export class VanillaBlockDisplay extends ResizableOutlinerElement {
29
+ export class BlockDisplay extends ResizableOutlinerElement {
30
30
static type = `${ PACKAGE . name } :vanilla_block_display`
31
- static selected : VanillaBlockDisplay [ ] = [ ]
32
- static all : VanillaBlockDisplay [ ] = [ ]
31
+ static selected : BlockDisplay [ ] = [ ]
32
+ static all : BlockDisplay [ ] = [ ]
33
33
34
- public type = VanillaBlockDisplay . type
34
+ public type = BlockDisplay . type
35
35
public icon = 'deployed_code'
36
36
public needsUniqueName = true
37
37
@@ -54,12 +54,12 @@ export class VanillaBlockDisplay extends ResizableOutlinerElement {
54
54
55
55
public ready = false
56
56
57
- constructor ( data : VanillaBlockDisplayOptions , uuid = guid ( ) ) {
57
+ constructor ( data : BlockDisplayOptions , uuid = guid ( ) ) {
58
58
super ( data , uuid )
59
- VanillaBlockDisplay . all . push ( this )
59
+ BlockDisplay . all . push ( this )
60
60
61
- for ( const key in VanillaBlockDisplay . properties ) {
62
- VanillaBlockDisplay . properties [ key ] . reset ( this )
61
+ for ( const key in BlockDisplay . properties ) {
62
+ BlockDisplay . properties [ key ] . reset ( this )
63
63
}
64
64
65
65
this . name = 'block_display'
@@ -120,10 +120,10 @@ export class VanillaBlockDisplay extends ResizableOutlinerElement {
120
120
}
121
121
122
122
getUndoCopy ( ) {
123
- const copy = { } as VanillaBlockDisplayOptions & { uuid : string ; type : string }
123
+ const copy = { } as BlockDisplayOptions & { uuid : string ; type : string }
124
124
125
- for ( const key in VanillaBlockDisplay . properties ) {
126
- VanillaBlockDisplay . properties [ key ] . copy ( this , copy )
125
+ for ( const key in BlockDisplay . properties ) {
126
+ BlockDisplay . properties [ key ] . copy ( this , copy )
127
127
}
128
128
129
129
copy . uuid = this . uuid
@@ -133,8 +133,8 @@ export class VanillaBlockDisplay extends ResizableOutlinerElement {
133
133
134
134
getSaveCopy ( ) {
135
135
const el : any = { }
136
- for ( const key in VanillaBlockDisplay . properties ) {
137
- VanillaBlockDisplay . properties [ key ] . copy ( this , el )
136
+ for ( const key in BlockDisplay . properties ) {
137
+ BlockDisplay . properties [ key ] . copy ( this , el )
138
138
}
139
139
el . uuid = this . uuid
140
140
el . type = this . type
@@ -154,7 +154,7 @@ export class VanillaBlockDisplay extends ResizableOutlinerElement {
154
154
}
155
155
}
156
156
157
- VanillaBlockDisplay . selected . safePush ( this )
157
+ BlockDisplay . selected . safePush ( this )
158
158
this . selectLow ( )
159
159
this . showInOutliner ( )
160
160
updateSelection ( )
@@ -175,25 +175,25 @@ export class VanillaBlockDisplay extends ResizableOutlinerElement {
175
175
Timeline . selected . empty ( )
176
176
}
177
177
Project ! . selected_elements . remove ( this )
178
- VanillaBlockDisplay . selected . remove ( this )
178
+ BlockDisplay . selected . remove ( this )
179
179
this . selected = false
180
180
TickUpdates . selection = true
181
181
this . preview_controller . updateHighlight ( this )
182
182
}
183
183
}
184
- new Property ( VanillaBlockDisplay , 'string' , 'block' , { default : 'minecraft:stone' } )
185
- new Property ( VanillaBlockDisplay , 'object' , 'config' , {
184
+ new Property ( BlockDisplay , 'string' , 'block' , { default : 'minecraft:stone' } )
185
+ new Property ( BlockDisplay , 'object' , 'config' , {
186
186
get default ( ) {
187
187
return new GenericDisplayConfig ( ) . toJSON ( )
188
188
} ,
189
189
} )
190
- OutlinerElement . registerType ( VanillaBlockDisplay , VanillaBlockDisplay . type )
190
+ OutlinerElement . registerType ( BlockDisplay , BlockDisplay . type )
191
191
192
- export const PREVIEW_CONTROLLER = new NodePreviewController ( VanillaBlockDisplay , {
193
- setup ( el : VanillaBlockDisplay ) {
192
+ export const PREVIEW_CONTROLLER = new NodePreviewController ( BlockDisplay , {
193
+ setup ( el : BlockDisplay ) {
194
194
ResizableOutlinerElement . prototype . preview_controller . setup ( el )
195
195
} ,
196
- updateGeometry ( el : VanillaBlockDisplay ) {
196
+ updateGeometry ( el : BlockDisplay ) {
197
197
if ( ! el . mesh ) return
198
198
199
199
void getBlockModel ( el . block )
@@ -231,10 +231,10 @@ export const PREVIEW_CONTROLLER = new NodePreviewController(VanillaBlockDisplay,
231
231
el . ready = true
232
232
} )
233
233
} ,
234
- updateTransform ( el : VanillaBlockDisplay ) {
234
+ updateTransform ( el : BlockDisplay ) {
235
235
ResizableOutlinerElement . prototype . preview_controller . updateTransform ( el )
236
236
} ,
237
- updateHighlight ( el : VanillaBlockDisplay , force ?: boolean | VanillaBlockDisplay ) {
237
+ updateHighlight ( el : BlockDisplay , force ?: boolean | BlockDisplay ) {
238
238
if ( ! isCurrentFormat ( ) || ! el ?. mesh ) return
239
239
const highlighted = Modes . edit && ( force === true || force === el || el . selected ) ? 1 : 0
240
240
@@ -253,11 +253,11 @@ export const PREVIEW_CONTROLLER = new NodePreviewController(VanillaBlockDisplay,
253
253
} ,
254
254
} )
255
255
256
- class VanillaBlockDisplayAnimator extends BoneAnimator {
256
+ class BlockDisplayAnimator extends BoneAnimator {
257
257
private __name : string
258
258
259
259
public uuid : string
260
- public element : VanillaBlockDisplay | undefined
260
+ public element : BlockDisplay | undefined
261
261
262
262
constructor ( uuid : string , animation : _Animation , name : string ) {
263
263
super ( uuid , animation , name )
@@ -266,7 +266,7 @@ class VanillaBlockDisplayAnimator extends BoneAnimator {
266
266
}
267
267
268
268
getElement ( ) {
269
- this . element = OutlinerNode . uuids [ this . uuid ] as VanillaBlockDisplay
269
+ this . element = OutlinerNode . uuids [ this . uuid ] as BlockDisplay
270
270
return this . element
271
271
}
272
272
@@ -371,8 +371,8 @@ class VanillaBlockDisplayAnimator extends BoneAnimator {
371
371
return this
372
372
}
373
373
}
374
- VanillaBlockDisplayAnimator . prototype . type = VanillaBlockDisplay . type
375
- VanillaBlockDisplay . animator = VanillaBlockDisplayAnimator as any
374
+ BlockDisplayAnimator . prototype . type = BlockDisplay . type
375
+ BlockDisplay . animator = BlockDisplayAnimator as any
376
376
377
377
createBlockbenchMod (
378
378
`${ PACKAGE . name } :vanillaBlockDisplay` ,
@@ -387,12 +387,12 @@ createBlockbenchMod(
387
387
context . subscriptions . push (
388
388
EVENTS . SELECT_PROJECT . subscribe ( project => {
389
389
project . vanillaBlockDisplays ??= [ ]
390
- VanillaBlockDisplay . all . empty ( )
391
- VanillaBlockDisplay . all . push ( ...project . vanillaBlockDisplays )
390
+ BlockDisplay . all . empty ( )
391
+ BlockDisplay . all . push ( ...project . vanillaBlockDisplays )
392
392
} ) ,
393
393
EVENTS . UNSELECT_PROJECT . subscribe ( project => {
394
- project . vanillaBlockDisplays = [ ...VanillaBlockDisplay . all ]
395
- VanillaBlockDisplay . all . empty ( )
394
+ project . vanillaBlockDisplays = [ ...BlockDisplay . all ]
395
+ BlockDisplay . all . empty ( )
396
396
} )
397
397
)
398
398
return context
@@ -416,7 +416,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_vanilla_block_
416
416
click ( ) {
417
417
Undo . initEdit ( { outliner : true , elements : [ ] , selection : true } )
418
418
419
- const vanillaBlockDisplay = new VanillaBlockDisplay ( { } ) . init ( )
419
+ const vanillaBlockDisplay = new BlockDisplay ( { } ) . init ( )
420
420
const group = getCurrentGroup ( )
421
421
422
422
if ( group instanceof Group ) {
@@ -444,7 +444,7 @@ export function debugBlocks() {
444
444
const block = MINECRAFT_REGISTRY . block . items [ i ]
445
445
const x = ( i % maxX ) * 32
446
446
const y = Math . floor ( i / maxX ) * 32
447
- new VanillaBlockDisplay ( { name : block , block, position : [ x , 8 , y ] } ) . init ( )
447
+ new BlockDisplay ( { name : block , block, position : [ x , 8 , y ] } ) . init ( )
448
448
}
449
449
}
450
450
@@ -459,7 +459,7 @@ export async function debugBlockState(block: string) {
459
459
const x = ( i % maxX ) * 32
460
460
const y = Math . floor ( i / maxX ) * 32
461
461
const str = generateBlockStateString ( permutations [ i ] )
462
- new VanillaBlockDisplay ( {
462
+ new BlockDisplay ( {
463
463
name : block + str ,
464
464
block : block + str ,
465
465
position : [ x , 8 , y ] ,
0 commit comments