Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
MIT License

Copyright (c) 2024 Legends Modding

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

MIT License

Copyright (c) 2023 Mojang

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Minecraft Legends Blockbench Plugin

Allows users to export both "Bedrock" format models(cubes) and "Generic" format models(meshes) to a JSON file readable by Minecraft Legends.

Originally by House of How, improved by Miclee.
127 changes: 118 additions & 9 deletions Source/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions Source/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "blockbenchplugins",
"version": "1.0.0",
"description": "Blockbench plugin to export bedrock models to Minecraft Legends",
"description": "Blockbench plugin to export Bedrock and Generic models to Minecraft Legends",
"main": "index.js",
"dependencies": {
"@types/three": "^0.169.0",
"three": "^0.169.0",
"typescript": "^4.9.5"
},
"scripts": {
Expand All @@ -13,7 +15,11 @@
"devDependencies": {
"blockbench-types": "^4.6.1"
},
"keywords": [],
"author": "HouseOfHow",
"license": "ISC"
}
"keywords": ["blockbench", "polymesh"],
"contributors": [
"HouseOfHow",
"Mojang",
"Legends Modding"
],
"license": "MIT"
}
20 changes: 15 additions & 5 deletions Source/src/minecraftLegendsExporter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//ONLY WORKS ON BEDROCK ENTITY!!!!
//All the @ts-ignore are due to blockbench-types not being as up to date as the blockbench source
(function () {
var codec: Codec = new Codec('minecraftLegends', {
Expand All @@ -9,7 +8,7 @@
compile(scale: any) {
let bones: any = []; // Converted Minecraft Legends bones

// Turns a Group (blockbensh bone) into a Minecraft Legends bone including any locators in that bone.
// Turns a Group (BlockBench bone) into a Minecraft Legends bone including any locators in that bone.
function addBone(group: Group) {
// Find all locators for this bone
let locators: Locator[] = [];
Expand Down Expand Up @@ -77,6 +76,15 @@
return;
addBone(group);
})

// Process existing Blockbench meshes
function collectMeshes() {
let old_meshes = [];
Mesh.all.forEach(mesh => {
old_meshes.push(mesh);
})
return old_meshes;
}

// Convert all exportable cubes into Blockbench Meshes.
// Cubes are defined by their center and size, and Meshes are defined by vertices and faces.
Expand Down Expand Up @@ -142,13 +150,14 @@
})
new_meshes.push(mesh);
})

return new_meshes;
}

// Minecraft Legends Meshes
let compiledMeshes: any = [];

// Converts a Blockbensh Mesh into a Minecraft Legends Mesh.
// Converts a BlockBench Mesh into a Minecraft Legends Mesh.
// A Minecraft Legends Mesh is a skinned mesh, defined by vertices and triangles, where the vertices
// are specified in the bind pose.
// Each vertex here has a single bone with a bone weight of 1.
Expand Down Expand Up @@ -253,7 +262,9 @@

compiledMeshes.push(compliedMesh)
}

collectMeshes().forEach((m: Mesh) => {
addMesh(m);
})
// Convert cubes to Minecraft Legends Meshes
convertCubesToMeshes().forEach((m: Mesh) => {
addMesh(m);
Expand Down Expand Up @@ -347,7 +358,6 @@
name: 'Minecraft Legends Exporter',
icon: 'icon-format_block',
category: 'export',
condition: () => Format.id == "bedrock" || Format.id == "bedrock_old",
click: function () {
if (codec.export !== undefined) {
codec.export();
Expand Down
2 changes: 1 addition & 1 deletion Source/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES6",
"target": "ES2017",
"skipLibCheck": true,
"outDir": "build"
},
Expand Down
Loading