1
0

refactor: 优化方块注册代码,将设置方块属性操作提取为函数

This commit is contained in:
2022-08-28 19:18:53 +08:00
parent f413782a58
commit 39368b06b4
3 changed files with 170 additions and 83 deletions
+17
View File
@@ -1,5 +1,22 @@
// priority: 100
// 注意事项:
// - 暂不支持解构赋值(2022-08-28
// - 暂不支持设置函数参数默认值(2022-08-28)
// - 暂不支持 try catch2022-08-28
// 自定义方块:
// https://mods.latvian.dev/books/kubejs/page/custom-blocks
global.defaults = function (v, d) {
(typeof d === 'undefined') && (d = null);
return ((typeof v === 'undefined' || v === null) ? d : v);
};
global.writeJSON = function (path, data) {
JsonIO.write(path, data);
};
// 参考:
// https://github.com/Railcraft/Railcraft/blob/mc-1.12.2/src/main/java/mods/railcraft/common/plugins/color/EnumColor.java
global.COLORS = {