mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-26 18:39:20 +00:00
修正三叉戟
This commit is contained in:
@@ -2,8 +2,15 @@ package net.momirealms.craftengine.core.entity.projectile;
|
||||
|
||||
import net.momirealms.craftengine.core.entity.ItemDisplayContext;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public record ProjectileMeta(Key item, ItemDisplayContext displayType, Vector3f scale, Vector3f translation, Quaternionf rotation, double range, String type) {
|
||||
public record ProjectileMeta(Key item,
|
||||
ItemDisplayContext displayType,
|
||||
Vector3f scale,
|
||||
Vector3f translation,
|
||||
Quaternionf rotation,
|
||||
double range,
|
||||
@Nullable ProjectileType type) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package net.momirealms.craftengine.core.entity.projectile;
|
||||
|
||||
public enum ProjectileType {
|
||||
TRIDENT
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.craftengine.core.item;
|
||||
|
||||
import net.momirealms.craftengine.core.entity.ItemDisplayContext;
|
||||
import net.momirealms.craftengine.core.entity.projectile.ProjectileMeta;
|
||||
import net.momirealms.craftengine.core.entity.projectile.ProjectileType;
|
||||
import net.momirealms.craftengine.core.item.modifier.EquippableModifier;
|
||||
import net.momirealms.craftengine.core.item.modifier.FoodModifier;
|
||||
import net.momirealms.craftengine.core.item.modifier.ItemDataModifier;
|
||||
@@ -326,7 +327,7 @@ public class ItemSettings {
|
||||
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");
|
||||
String type = args.getOrDefault("type", "none").toString();
|
||||
ProjectileType type = Optional.ofNullable(args.get("type")).map(String::valueOf).map(it -> ProjectileType.valueOf(it.toUpperCase(Locale.ENGLISH))).orElse(null);
|
||||
double range = ResourceConfigUtils.getAsDouble(args.getOrDefault("range", 1), "range");
|
||||
return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, scale, translation, rotation, range, type));
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user