From 7039f33396260aa653448d2ca6dcd98da4e062a3 Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Sun, 11 May 2025 03:31:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E5=B0=84=E7=89=A9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/configuration/categories.yml | 1 + .../resources/default/configuration/i18n.yml | 2 + .../resources/default/configuration/items.yml | 45 +++++++- .../custom/ender_pearl_flower_stage_3.json | 43 -------- .../item/custom/topaz_trident_in_hand.json | 94 +++++++++++++++++ .../item/custom/topaz_trident_throwing.json | 96 ++++++++++++++++++ .../custom/ender_pearl_flower_stage_3.png | Bin 362 -> 0 bytes .../textures/item/custom/topaz_trident.png | Bin 0 -> 231 bytes .../textures/item/custom/topaz_trident_3d.png | Bin 0 -> 548 bytes .../projectile/BukkitProjectileManager.java | 15 +-- .../handler/ProjectilePacketHandler.java | 1 + .../entity/projectile/ProjectileMeta.java | 2 +- .../craftengine/core/item/ItemSettings.java | 7 +- .../core/pack/AbstractPackManager.java | 4 + .../craftengine/core/util/MiscUtils.java | 37 ++++--- gradle.properties | 2 +- 16 files changed, 275 insertions(+), 74 deletions(-) delete mode 100644 bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/ender_pearl_flower_stage_3.json create mode 100644 bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_in_hand.json create mode 100644 bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_throwing.json delete mode 100644 bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/ender_pearl_flower_stage_3.png create mode 100644 bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident.png create mode 100644 bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident_3d.png diff --git a/bukkit/loader/src/main/resources/resources/default/configuration/categories.yml b/bukkit/loader/src/main/resources/resources/default/configuration/categories.yml index 3189f43a4..fd442e990 100644 --- a/bukkit/loader/src/main/resources/resources/default/configuration/categories.yml +++ b/bukkit/loader/src/main/resources/resources/default/configuration/categories.yml @@ -38,6 +38,7 @@ categories: - default:topaz_bow - default:topaz_crossbow - default:topaz_rod + - default:topaz_trident - default:topaz_helmet - default:topaz_chestplate - default:topaz_leggings diff --git a/bukkit/loader/src/main/resources/resources/default/configuration/i18n.yml b/bukkit/loader/src/main/resources/resources/default/configuration/i18n.yml index fe6db7c36..99e6d9705 100644 --- a/bukkit/loader/src/main/resources/resources/default/configuration/i18n.yml +++ b/bukkit/loader/src/main/resources/resources/default/configuration/i18n.yml @@ -20,6 +20,7 @@ i18n: item.topaz_chestplate: "Topaz Chestplate" item.topaz_leggings: "Topaz Leggings" item.topaz_boots: "Topaz Boots" + item.topaz_trident: "Topaz Trident" item.topaz_ore: "Topaz Ore" item.deepslate_topaz_ore: "Deepslate Topaz Ore" item.topaz: "Topaz" @@ -63,6 +64,7 @@ i18n: item.topaz_chestplate: "黄玉胸甲" item.topaz_leggings: "黄玉护腿" item.topaz_boots: "黄玉靴子" + item.topaz_trident: "黄玉三叉戟" item.topaz_ore: "黄玉矿石" item.deepslate_topaz_ore: "深层黄玉矿石" item.topaz: "黄玉" diff --git a/bukkit/loader/src/main/resources/resources/default/configuration/items.yml b/bukkit/loader/src/main/resources/resources/default/configuration/items.yml index b21baa96f..923daec69 100644 --- a/bukkit/loader/src/main/resources/resources/default/configuration/items.yml +++ b/bukkit/loader/src/main/resources/resources/default/configuration/items.yml @@ -175,7 +175,42 @@ items#topaz_gears: arguments: part: boots slot: feet - + default:topaz_trident: + material: trident + custom-model-data: 1000 + settings: + projectile: + item: default:topaz_trident + translation: 0,0,0 + rotation: 1,1,1,1 + display-transform: NONE + scale: 0.5 + tags: + - "default:topaz_tools" + data: + item-name: "<#FF8C00>" + tooltip-style: minecraft:topaz + model: + type: minecraft:select + property: minecraft:display_context + cases: + - when: ["gui", "ground", "fixed"] + model: + type: minecraft:model + path: minecraft:item/custom/topaz_trident + generation: + parent: minecraft:item/generated + textures: + layer0: minecraft:item/custom/topaz_trident + fallback: + type: minecraft:condition + property: minecraft:using_item + on-true: + type: minecraft:model + path: minecraft:item/custom/topaz_trident_throwing + on-false: + type: minecraft:model + path: minecraft:item/custom/topaz_trident_in_hand templates: default:armor/topaz: material: "chainmail_{part}" @@ -428,4 +463,12 @@ recipes#11: template-type: default:topaz result: id: default:topaz_rod + count: 1 + default:topaz_trident: + type: smithing_transform + base: minecraft:trident + addition: default:topaz + template-type: default:topaz + result: + id: default:topaz_trident count: 1 \ No newline at end of file diff --git a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/ender_pearl_flower_stage_3.json b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/ender_pearl_flower_stage_3.json deleted file mode 100644 index c65bc426f..000000000 --- a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/ender_pearl_flower_stage_3.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "ambientocclusion": false, - "textures": { - "1": "item/ender_pearl", - "particle": "block/custom/ender_pearl_flower_stage_3", - "cross": "block/custom/ender_pearl_flower_stage_3" - }, - "elements": [ - { - "from": [0.8, 0, 8], - "to": [15.2, 16, 8], - "shade": false, - "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8], "rescale": true}, - "faces": { - "north": {"uv": [0, 0, 16, 16], "texture": "#cross"}, - "south": {"uv": [0, 0, 16, 16], "texture": "#cross"} - } - }, - { - "from": [8, 0, 0.8], - "to": [8, 16, 15.2], - "shade": false, - "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8], "rescale": true}, - "faces": { - "east": {"uv": [0, 0, 16, 16], "texture": "#cross"}, - "west": {"uv": [0, 0, 16, 16], "texture": "#cross"} - } - }, - { - "from": [8, 5, -1], - "to": [8, 21, 15], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 5, 7]}, - "faces": { - "north": {"uv": [0, 0, 0, 16], "texture": "#1"}, - "east": {"uv": [0, 0, 16, 16], "texture": "#1"}, - "south": {"uv": [0, 0, 0, 16], "texture": "#1"}, - "west": {"uv": [0, 0, 16, 16], "texture": "#1"}, - "up": {"uv": [0, 0, 0, 16], "texture": "#1"}, - "down": {"uv": [0, 0, 0, 16], "texture": "#1"} - } - } - ] -} \ No newline at end of file diff --git a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_in_hand.json b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_in_hand.json new file mode 100644 index 000000000..52fbb8b40 --- /dev/null +++ b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_in_hand.json @@ -0,0 +1,94 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "item/custom/topaz_trident_3d", + "particle": "item/custom/topaz_trident_3d" + }, + "elements": [ + { + "from": [7.75, -5.5, 7.75], + "to": [8.25, 10, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "east": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "south": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "west": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "up": {"uv": [3, 0, 3.5, 0.5], "texture": "#0"}, + "down": {"uv": [0.5, 15.5, 1, 16], "texture": "#0"} + } + }, + { + "from": [7.25, 7, 7.75], + "to": [7.75, 8, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "east": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "south": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "west": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "up": {"uv": [11, 2.5, 11.5, 3], "texture": "#0"}, + "down": {"uv": [11, 3, 11.5, 3.5], "texture": "#0"} + } + }, + { + "from": [6.75, 7.5, 7.75], + "to": [7.25, 9.5, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "east": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "south": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "west": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "up": {"uv": [11.5, 1, 12, 1.5], "texture": "#0"}, + "down": {"uv": [11.5, 2.5, 12, 3], "texture": "#0"} + } + }, + { + "from": [8.75, 7.5, 7.75], + "to": [9.25, 9.5, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "east": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "south": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "west": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "up": {"uv": [11.5, 1, 12, 1.5], "texture": "#0"}, + "down": {"uv": [11.5, 2.5, 12, 3], "texture": "#0"} + } + }, + { + "from": [8.25, 7, 7.75], + "to": [8.75, 8, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "east": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "south": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "west": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "up": {"uv": [11, 2.5, 11.5, 3], "texture": "#0"}, + "down": {"uv": [11, 3, 11.5, 3.5], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [0, 60, 0], + "translation": [0.25, 9, 1.5], + "scale": [2, 2, 2] + }, + "thirdperson_lefthand": { + "rotation": [0, 60, 0], + "translation": [0.25, 9, 1.5], + "scale": [2, 2, 2] + }, + "firstperson_righthand": { + "rotation": [0, -90, 25], + "translation": [-2.5, 7.5, 4.75] + }, + "firstperson_lefthand": { + "rotation": [0, 90, -25], + "translation": [-2.5, 7.5, 4.75] + } + } +} \ No newline at end of file diff --git a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_throwing.json b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_throwing.json new file mode 100644 index 000000000..fded0b6dc --- /dev/null +++ b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_throwing.json @@ -0,0 +1,96 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "item/custom/topaz_trident_3d", + "particle": "item/custom/topaz_trident_3d" + }, + "elements": [ + { + "from": [7.75, -5.5, 7.75], + "to": [8.25, 10, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "east": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "south": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "west": {"uv": [10.5, 0.5, 11, 16], "texture": "#0"}, + "up": {"uv": [3, 0, 3.5, 0.5], "texture": "#0"}, + "down": {"uv": [0.5, 15.5, 1, 16], "texture": "#0"} + } + }, + { + "from": [7.25, 7, 7.75], + "to": [7.75, 8, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "east": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "south": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "west": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "up": {"uv": [11, 2.5, 11.5, 3], "texture": "#0"}, + "down": {"uv": [11, 3, 11.5, 3.5], "texture": "#0"} + } + }, + { + "from": [6.75, 7.5, 7.75], + "to": [7.25, 9.5, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "east": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "south": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "west": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "up": {"uv": [11.5, 1, 12, 1.5], "texture": "#0"}, + "down": {"uv": [11.5, 2.5, 12, 3], "texture": "#0"} + } + }, + { + "from": [8.75, 7.5, 7.75], + "to": [9.25, 9.5, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "east": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "south": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "west": {"uv": [11.5, 1, 12, 3], "texture": "#0"}, + "up": {"uv": [11.5, 1, 12, 1.5], "texture": "#0"}, + "down": {"uv": [11.5, 2.5, 12, 3], "texture": "#0"} + } + }, + { + "from": [8.25, 7, 7.75], + "to": [8.75, 8, 8.25], + "rotation": {"angle": 0, "axis": "y", "origin": [4, -5.5, 4]}, + "faces": { + "north": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "east": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "south": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "west": {"uv": [11, 2.5, 11.5, 3.5], "texture": "#0"}, + "up": {"uv": [11, 2.5, 11.5, 3], "texture": "#0"}, + "down": {"uv": [11, 3, 11.5, 3.5], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [0, 90, 180], + "translation": [0.25, -9, 1.5], + "scale": [2, 2, 2] + }, + "thirdperson_lefthand": { + "rotation": [0, 90, 180], + "translation": [0.25, -9, 1.5], + "scale": [2, 2, 2] + }, + "firstperson_righthand": { + "rotation": [0, -90, 25], + "translation": [0.75, -5, -0.75], + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_lefthand": { + "rotation": [0, 90, -25], + "translation": [0.75, -5, -0.75], + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/ender_pearl_flower_stage_3.png b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/ender_pearl_flower_stage_3.png deleted file mode 100644 index 358b7874c5eb77c4525cd4422ed30fc4470ae8f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 362 zcmV-w0hRuVP)Px$BuPX;R5*?8ks(jRKp2Lf8@P!HT$^UOgrpL|e!xk70p>y`>nl(V2}$+*1fmJ$ zXTU-xnZQxiEKBPv>VQLCckM_B36f8K_rA~feec14{cSB5bF*B`&2Mz0;p2ER{c(`1 z8M(A5&P3a6Np#X}aesHy+bGeAd3*fa11!;nqiV_=mPJYak_$UfxWPO>ydy)|gIrvmQoMdJG><1!+Ge{C(XLb$C1p{P z=)_cYg*Y)iGr(>W&^BA5I1|GCHVe@+Z2)8_SwF4uJ)f$s@I4pmxlmGw#07*qo IM6N<$g2dsPWdHyG diff --git a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident.png b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident.png new file mode 100644 index 0000000000000000000000000000000000000000..a4b1ec38cae59a399a21601f4270020574168442 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|7J9lkhFJ6_ zCoEu}VV3&yKL{-M_`Ggz`+s8t1A{lWDrZz2F36l`mTLKtZNl1_jg5^96}Er>|J0-H z|BG3j-;RM8|DS9B+b?snVc|}N?b9uo<4ivOt-pAr{gF`0*`6IH<&j2z`aeHOj@a^7 zm>CET8&8hgai`_vQH!q&Z`?^e=}>j&@E_YtCX;0oczAepZp#DhwfS)*piHKG$|Gim Yd2`ozmalE~06Lbz)78&qol`;+05r{JoB#j- literal 0 HcmV?d00001 diff --git a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident_3d.png b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident_3d.png new file mode 100644 index 0000000000000000000000000000000000000000..692a34f0fc504ecce5ac4d802631d4ec27a5fd5a GIT binary patch literal 548 zcmV+<0^9wGP)Px$-bqA3R9J=Wma$6$Q5?s=C$~g(p%6r9lxQJ>Gz22lSm9qF5wtW0Q3Q?+4h=#P zB!*MqVw00}bd3d4YePdB2Sy1^zHpRZgPojb>3i7e;s+i--s9f;eZRkVckclJN-sK9 z5(?o5E#@R5A}!{mWCYCy8*rpkIVzRP$h$Jou5U?;IVlvZV}JJqp9bz6&_GYC}fV^kRCTclK};vPYja*1$kEn zKEE3;&u{Sg-B?>+kwio!BcQFQf~?9AFQV&QS=9mPtkKgM#x@&H<`<^H98>Xmqd4wT`3LWWVvns@%`o zB0vOrT$!*8vAznhr2_4y{zewrFFUYh3q(xGulMDi6IyAQ;xi(9!>vCeA6QLw m6p&RL<;to|sC1nWG4c(*>I!4O-U0al0000 args = MiscUtils.castToMap(value, false); Key customTridentItemId = Key.of(Objects.requireNonNull(args.get("item"), "'item should not be null'").toString()); ItemDisplayContext displayType = ItemDisplayContext.valueOf(args.getOrDefault("display-transform", "NONE").toString().toUpperCase(Locale.ENGLISH)); - Vector3f translation = MiscUtils.getAsVector3f(args.get("translation"), "translation"); - Quaternionf rotationLefts = MiscUtils.getAsQuaternionf(args.get("rotation-left"), "rotation-left"); - return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, translation, rotationLefts)); + Vector3f translation = MiscUtils.getAsVector3f(args.getOrDefault("translation", "0"), "translation"); + Vector3f scale = MiscUtils.getAsVector3f(args.getOrDefault("scale", "1"), "scale"); + Quaternionf rotation = MiscUtils.getAsQuaternionf(ResourceConfigUtils.get(args, "rotation-left", "rotation"), "rotation-left"); + return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, scale, translation, rotation)); })); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java index a4a02839d..df19992c8 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java @@ -347,6 +347,8 @@ public abstract class AbstractPackManager implements PackManager { plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_crossbow_pulling_1.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_crossbow_pulling_2.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_crossbow.png"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident.png"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident_3d.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/entity/equipment/humanoid/topaz.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/entity/equipment/humanoid_leggings/topaz.png"); for (String item : List.of("helmet", "chestplate", "leggings", "boots", "pickaxe", "axe", "sword", "hoe", "shovel")) { @@ -391,6 +393,8 @@ public abstract class AbstractPackManager implements PackManager { plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/reed.json"); // furniture plugin.saveResource("resources/default/configuration/furniture.yml"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_in_hand.json"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/topaz_trident_throwing.json"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/table_lamp.json"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/wooden_chair.json"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/bench.json"); diff --git a/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java b/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java index c208c1c2f..b16bd6df5 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java +++ b/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java @@ -3,6 +3,7 @@ package net.momirealms.craftengine.core.util; import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException; import org.joml.Quaternionf; import org.joml.Vector3f; +import software.amazon.awssdk.services.s3.endpoints.internal.Value; import java.util.ArrayList; import java.util.List; @@ -41,27 +42,35 @@ public class MiscUtils { public static Vector3f getAsVector3f(Object o, String option) { if (o == null) return new Vector3f(); - String stringFormat = o.toString(); - String[] split = stringFormat.split(","); - if (split.length == 3) { - return new Vector3f(Float.parseFloat(split[0]), Float.parseFloat(split[1]), Float.parseFloat(split[2])); - } else if (split.length == 1) { - return new Vector3f(Float.parseFloat(split[0])); + if (o instanceof List list && list.size() == 3) { + return new Vector3f(Float.parseFloat(list.get(0).toString()), Float.parseFloat(list.get(1).toString()), Float.parseFloat(list.get(2).toString())); } else { - throw new LocalizedResourceConfigException("warning.config.type.vector3f", stringFormat, option); + String stringFormat = o.toString(); + String[] split = stringFormat.split(","); + if (split.length == 3) { + return new Vector3f(Float.parseFloat(split[0]), Float.parseFloat(split[1]), Float.parseFloat(split[2])); + } else if (split.length == 1) { + return new Vector3f(Float.parseFloat(split[0])); + } else { + throw new LocalizedResourceConfigException("warning.config.type.vector3f", stringFormat, option); + } } } public static Quaternionf getAsQuaternionf(Object o, String option) { if (o == null) return new Quaternionf(); - String stringFormat = o.toString(); - String[] split = stringFormat.split(","); - if (split.length == 4) { - return new Quaternionf(Float.parseFloat(split[0]), Float.parseFloat(split[1]), Float.parseFloat(split[2]), Float.parseFloat(split[3])); - } else if (split.length == 1) { - return QuaternionUtils.toQuaternionf(0, Math.toRadians(Float.parseFloat(split[0])), 0); + if (o instanceof List list && list.size() == 4) { + return new Quaternionf(Float.parseFloat(list.get(0).toString()), Float.parseFloat(list.get(1).toString()), Float.parseFloat(list.get(2).toString()), Float.parseFloat(list.get(3).toString())); } else { - throw new LocalizedResourceConfigException("warning.config.type.quaternionf", stringFormat, option); + String stringFormat = o.toString(); + String[] split = stringFormat.split(","); + if (split.length == 4) { + return new Quaternionf(Float.parseFloat(split[0]), Float.parseFloat(split[1]), Float.parseFloat(split[2]), Float.parseFloat(split[3])); + } else if (split.length == 1) { + return QuaternionUtils.toQuaternionf(0, Math.toRadians(Float.parseFloat(split[0])), 0); + } else { + throw new LocalizedResourceConfigException("warning.config.type.quaternionf", stringFormat, option); + } } } } diff --git a/gradle.properties b/gradle.properties index d4e994cdc..a13ad6688 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G # Project settings # Rule: [major update].[feature update].[bug fix] -project_version=0.0.53.4 +project_version=0.0.53.5 config_version=32 lang_version=12 project_group=net.momirealms