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 358b7874c..000000000 Binary files a/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/ender_pearl_flower_stage_3.png and /dev/null differ 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 000000000..a4b1ec38c Binary files /dev/null and b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident.png differ 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 000000000..692a34f0f Binary files /dev/null and b/bukkit/loader/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/topaz_trident_3d.png differ diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java index e899169c2..3f83a18e3 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java @@ -60,14 +60,14 @@ public class BukkitProjectileManager implements Listener, ProjectileManager { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onProjectileLaunch(ProjectileLaunchEvent event) { Projectile projectile = event.getEntity(); - handleProjectileLoad(projectile, true); + handleProjectileLoad(projectile); } @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onEntitiesLoad(EntitiesLoadEvent event) { for (Entity entity : event.getEntities()) { if (entity instanceof Projectile projectile) { - handleProjectileLoad(projectile, false); + handleProjectileLoad(projectile); } } } @@ -77,7 +77,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager { this.projectiles.remove(event.getEntity().getEntityId()); } - private void handleProjectileLoad(Projectile projectile, boolean delay) { + private void handleProjectileLoad(Projectile projectile) { ItemStack projectileItem; if (projectile instanceof ThrowableProjectile throwableProjectile) { projectileItem = throwableProjectile.getItem(); @@ -92,14 +92,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager { ProjectileMeta meta = it.settings().projectileMeta(); if (meta != null) { this.projectiles.put(projectile.getEntityId(), new BukkitCustomProjectile(meta, projectile, wrapped)); - ProjectileInjectTask task = new ProjectileInjectTask(projectile); - if (!delay) { - task.run(); - } else if (VersionHelper.isFolia()) { - - } else { - plugin.scheduler().sync().runDelayed(task); - } + new ProjectileInjectTask(projectile); } }); } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java index b5f5d1cc4..23358d9e5 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java @@ -101,6 +101,7 @@ public class ProjectilePacketHandler implements EntityPacketHandler { displayedItem = this.projectile.item().mergeCopy(displayedItem); ItemDisplayEntityData.InterpolationDelay.addEntityDataIfNotDefaultValue(-1, itemDisplayValues); ItemDisplayEntityData.Translation.addEntityDataIfNotDefaultValue(meta.translation(), itemDisplayValues); + ItemDisplayEntityData.Scale.addEntityDataIfNotDefaultValue(meta.scale(), itemDisplayValues); ItemDisplayEntityData.RotationLeft.addEntityDataIfNotDefaultValue(meta.rotation(), itemDisplayValues); if (VersionHelper.isOrAbove1_20_2()) { ItemDisplayEntityData.TransformationInterpolationDuration.addEntityDataIfNotDefaultValue(1, itemDisplayValues); diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java b/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java index 8ca3ec0b1..a7fde9ad4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java @@ -5,5 +5,5 @@ import net.momirealms.craftengine.core.util.Key; import org.joml.Quaternionf; import org.joml.Vector3f; -public record ProjectileMeta(Key item, ItemDisplayContext displayType, Vector3f translation, Quaternionf rotation) { +public record ProjectileMeta(Key item, ItemDisplayContext displayType, Vector3f scale, Vector3f translation, Quaternionf rotation) { } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java index ff5b725e8..c536b3725 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java @@ -212,9 +212,10 @@ public class ItemSettings { Map 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