9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-04 15:41:38 +00:00

弹射物更新

This commit is contained in:
XiaoMoMi
2025-05-11 03:31:31 +08:00
parent a87a5ef7de
commit 7039f33396
16 changed files with 275 additions and 74 deletions

View File

@@ -38,6 +38,7 @@ categories:
- default:topaz_bow - default:topaz_bow
- default:topaz_crossbow - default:topaz_crossbow
- default:topaz_rod - default:topaz_rod
- default:topaz_trident
- default:topaz_helmet - default:topaz_helmet
- default:topaz_chestplate - default:topaz_chestplate
- default:topaz_leggings - default:topaz_leggings

View File

@@ -20,6 +20,7 @@ i18n:
item.topaz_chestplate: "Topaz Chestplate" item.topaz_chestplate: "Topaz Chestplate"
item.topaz_leggings: "Topaz Leggings" item.topaz_leggings: "Topaz Leggings"
item.topaz_boots: "Topaz Boots" item.topaz_boots: "Topaz Boots"
item.topaz_trident: "Topaz Trident"
item.topaz_ore: "Topaz Ore" item.topaz_ore: "Topaz Ore"
item.deepslate_topaz_ore: "Deepslate Topaz Ore" item.deepslate_topaz_ore: "Deepslate Topaz Ore"
item.topaz: "Topaz" item.topaz: "Topaz"
@@ -63,6 +64,7 @@ i18n:
item.topaz_chestplate: "黄玉胸甲" item.topaz_chestplate: "黄玉胸甲"
item.topaz_leggings: "黄玉护腿" item.topaz_leggings: "黄玉护腿"
item.topaz_boots: "黄玉靴子" item.topaz_boots: "黄玉靴子"
item.topaz_trident: "黄玉三叉戟"
item.topaz_ore: "黄玉矿石" item.topaz_ore: "黄玉矿石"
item.deepslate_topaz_ore: "深层黄玉矿石" item.deepslate_topaz_ore: "深层黄玉矿石"
item.topaz: "黄玉" item.topaz: "黄玉"

View File

@@ -175,7 +175,42 @@ items#topaz_gears:
arguments: arguments:
part: boots part: boots
slot: feet 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: "<!i><#FF8C00><i18n:item.topaz_trident>"
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: templates:
default:armor/topaz: default:armor/topaz:
material: "chainmail_{part}" material: "chainmail_{part}"
@@ -428,4 +463,12 @@ recipes#11:
template-type: default:topaz template-type: default:topaz
result: result:
id: default:topaz_rod 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 count: 1

View File

@@ -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"}
}
}
]
}

View File

@@ -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]
}
}
}

View File

@@ -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]
}
}
}

View File

@@ -60,14 +60,14 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onProjectileLaunch(ProjectileLaunchEvent event) { public void onProjectileLaunch(ProjectileLaunchEvent event) {
Projectile projectile = event.getEntity(); Projectile projectile = event.getEntity();
handleProjectileLoad(projectile, true); handleProjectileLoad(projectile);
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntitiesLoad(EntitiesLoadEvent event) { public void onEntitiesLoad(EntitiesLoadEvent event) {
for (Entity entity : event.getEntities()) { for (Entity entity : event.getEntities()) {
if (entity instanceof Projectile projectile) { 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()); this.projectiles.remove(event.getEntity().getEntityId());
} }
private void handleProjectileLoad(Projectile projectile, boolean delay) { private void handleProjectileLoad(Projectile projectile) {
ItemStack projectileItem; ItemStack projectileItem;
if (projectile instanceof ThrowableProjectile throwableProjectile) { if (projectile instanceof ThrowableProjectile throwableProjectile) {
projectileItem = throwableProjectile.getItem(); projectileItem = throwableProjectile.getItem();
@@ -92,14 +92,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
ProjectileMeta meta = it.settings().projectileMeta(); ProjectileMeta meta = it.settings().projectileMeta();
if (meta != null) { if (meta != null) {
this.projectiles.put(projectile.getEntityId(), new BukkitCustomProjectile(meta, projectile, wrapped)); this.projectiles.put(projectile.getEntityId(), new BukkitCustomProjectile(meta, projectile, wrapped));
ProjectileInjectTask task = new ProjectileInjectTask(projectile); new ProjectileInjectTask(projectile);
if (!delay) {
task.run();
} else if (VersionHelper.isFolia()) {
} else {
plugin.scheduler().sync().runDelayed(task);
}
} }
}); });
} }

View File

@@ -101,6 +101,7 @@ public class ProjectilePacketHandler implements EntityPacketHandler {
displayedItem = this.projectile.item().mergeCopy(displayedItem); displayedItem = this.projectile.item().mergeCopy(displayedItem);
ItemDisplayEntityData.InterpolationDelay.addEntityDataIfNotDefaultValue(-1, itemDisplayValues); ItemDisplayEntityData.InterpolationDelay.addEntityDataIfNotDefaultValue(-1, itemDisplayValues);
ItemDisplayEntityData.Translation.addEntityDataIfNotDefaultValue(meta.translation(), itemDisplayValues); ItemDisplayEntityData.Translation.addEntityDataIfNotDefaultValue(meta.translation(), itemDisplayValues);
ItemDisplayEntityData.Scale.addEntityDataIfNotDefaultValue(meta.scale(), itemDisplayValues);
ItemDisplayEntityData.RotationLeft.addEntityDataIfNotDefaultValue(meta.rotation(), itemDisplayValues); ItemDisplayEntityData.RotationLeft.addEntityDataIfNotDefaultValue(meta.rotation(), itemDisplayValues);
if (VersionHelper.isOrAbove1_20_2()) { if (VersionHelper.isOrAbove1_20_2()) {
ItemDisplayEntityData.TransformationInterpolationDuration.addEntityDataIfNotDefaultValue(1, itemDisplayValues); ItemDisplayEntityData.TransformationInterpolationDuration.addEntityDataIfNotDefaultValue(1, itemDisplayValues);

View File

@@ -5,5 +5,5 @@ import net.momirealms.craftengine.core.util.Key;
import org.joml.Quaternionf; import org.joml.Quaternionf;
import org.joml.Vector3f; 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) {
} }

View File

@@ -212,9 +212,10 @@ public class ItemSettings {
Map<String, Object> args = MiscUtils.castToMap(value, false); Map<String, Object> args = MiscUtils.castToMap(value, false);
Key customTridentItemId = Key.of(Objects.requireNonNull(args.get("item"), "'item should not be null'").toString()); 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)); ItemDisplayContext displayType = ItemDisplayContext.valueOf(args.getOrDefault("display-transform", "NONE").toString().toUpperCase(Locale.ENGLISH));
Vector3f translation = MiscUtils.getAsVector3f(args.get("translation"), "translation"); Vector3f translation = MiscUtils.getAsVector3f(args.getOrDefault("translation", "0"), "translation");
Quaternionf rotationLefts = MiscUtils.getAsQuaternionf(args.get("rotation-left"), "rotation-left"); Vector3f scale = MiscUtils.getAsVector3f(args.getOrDefault("scale", "1"), "scale");
return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, translation, rotationLefts)); Quaternionf rotation = MiscUtils.getAsQuaternionf(ResourceConfigUtils.get(args, "rotation-left", "rotation"), "rotation-left");
return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, scale, translation, rotation));
})); }));
} }

View File

@@ -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_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_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_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/topaz.png");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/entity/equipment/humanoid_leggings/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")) { 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"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/reed.json");
// furniture // furniture
plugin.saveResource("resources/default/configuration/furniture.yml"); 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/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/wooden_chair.json");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/bench.json"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/bench.json");

View File

@@ -3,6 +3,7 @@ package net.momirealms.craftengine.core.util;
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException; import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
import org.joml.Quaternionf; import org.joml.Quaternionf;
import org.joml.Vector3f; import org.joml.Vector3f;
import software.amazon.awssdk.services.s3.endpoints.internal.Value;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -41,27 +42,35 @@ public class MiscUtils {
public static Vector3f getAsVector3f(Object o, String option) { public static Vector3f getAsVector3f(Object o, String option) {
if (o == null) return new Vector3f(); if (o == null) return new Vector3f();
String stringFormat = o.toString(); if (o instanceof List<?> list && list.size() == 3) {
String[] split = stringFormat.split(","); return new Vector3f(Float.parseFloat(list.get(0).toString()), Float.parseFloat(list.get(1).toString()), Float.parseFloat(list.get(2).toString()));
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 { } 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) { public static Quaternionf getAsQuaternionf(Object o, String option) {
if (o == null) return new Quaternionf(); if (o == null) return new Quaternionf();
String stringFormat = o.toString(); if (o instanceof List<?> list && list.size() == 4) {
String[] split = stringFormat.split(","); 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()));
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 { } 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);
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
# Project settings # Project settings
# Rule: [major update].[feature update].[bug fix] # Rule: [major update].[feature update].[bug fix]
project_version=0.0.53.4 project_version=0.0.53.5
config_version=32 config_version=32
lang_version=12 lang_version=12
project_group=net.momirealms project_group=net.momirealms