From 01bb44965defcfa41966da77fdb842b376f02f68 Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Sat, 21 Dec 2024 16:51:28 +0000 Subject: [PATCH] docs: update generator README.md also add deleteBlocks.sh script --- generator/README.md | 51 ++++++++++++++++++++++++++++++++++++++- generator/deleteBlocks.sh | 2 ++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100755 generator/deleteBlocks.sh diff --git a/generator/README.md b/generator/README.md index fce9a78..be7243f 100644 --- a/generator/README.md +++ b/generator/README.md @@ -1,3 +1,52 @@ # @blockmatic/generator -Collection of Node.JS scripts to generate data for blockmatic. +Collection of Node.JS scripts to generate data for blockmatic. See below to see how to use these scripts (they are also in order of use). A bit of knowledge of blockmatic is needed to put the files into the correct locations. + +Before running any of these scripts you need to have a `blocks` directory with Minecraft textures in them. See below on how to do that. + +1. Create a `blocks` directory +2. Open a Minecraft client jar in a zip extraction program (such as 7zip, WinRAR, Xarchiver, etc.) +3. Go to `assets/minecraft/textures/blocks` +4. Copy all textures into the `blocks` directory + +## filter.js + +> Deletes every unneeded texture in the `blocks` directory + +1. Run `node filter.js` +2. Every unneeded texture has been deleted + +## resize.js + +> Resizes image files bigger than 16x16 (these files are usually for animations such as fire) + +1. Run `node resize.js` +2. Every file has been resized accordingly + +## averageColors.js + +> Calculates the average color for each texture and outputs it into a JSON file + +1. Run `node averageColors.js` +2. In the `data` directory there should be a JSON file generated +3. Put that JSON file into `src/data` + +## spritesheet.js + +> Generates a spritesheet for Pixi.JS to use + +1. Run `node spritesheet.js` +2. In the `data` directory there should be two files generated - `spritesheet.json` and `spritesheet.png` +3. Put `spritesheet.png` into the `public` folder +4. Put `spritesheet.json` into `src/data` + +## deleteBlocks.sh + +> (MacOS and Linux only) Deletes every file in the `blocks` folder + +You probably don't need to run this script. + +```bash +$ chmod +x ./deleteBlocks.sh +$ ./deleteBlocks.sh +``` diff --git a/generator/deleteBlocks.sh b/generator/deleteBlocks.sh new file mode 100755 index 0000000..d1a0f1d --- /dev/null +++ b/generator/deleteBlocks.sh @@ -0,0 +1,2 @@ +#!/bin/bash +rm blocks/* \ No newline at end of file