Skip to content

Commit 26a5af7

Browse files
committed
🚧 Update to Blockbench 4.12.0
- Removed internal transparent texture. - Replaced all references to `Group.selected` with `Group.first_selected`.
1 parent 4482a54 commit 26a5af7

File tree

14 files changed

+77
-143
lines changed

14 files changed

+77
-143
lines changed

src/blockbenchTypeMods.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ declare global {
9898
isDataPackPath: typeof isDataPackPath
9999
blueprintSettingErrors: typeof blueprintSettingErrors
100100
openUnexpectedErrorDialog: typeof openUnexpectedErrorDialog
101-
TRANSPARENT_TEXTURE: Texture
102101
BLUEPRINT_FORMAT: typeof BLUEPRINT_FORMAT
103102
BLUEPRINT_CODEC: typeof BLUEPRINT_CODEC
104103
TextDisplay: typeof TextDisplay

src/blueprintFormat.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { injectSvelteCompomponent } from './util/injectSvelteComponent'
77
import { toSafeFuntionName } from './util/minecraftUtil'
88
import { addProjectToRecentProjects } from './util/misc'
99
import { Valuable } from './util/stores'
10-
import { TRANSPARENT_TEXTURE, TRANSPARENT_TEXTURE_MATERIAL, Variant } from './variants'
10+
import { Variant } from './variants'
1111
import FormatPageSvelte from './components/formatPage.svelte'
1212
import { translate } from './util/translation'
1313
import { process } from './systems/modelDataFixerUpper'
@@ -577,9 +577,6 @@ export const BLUEPRINT_FORMAT = new Blockbench.ModelFormat({
577577
events.UNLOAD.subscribe(() => clearInterval(updateBoundingBoxIntervalId), true)
578578
events.UNINSTALL.subscribe(() => clearInterval(updateBoundingBoxIntervalId), true)
579579

580-
thisProject.materials[TRANSPARENT_TEXTURE.uuid] = TRANSPARENT_TEXTURE_MATERIAL
581-
TRANSPARENT_TEXTURE.updateMaterial()
582-
583580
Project.loadingPromises ??= []
584581
Project.loadingPromises.push(
585582
new Promise<void>(resolve => {
@@ -669,7 +666,7 @@ export function saveBlueprint() {
669666
export function updateRotationLock() {
670667
if (!isCurrentFormat()) return
671668
BLUEPRINT_FORMAT.rotation_limit = !(
672-
!!Group.selected ||
669+
!!Group.first_selected ||
673670
!!AnimatedJava.API.TextDisplay.selected.length ||
674671
!!AnimatedJava.API.VanillaItemDisplay.selected.length ||
675672
!!AnimatedJava.API.VanillaBlockDisplay.selected.length ||

src/components/variantConfigDialog.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts" context="module">
22
import { type Valuable } from '../util/stores'
33
import { translate } from '../util/translation'
4-
import { TRANSPARENT_TEXTURE, TextureMap, Variant } from '../variants'
4+
import { TextureMap, Variant } from '../variants'
55
import Checkbox from './dialogItems/checkbox.svelte'
66
import LineInput from './dialogItems/lineInput.svelte'
77
import MissingTexture from '../assets/missing_texture.png'
@@ -19,7 +19,7 @@
1919
export let generateNameFromDisplayName: Valuable<boolean>
2020
export let excludedNodes: Valuable<Array<CollectionItem>>
2121
22-
const availableTextures = [...Texture.all, TRANSPARENT_TEXTURE]
22+
const availableTextures = [...Texture.all]
2323
const primaryTextures = [...Texture.all]
2424
const secondaryTextures = availableTextures
2525

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import './systems/minecraft/blockstateManager'
2020
import './systems/minecraft/assetManager'
2121
import './systems/minecraft/fontManager'
2222
// Misc imports
23-
import { TRANSPARENT_TEXTURE, Variant } from './variants'
23+
import { Variant } from './variants'
2424
import './systems/minecraft/registryManager'
2525
import { MINECRAFT_REGISTRY } from './systems/minecraft/registryManager'
2626
import resourcepackCompiler from './systems/resourcepackCompiler'
@@ -58,7 +58,6 @@ globalThis.AnimatedJava = {
5858
isDataPackPath,
5959
blueprintSettingErrors,
6060
openUnexpectedErrorDialog,
61-
TRANSPARENT_TEXTURE,
6261
BLUEPRINT_FORMAT,
6362
BLUEPRINT_CODEC,
6463
TextDisplay,

src/interface/boneConfigDialog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export const BONE_CONFIG_ACTION = createAction(`${PACKAGE.name}:bone_config`, {
174174
name: translate('action.open_bone_config.name'),
175175
condition: () => Format === BLUEPRINT_FORMAT,
176176
click: () => {
177-
openBoneConfigDialog(Group.selected)
177+
if (!Group.first_selected) return
178+
openBoneConfigDialog(Group.first_selected)
178179
},
179180
})

src/outliner/textDisplay.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ export class TextDisplay extends ResizableOutlinerElement {
215215
}
216216

217217
select() {
218-
if (Group.selected) {
219-
Group.selected.unselect()
218+
if (Group.first_selected) {
219+
Group.first_selected.unselect()
220220
}
221221

222222
if (!Pressing.ctrl && !Pressing.shift) {
@@ -551,7 +551,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_text_display`,
551551
}
552552

553553
selected.forEachReverse(el => el.unselect())
554-
Group.selected && Group.selected.unselect()
554+
Group.first_selected && Group.first_selected.unselect()
555555
textDisplay.select()
556556

557557
Undo.finishEdit('Create Text Display', {

src/outliner/vanillaBlockDisplay.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ export class VanillaBlockDisplay extends ResizableOutlinerElement {
145145
}
146146

147147
select() {
148-
if (Group.selected) {
149-
Group.selected.unselect()
148+
if (Group.first_selected) {
149+
Group.first_selected.unselect()
150150
}
151151
if (!Pressing.ctrl && !Pressing.shift) {
152152
if (Cube.selected.length) {
@@ -428,7 +428,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_vanilla_block_
428428
}
429429

430430
selected.forEachReverse(el => el.unselect())
431-
Group.selected && Group.selected.unselect()
431+
Group.first_selected && Group.first_selected.unselect()
432432
vanillaBlockDisplay.select()
433433

434434
Undo.finishEdit('Create Vanilla Block Display', {

src/outliner/vanillaItemDisplay.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ export class VanillaItemDisplay extends ResizableOutlinerElement {
154154
}
155155

156156
select() {
157-
if (Group.selected) {
158-
Group.selected.unselect()
157+
if (Group.first_selected) {
158+
Group.first_selected.unselect()
159159
}
160160
if (!Pressing.ctrl && !Pressing.shift) {
161161
if (Cube.selected.length) {
@@ -428,7 +428,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_vanilla_item_d
428428
}
429429

430430
selected.forEachReverse(el => el.unselect())
431-
Group.selected && Group.selected.unselect()
431+
Group.first_selected && Group.first_selected.unselect()
432432
vanillaItemDisplay.select()
433433

434434
Undo.finishEdit('Create Vanilla Item Display', {

src/systems/resourcepackCompiler/1.21.1.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { MAX_PROGRESS, PROGRESS, PROGRESS_DESCRIPTION } from '../../interface/exportProgressDialog'
22
import { isResourcePackPath, toSafeFuntionName } from '../../util/minecraftUtil'
3-
import { TRANSPARENT_TEXTURE } from '../../variants'
43
import { IntentionalExportError } from '../exporter'
54
import { ITextureAtlas } from '../minecraft/textureAtlas'
65
import { IRenderedNodes, IRenderedRig } from '../rigRenderer'
@@ -268,16 +267,6 @@ export default async function compileResourcePack(options: {
268267
}
269268
exportedFiles.set(blockAtlasFile, autoStringify(blockAtlas))
270269

271-
// Transparent texture
272-
const transparentTexturePath = PathModule.join(
273-
resourcePackFolder,
274-
'assets/animated_java/textures/blueprint/transparent.png'
275-
)
276-
exportedFiles.set(
277-
transparentTexturePath,
278-
nativeImage.createFromDataURL(TRANSPARENT_TEXTURE.source).toPNG()
279-
)
280-
281270
// Variant Models
282271
for (const variant of Object.values(rig.variants)) {
283272
for (const [boneUuid, variantModel] of Object.entries(variant.models)) {

src/systems/resourcepackCompiler/1.21.2.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { MAX_PROGRESS, PROGRESS, PROGRESS_DESCRIPTION } from '../../interface/exportProgressDialog'
22
import { isResourcePackPath, toSafeFuntionName } from '../../util/minecraftUtil'
3-
import { TRANSPARENT_TEXTURE } from '../../variants'
43
import { IntentionalExportError } from '../exporter'
54
import { type ITextureAtlas } from '../minecraft/textureAtlas'
65
import { IRenderedNodes, IRenderedRig } from '../rigRenderer'
@@ -131,16 +130,6 @@ export default async function compileResourcePack(options: {
131130
)
132131
}
133132

134-
// Transparent texture
135-
const transparentTexturePath = PathModule.join(
136-
resourcePackFolder,
137-
'assets/animated_java/textures/blueprint/transparent.png'
138-
)
139-
exportedFiles.set(
140-
transparentTexturePath,
141-
nativeImage.createFromDataURL(TRANSPARENT_TEXTURE.source).toPNG()
142-
)
143-
144133
// Variant Models
145134
for (const variant of Object.values(rig.variants)) {
146135
for (const [boneUuid, variantModel] of Object.entries(variant.models)) {

0 commit comments

Comments
 (0)