1
0
mirror of https://github.com/GeyserMC/GeyserOptionalPack.git synced 2025-12-19 14:59:14 +00:00

Feature/build-script (#11)

* Comment build script and one-line all JSON files

* Add note to readme for building w/o one-lining, and update implements

* Resolve merge conflict and update build script

- Resolve merge conflict
- Edit Jenkinsfile with new script arguments
- Default build script to not apply whitespace removal (use -jc to apply it)

* Add link back to repo in case people find this in the wild

* Fix comment typo

* Fix comment (./prepare_pack.sh -jc)
This commit is contained in:
Kas-tle
2021-04-26 19:37:20 -07:00
committed by GitHub
parent 9bf4e46299
commit ddc4f72384
4 changed files with 40 additions and 16 deletions

4
Jenkinsfile vendored
View File

@@ -6,8 +6,8 @@ pipeline {
stages {
stage ('Build') {
steps {
sh 'bash copy_java_files_to_pack.sh'
sh 'zip GeyserOptionalPack.mcpack -r . -x ".*" Jenkinsfile required_files.txt copy_java_files_to_pack.sh'
sh 'bash prepare_pack.sh -jc'
sh 'zip GeyserOptionalPack.mcpack -r . -x ".*" Jenkinsfile required_files.txt prepare_pack.sh'
}
post {
success {

View File

@@ -1,12 +1,15 @@
# GeyserOptionalPack
Optional Bedrock resource pack to extend Geyser functionality
Optional Bedrock resource pack to extend Geyser functionality. Learn more at [GeyserMC/GeyserOptionalPack](https://github.com/GeyserMC/GeyserOptionalPack).
### Implements
- Armor base arms/baseplate visibility
- Armor stand poses
- Illusioners
- Iron golem cracked textures
- Missing particles
- Offhand animations
- Shulker invisibility parity
- Spectral arrow entity texture
@@ -14,7 +17,7 @@ Currently is not in use yet. Stay tuned!
### Manually building
Run `copy_java_files_to_pack.sh` in this directory and the necessary files from the vanilla jar will be copied to the required directories. Zip up and you're set.
Run `./prepare_pack.sh` in this directory and the necessary files from the vanilla jar will be copied to the required directories. Zip up and you're set. Optionally, you may compress the output JSON files by running `./prepare_pack.sh -jc`. This should not be done when planning to contribute. You may then package with `zip GeyserOptionalPack.mcpack -r . -x ".*" Jenkinsfile required_files.txt prepare_pack.sh`.
### Legal

View File

@@ -1,12 +0,0 @@
wget https://launcher.mojang.com/v1/objects/37fd3c903861eeff3bc24b71eed48f828b5269c8/client.jar
unzip client.jar -d extracted/
IFS=' '
while read -r p || [ -n "$p" ]; do
read -rafilesToCopy<<< "$p"
echo "extracted/${filesToCopy[0]} ${filesToCopy[1]}"
mkdir -p "${filesToCopy[1]}"
cp "extracted/${filesToCopy[0]}" "${filesToCopy[1]}"
done <required_files.txt
convert -append extracted/assets/minecraft/textures/particle/sweep_*.png -define png:format=png8 textures/particle/sweep_attack.png
rm client.jar
rm -r extracted

33
prepare_pack.sh Executable file
View File

@@ -0,0 +1,33 @@
# Download the client jar from mojang to extract assets
wget https://launcher.mojang.com/v1/objects/37fd3c903861eeff3bc24b71eed48f828b5269c8/client.jar
unzip client.jar -d extracted/
# Set input field seperator to space for our while loop
IFS=' '
# Copy textures defined in required_files.txt over to the pack
while read -r p || [ -n "$p" ]; do
read -rafilesToCopy<<< "$p"
echo "extracted/${filesToCopy[0]} ${filesToCopy[1]}"
mkdir -p "${filesToCopy[1]}"
cp "extracted/${filesToCopy[0]}" "${filesToCopy[1]}"
done <required_files.txt
# Create required sprites with Imagemagick
convert -append extracted/assets/minecraft/textures/particle/sweep_*.png -define png:format=png8 textures/particle/sweep_attack.png
rm client.jar
rm -r extracted
# Set our input field seperator back to new line
IFS=$'\n'
# One-line our JSON files if the script is called with -jc (./prepare_pack.sh -jc)
if [[ ${1} == "-jc" ]]
then
for i in $(find . -type f -name "*.json")
do
# Note that we must use a temp file, as awk does not support in-place editting
awk -v ORS= 'BEGIN {FS = OFS = "\""}/^[[:blank:]]*$/ {next}{for (i=1; i<=NF; i+=2) gsub(/[[:space:]]/,"",$i);sub("\r$", "")} 1' ${i} > tmp && mv tmp ${i}
done
fi