开启辅助访问      

站内搜索

搜索
热搜: 下载 1.19 1.20

Minecraft(我的世界)苦力怕论坛

[其他] [Shell屎山系列 - 1] MC材质打包器1.0

发表于 2024-3-3 15:18:39 来自手机 | 显示全部楼层 |阅读模式 IP:河北省
本帖最后由 我是李君子 于 2024-3-3 15:40 编辑

本人由于高考在即( 开学了 ) 暂时不会经常在论坛发言

功能 :
  • 将特定格式的目录做成Java版和基岩版的材质包
指定目录格式 :
  • icon.png/jpg #图标
  • 其他与基岩版textures文件夹下文件的命名一致

代码 :
( 屎山准备
  • 初始化
  1. #!/bin/sh

  2. clear
  3. date=`date +"%Y-%m-%d %H:%M:%S"`
  4. if mkdir texture_packs; then
  5.   echo -e "材质包存放目录创建完成"
  6.   touch README.txt
  7.   echo -e "目录介绍\nTexture_packs : 存放完成的材质包\n你可以在里面找到你的材质包和打包好的文件\n另外 请讲包图标命名为icon.png/jpg/jpeg" > README.txt
  8.   touch PATH.log
  9.   echo -e "[ $date ] 初始化完成" > PATH.log
  10.   cat README.txt
  11. fi
复制代码


• 日志查看
  1. #!/bin/sh

  2. dialog --msgbox "全部日志:\n$(cat ./PATH.log)" 70 20
复制代码


• 制作 ( 你们想看的屎山
LINUX 用
  1. #!/bin/sh

  2. clear
  3. date=`date +"%Y-%m-%d %H:%M:%S"`
  4. uuid1=`cat /proc/sys/kernel/random/uuid`
  5. uuid2=`cat /proc/sys/kernel/random/uuid`
  6. #echo -e "--------该脚本适用于Linux系统-------\n"
  7. texture_pack_name=$(dialog --inputbox "材质包名称: " 50 25 --stdout)
  8. texture_pack_show=$(dialog --inputbox "材质包介绍: " 50 25 --stdout)
  9. texture_pack_ver=$(dialog --inputbox "材质适配版本( 版本号最后一个数+1 ): " 50 25 --stdout)
  10. texture_pack_path=$(dialog --inputbox "材质源Path: " 50 25 --stdout)
  11. icon(){
  12.   if [ -e $texture_pack_path/icon.png ]; then
  13.     cp $texture_pack_path/icon.png $1
  14.     cp $texture_pack_path/icon.png $2
  15.   elif [ -e $texture_pack_path/icon.jpg ]; then
  16.     cp $texture_pack_path/icon.jpg $1
  17.     cp $texture_pack_path/icon.jpg $2
  18.   fi; }
  19. mkdir ./texture_packs/$texture_pack_name
  20. mkdir ./texture_packs/$texture_pack_name/Java
  21. mkdir ./texture_packs/$texture_pack_name/Java/assets
  22. mkdir ./texture_packs/$texture_pack_name/Java/assets/minecraft
  23. #mkdir ./texture_packs/$texture_pack_name/Java/assets/minecraft/textures
  24. touch ./texture_packs/$texture_pack_name/Java/pack.mcmeta
  25. cp -r $texture_pack_path ./texture_packs/$texture_pack_name/Java/assets/minecraft/textures/
  26. echo -e "{"pack": {"pack_format": $texture_pack_ver,"description": "$texture_pack_show"}}" > ./texture_packs/$texture_pack_name/Java/pack.mcmeta
  27. echo "[ $date ] 创建JAVA版材质包$texture_pack_name" >> PATH.log
  28. mkdir ./texture_packs/$texture_pack_name/Bedrock
  29. touch ./texture_packs/$texture_pack_name/Bedrock/manifest.json
  30. echo -e "{"format_version": 2,"header": {"description": "$texture_pack_show","name": "$texture_pack_name","uuid": "$uuid1","version": [0, 0, 1],"min_engine_version": [ 1, 1`expr $texture_pack_ver - 1`,00 ]},"modules": [{"type": "resources", "uuid": "$uuid2","version": [0, 0, 1]}]}" > ./texture_packs/$texture_pack_name/Bedrock/manifest.json
  31. cp -r $texture_pack_path ./texture_packs/$texture_pack_name/Bedrock/textures/
  32. echo "[ $date ] 创建BEDROCK版材质包$texture_pack_name" >> PATH.log
  33. icon ./texture_packs/$texture_pack_name/Java/pack.png ./texture_packs/$texture_pack_name/Bedrock/pack_icon.png
  34. if zip -r "./texture_packs/$texture_pack_name/Java/$texture_pack_name.zip" ./texture_packs/$texture_pack_name/Java/; then
  35.   dialog --msgbox "$texture_pack_name.zip 打包成功" 200 120
  36. else
  37.   dialog --msgbox "$texture_pack_name.zip 打包失败" 200 120; fi
  38. if zip -r "./texture_packs/$texture_pack_name/Bedrock/$texture_pack_name.mcpack" ./texture_packs/$texture_pack_name/Bedrock/; then
  39.   dialog --msgbox "$texture_pack_name.zip 打包成功" 200 120
  40. else
  41.   dialog --msgbox "$texture_pack_name.zip 打包失败" 200 120; fi
  42. dialog --msgbox "制作完成" 200 120
复制代码


手机模拟器用
  1. #!/bin/sh

  2. clear
  3. date=`date +"%Y-%m-%d %H:%M:%S"`
  4. uuid1=`cat /proc/sys/kernel/random/uuid`
  5. uuid2=`cat /proc/sys/kernel/random/uuid`
  6. echo -e "--------该脚本适用于Android的虚拟Linux环境-------\n"
  7. echo -e "材质包名称: \c"
  8. read texture_pack_name
  9. echo -e "材质包介绍: \c"
  10. read texture_pack_show
  11. echo -e "材质包版本号\n版本号最后一个数字加一 例如: 1.12 => 3: \c"
  12. read texture_pack_ver
  13. echo -e "贴图源目录位置: \c"
  14. read texture_pack_path
  15. icon(){
  16.   if [ -e $texture_pack_path/icon.png ]; then
  17.     cp $texture_pack_path/icon.png $1
  18.     cp $texture_pack_path/icon.png $2
  19.   elif [ -e $texture_pack_path/icon.jpg ]; then
  20.     cp $texture_pack_path/icon.jpg $1
  21.     cp $texture_pack_path/icon.jpg $2
  22.   fi; }
  23. mkdir ./texture_packs/$texture_pack_name
  24. mkdir ./texture_packs/$texture_pack_name/Java
  25. mkdir ./texture_packs/$texture_pack_name/Java/assets
  26. mkdir ./texture_packs/$texture_pack_name/Java/assets/minecraft
  27. #mkdir ./texture_packs/$texture_pack_name/Java/assets/minecraft/textures
  28. touch ./texture_packs/$texture_pack_name/Java/pack.mcmeta
  29. cp -r $texture_pack_path ./texture_packs/$texture_pack_name/Java/assets/minecraft/textures/
  30. echo -e "{"pack": {"pack_format": $texture_pack_ver,"description": "$texture_pack_show"}}" > ./texture_packs/$texture_pack_name/Java/pack.mcmeta
  31. echo "[ $date ] 创建JAVA版材质包$texture_pack_name" >> PATH.log
  32. mkdir ./texture_packs/$texture_pack_name/Bedrock
  33. touch ./texture_packs/$texture_pack_name/Bedrock/manifest.json
  34. echo -e "{"format_version": 2,"header": {"description": "$texture_pack_show","name": "$texture_pack_name","uuid": "$uuid1","version": [0, 0, 1],"min_engine_version": [ 1, 1`expr $texture_pack_ver - 1`,00 ]},"modules": [{"type": "resources", "uuid": "$uuid2","version": [0, 0, 1]}]}" > ./texture_packs/$texture_pack_name/Bedrock/manifest.json
  35. cp -r $texture_pack_path ./texture_packs/$texture_pack_name/Bedrock/textures/
  36. echo "[ $date ] 创建BEDROCK版材质包$texture_pack_name" >> PATH.log
  37. icon ./texture_packs/$texture_pack_name/Java/pack.png ./texture_packs/$texture_pack_name/Bedrock/pack_icon.png
  38. if zip -r "./texture_packs/$texture_pack_name/Java/$texture_pack_name.zip" ./texture_packs/$texture_pack_name/Java/; then
  39.   echo -e "$texture_pack_name.zip 打包成功"
  40. else
  41.   echo -e "$texture_pack_name.zip 打包失败"; fi
  42. if zip -r "./texture_packs/$texture_pack_name/Bedrock/$texture_pack_name.mcpack" ./texture_packs/$texture_pack_name/Bedrock/; then
  43.   echo -e "$texture_pack_name.zip 打包成功"
  44. else
  45.   echo -e "$texture_pack_name.zip 打包失败"; fi
  46. echo "\n创建完成"
复制代码


• 快捷观看
Screenshot_2024-03-03-15-15-12-321_bin.mt.plus-edit.jpg

• 代码优化方法
将线路转换为变量
将重复的地方封装为函数

• 屎山评级
#原创脚本 所以这是在给自己评级
4.5

• 下载
合成材质包.zip (2.58 KB, 下载次数: 5)

• 项目官网
( 待补 )
苦力怕论坛,感谢有您~
回复

使用道具 举报

发表于 2024-3-3 15:31:23 | 显示全部楼层 IP:湖南省
skxhajajnsja
2# 2024-3-3 15:31:23 回复 收起回复
苦力怕论坛,感谢有您~
回复 支持

使用道具 举报

发表于 2024-4-17 20:56:38 来自手机 | 显示全部楼层 IP:吉林省
不懂就问:我的世界基岩版支持shell吗?
3# 2024-4-17 20:56:38 回复 收起回复
苦力怕论坛,感谢有您~
回复 支持

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

本站
关于我们
联系我们
坛史纲要
官方
哔哩哔哩
技术博客
下载
网易版
安卓版
JAVA
反馈
意见建议
教程中心
更多
捐助本站
QQ群
QQ群

QQ群

访问手机版

访问手机版

手机版|小黑屋|系统状态|klpbbs.com

粤公网安备 44200002445329号 | 由 木韩网络 提供云服务 | GMT+8, 2024-4-27 17:39

声明:本站与Mojang以及微软公司没有从属关系

Powered by Discuz! X3.4 粤ICP备2023071842号