11import { isCurrentFormat } from '../blueprintFormat'
2- import { TextDisplayConfig } from '../nodeConfigs'
2+ import { BoneConfig } from '../nodeConfigs'
33import { PACKAGE } from '../constants'
44import { createAction } from '../util/moddingTools'
55import { Valuable } from '../util/stores'
@@ -11,10 +11,10 @@ import VanillaBlockDisplayConfigDialog from '../components/vanillaBlockDisplayCo
1111
1212export function openVanillaBlockDisplayConfigDialog ( display : VanillaBlockDisplay ) {
1313 // Blockbench's JSON stringifier doesn't handle custom toJSON functions, so I'm storing the config JSON in the bone instead of the actual BoneConfig object
14- const oldConfig = TextDisplayConfig . fromJSON (
15- ( display . config ??= new TextDisplayConfig ( ) . toJSON ( ) )
16- )
14+ const oldConfig = BoneConfig . fromJSON ( ( display . config ??= new BoneConfig ( ) . toJSON ( ) ) )
1715
16+ const customName = new Valuable ( oldConfig . customName )
17+ const customNameVisible = new Valuable ( oldConfig . customNameVisible )
1818 const billboard = new Valuable ( oldConfig . billboard as string )
1919 const overrideBrightness = new Valuable ( oldConfig . overrideBrightness )
2020 const brightnessOverride = new Valuable ( oldConfig . brightnessOverride )
@@ -34,6 +34,8 @@ export function openVanillaBlockDisplayConfigDialog(display: VanillaBlockDisplay
3434 component : VanillaBlockDisplayConfigDialog ,
3535 props : {
3636 variant : Variant . selected ,
37+ customName,
38+ customNameVisible,
3739 billboard,
3840 overrideBrightness,
3941 brightnessOverride,
@@ -48,8 +50,10 @@ export function openVanillaBlockDisplayConfigDialog(display: VanillaBlockDisplay
4850 } ,
4951 preventKeybinds : true ,
5052 onConfirm ( ) {
51- const newConfig = new TextDisplayConfig ( )
53+ const newConfig = new BoneConfig ( )
5254
55+ newConfig . customName = customName . get ( )
56+ newConfig . customNameVisible = customNameVisible . get ( )
5357 newConfig . billboard = billboard . get ( ) as any
5458 newConfig . overrideBrightness = overrideBrightness . get ( )
5559 newConfig . brightnessOverride = brightnessOverride . get ( )
@@ -62,8 +66,11 @@ export function openVanillaBlockDisplayConfigDialog(display: VanillaBlockDisplay
6266 newConfig . shadowStrength = shadowStrength . get ( )
6367 newConfig . useNBT = useNBT . get ( )
6468
65- const defaultConfig = TextDisplayConfig . getDefault ( )
69+ const defaultConfig = BoneConfig . getDefault ( )
6670
71+ newConfig . customName === defaultConfig . customName && ( newConfig . customName = undefined )
72+ newConfig . customNameVisible === defaultConfig . customNameVisible &&
73+ ( newConfig . customNameVisible = undefined )
6774 newConfig . billboard === defaultConfig . billboard && ( newConfig . billboard = undefined )
6875 newConfig . overrideBrightness === defaultConfig . overrideBrightness &&
6976 ( newConfig . overrideBrightness = undefined )
0 commit comments