Skip to content

Commit

Permalink
- Fix block component validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Xterionix committed Oct 8, 2023
1 parent 4122dc3 commit 1bedafc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/shared/app_version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Current bridge. app version
*/
export default 'v1.8.10'
export default 'v1.8.11'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bridge",
"version": "1.8.6",
"version": "1.8.11",
"private": true,
"author": "solvedDev <[email protected]>",
"description": "A powerful add-on editor",
Expand Down
40 changes: 4 additions & 36 deletions static/validate/block_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,45 +129,13 @@ const validate = () => {

else if (removedComponents.has(component_name) && compareVersions.compare(fileFormatVersion, removedComponents.get(component_name), '>=') && compareVersions.compare(removedComponents.get(component_name), projectTargetVersion, '<=')) {

// const msg = removedComponents.get('minecraft:rotation') ? `${component_name} was replaced with minecraft:transformation from ${removedComponents.get(component_name)}` : removedComponents.get('minecraft:destroy_time') ? `${component_name} was replaced with minecraft:destructible_by_mining from ${removedComponents.get(component_name)}` : removedComponents.get('minecraft:explosion_resistance') ? `${component_name} was replaced with minecraft:destructible_by_explosion from ${removedComponents.get(component_name)}` : ;

Node.error = {
is_warning: false,
show: true,
message: `${component_name} was removed`,
fix: {
run: () => {

if (component_name == 'minecraft:rotation') {

let newComponent = { 'minecraft:transformation': {} }
newComponent["minecraft:transformation"]['rotation'] = component.toJSON()

Bridge.GlobalNode.children[0].edit(removedComponents.get(component_name), true)
components.buildFromObject(newComponent)

}

else if (component_name == 'minecraft:destroy_time') {

let newComponent = { 'minecraft:destructible_by_mining': {} }
newComponent["minecraft:destructible_by_mining"]["seconds_to_destroy"] = component.data;

Bridge.GlobalNode.children[0].edit(removedComponents.get(component_name), true)
components.buildFromObject(newComponent)

}

else if (component_name == 'minecraft:explosion_resistance') {

let newComponent = { 'minecraft:destructible_by_explosion': {} }
newComponent["minecraft:destructible_by_explosion"]["explosion_resistance"] = component.data;

Bridge.GlobalNode.children[0].edit(removedComponents.get(component_name), true)
components.buildFromObject(newComponent)

}

components.removeNode(component)

Tab.setUnsaved();
Expand All @@ -192,8 +160,8 @@ const validate = () => {
let newComponent = { 'minecraft:transformation': {} }
newComponent["minecraft:transformation"]['rotation'] = component.toJSON()

Bridge.GlobalNode.children[0].edit(removedComponents.get(component_name), true)
components.buildFromObject(newComponent)
Bridge.GlobalNode.children[0].edit(replacedComponents.get(component_name), true)

}

Expand All @@ -202,8 +170,8 @@ const validate = () => {
let newComponent = { 'minecraft:destructible_by_mining': {} }
newComponent["minecraft:destructible_by_mining"]["seconds_to_destroy"] = component.data;

Bridge.GlobalNode.children[0].edit(removedComponents.get(component_name), true)
components.buildFromObject(newComponent)
Bridge.GlobalNode.children[0].edit(replacedComponents.get(component_name), true)

}

Expand All @@ -212,8 +180,8 @@ const validate = () => {
let newComponent = { 'minecraft:destructible_by_explosion': {} }
newComponent["minecraft:destructible_by_explosion"]["explosion_resistance"] = component.data;

Bridge.GlobalNode.children[0].edit(removedComponents.get(component_name), true)
components.buildFromObject(newComponent)
Bridge.GlobalNode.children[0].edit(replacedComponents.get(component_name), true)

}

Expand All @@ -227,8 +195,8 @@ const validate = () => {
if (json.looping) newComponent["minecraft:queued_ticking"]["looping"] = json.looping;
if (json.on_tick) newComponent["minecraft:queued_ticking"]["on_tick"] = json.on_tick;

Bridge.GlobalNode.children[0].edit(replacedComponents.get(component_name), true)
components.buildFromObject(newComponent)
Bridge.GlobalNode.children[0].edit(replacedComponents.get(component_name), true)

}

Expand Down

0 comments on commit 1bedafc

Please sign in to comment.