Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated BAMO to 0.5.0 to enable 1.20.1 support (and add the animation… #635

Merged
merged 4 commits into from
Oct 11, 2024
Merged
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
14 changes: 8 additions & 6 deletions plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,15 +875,17 @@
"min_version": "4.6.0",
"variant": "both"
},
"bamo": {
"bamo":{
"title": "BAMO Exporter",
"author": "Ryytikki",
"description": "Create custom Minecraft blocks without having to write a single line of code when paired with the BAMO mod. https://www.curseforge.com/minecraft/mc-mods/bamo-block-and-move-on",
"icon": "bar_chart",
"description": "Create custom Minecraft blocks without having to write a single line of code when paired with the BAMO mod.",
"website": "https://www.curseforge.com/minecraft/mc-mods/bamo-block-and-move-on",
"icon": "icon.png",
"tags": ["Minecraft: Java Edition"],
"version": "0.5.0",
"variant": "desktop"
},
"version": "0.5.1",
"variant": "desktop",
"new_respository_format" : true
},
"animation_to_json": {
"title": "Animation to JSON Converter",
"author": "Gaming32",
Expand Down
4,662 changes: 0 additions & 4,662 deletions plugins/bamo.js

This file was deleted.

9,780 changes: 9,780 additions & 0 deletions plugins/bamo/bamo.js

Large diffs are not rendered by default.

Binary file added plugins/bamo/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions plugins/bamo/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/bamo/package.json → plugins/bamo/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"babel-loader": "^8.2.5",
"css-loader": "^6.7.1",
"to-string-loader": "^1.2.0",
"webpack": "^5.75.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ <h1 style="padding:0; text-align: center;">BAMO Exporter</h1>
<p v-if="error=='name'" style="color:red">Block display name cannot be blank</p>
<input type="text" class="dark_bordered" v-model="$parent.$data.properties.displayName" placeholder="Name of the Block">
</li>
<li>
<div class="headerLabel">Minecraft Version</div>
<p class="headerDescription"> The version of minecraft to export for</p>
<select class="dark_bordered" v-model="$parent.$data.properties.version">
<option disabled value="">Please select</option>
<option>1.20.1</option>
<option>1.18.2</option>
<option>1.16.5</option>
</select>
</li>
</ul><br>

<button @click.prevent="changePage($event, 'types')">Continue</button>
Expand Down Expand Up @@ -324,6 +334,11 @@ <h1 style="padding:0; text-align: center;">Other Properties</h1>
<p class="headerDescription">if y_axis, faces the player when placed</p>
<select class="dark_bordered" v-model="$parent.$data.properties.rotType"><option v-for="op in rotationTypes" v-bind:key="op">{{ op }}</option></select>
</li>
<li>
<input type="checkbox" v-model="parentData.properties.animated">
<div class = "headerLabel">Animated Textures (WIP)</div>
<p class = "headerDescription">Enables texture animations. Currently only recommended for single texture models</p>
</li>
</ul>
<br>
<button @click.prevent="changePage($event, 'datapack')">Previous</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ export default {
var blockstatesFolder = settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\assets\\" + this.properties.namespace + "\\blockstates\\";
var blockModelsFolder = settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\assets\\" + this.properties.namespace + "\\models\\block\\";
var itemModelsFolder = settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\assets\\" + this.properties.namespace + "\\models\\item\\";
var blockTexturesFolder = settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\assets\\" + this.properties.namespace + "\\textures\\blocks\\";
var dataFolder = settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\data\\";
var blockTextureFolderVersion = this.properties.version == "1.20.1" ? "block" : "blocks"
var blockTexturesFolder = settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\assets\\" + this.properties.namespace + "\\textures\\" + blockTextureFolderVersion + "\\";

// Create the folders if they dont exist
var folderList = [objFolder, blockstatesFolder, blockModelsFolder, itemModelsFolder, blockTexturesFolder, dataFolder];
Expand All @@ -135,7 +136,9 @@ export default {
})

// Create mcmeta file
var mcmetaData = {"pack" : {"pack_format" : 6, "description" : "Resource Pack for BAMO test files"}};
// Format ID is 15 for 1.20.1, 8 for 1.18.2, and 6 for 1.16.5
var formatID = this.properties.version == "1.20.1" ? 15 : this.properties.version == "1.18.2" ? 8 : 6
var mcmetaData = {"pack" : {"pack_format" : formatID, "description" : "Resource Pack for BAMO test files"}};
fs.writeFile(settings.minecraftFolder.value + "\\bamopacks\\" + packName + "\\pack.mcmeta", JSON.stringify(mcmetaData), "utf8", (err) => {if (err != null) {console.log("Error generating mcmeta file:", err);}});
zip.file("pack.mcmeta", JSON.stringify(mcmetaData))

Expand Down Expand Up @@ -183,7 +186,7 @@ export default {
Texture.all.forEach(function(tx){
if ((tx.id == comp) || (partCheck && tx.particle == true)){
if (tx.namespace == ""){
textureData[key] = ns + ":blocks/" + cleanFileName(tx.name.split(".")[0]);
textureData[key] = ns + ":" + blockTextureFolderVersion + "/" + cleanFileName(tx.name.split(".")[0]);
}else{
textureData[key] = tx.namespace + ":" + tx.folder + "/" + cleanFileName(tx.name.split(".")[0])
}
Expand Down Expand Up @@ -395,6 +398,7 @@ export default {

var modelData = JSON.parse(codecData);
var ns = this.properties.namespace
var animated = this.properties.animated
// Copy texture files
Texture.all.forEach(function(tx){
var image;
Expand All @@ -406,7 +410,11 @@ export default {
}

fs.writeFile(blockTexturesFolder + "\\" + cleanFileName(tx.name), image, (err) => {if (err != null) {console.log("Error Found writing texture data:", err);}});
zip.file("assets/" + ns + "/textures/blocks/" + cleanFileName(tx.name), image)
zip.file("assets/" + ns + "/textures/" + blockTextureFolderVersion + "/" + cleanFileName(tx.name), image)
if (animated){
fs.writeFile(blockTexturesFolder + "\\" + cleanFileName(tx.name) + ".mcmeta", '{"animation" : {}}', (err) => {if (err != null) {console.log("Error Found writing animation data:", err);}})
zip.file("assets/" + ns + "/textures/" + blockTextureFolderVersion + "/" + cleanFileName(tx.name) + ".mcmeta", '{"animation" : {}}')
}
}
})

Expand Down
6 changes: 4 additions & 2 deletions src/bamo/src/main.js → plugins/bamo/src/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Plugin.register('bamo', {
title: 'BAMO Exporter',
author: 'Ryytikki',
description: 'Create custom Minecraft blocks without having to write a single line of code when paired with the BAMO mod. https://www.curseforge.com/minecraft/mc-mods/bamo-block-and-move-on',
icon: 'bar_chart',
website: "https://www.curseforge.com/minecraft/mc-mods/bamo-block-and-move-on",
icon: 'icon.png',
tags: ['Minecraft: Java Edition'],
version: '0.5.0',
version: '0.5.1',
variant: 'desktop',
new_respository_format : true,

onload() {

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const BAMO_SETTINGS_DEFAULT = {
displayName: "",
namespace: "bamo",
version: "1.20.1",
typeList: [],
material: "Dirt",
blastRes: 6,
Expand Down Expand Up @@ -63,7 +64,8 @@ export const BAMO_SETTINGS_DEFAULT = {
bufferedHitbox: true,
hitboxBuffer: 0.5,
genScRecipe: true,
genReversableScRecipe: true
genReversableScRecipe: true,
animated: false
};

Object.freeze(BAMO_SETTINGS_DEFAULT);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ module.exports = {
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.vue$/,
loader: 'vue-loader',
Expand Down
Loading