diff --git a/api-internal/src/main/java/at/pavlov/internal/projectile/definition/CustomProjectileDefinition.java b/api-internal/src/main/java/at/pavlov/internal/projectile/definition/CustomProjectileDefinition.java index 71f16475..9fa56bdf 100644 --- a/api-internal/src/main/java/at/pavlov/internal/projectile/definition/CustomProjectileDefinition.java +++ b/api-internal/src/main/java/at/pavlov/internal/projectile/definition/CustomProjectileDefinition.java @@ -33,4 +33,6 @@ public class CustomProjectileDefinition implements ProjectilePhysics { private final @Nullable Integer customModelData; private final @NotNull Map attributes; + + private final @NotNull Map entityDisplayData; } diff --git a/cannons-bukkit/src/main/java/at/pavlov/cannons/projectile/definitions/ProjectileDefinitionLoader.java b/cannons-bukkit/src/main/java/at/pavlov/cannons/projectile/definitions/ProjectileDefinitionLoader.java index 9f76a4ba..41a5c779 100644 --- a/cannons-bukkit/src/main/java/at/pavlov/cannons/projectile/definitions/ProjectileDefinitionLoader.java +++ b/cannons-bukkit/src/main/java/at/pavlov/cannons/projectile/definitions/ProjectileDefinitionLoader.java @@ -57,9 +57,15 @@ private static void loadEntry(YamlConfiguration cfg, String node) { .charged(section.getBoolean("charged")) .critical(section.getBoolean("critical")) .material(Key.from(section.getString("material", "SNOWBALL"))) - .customModelData(section.getObject("customModelData", Integer.class, null)); + .customModelData(section.getObject("customModelData", Integer.class, null)) + .attributes(getStringDoubleHashMap(section, "attributes")) + .entityDisplayData(getStringDoubleHashMap(section, "entityDisplayData")); - var attributeSection = section.getConfigurationSection("attributes"); + Registries.CUSTOM_PROJECTILE_DEFINITION.register(builder.build()); + } + + private static @NotNull HashMap getStringDoubleHashMap(ConfigurationSection section, String key) { + var attributeSection = section.getConfigurationSection(key); HashMap attributeMap = new HashMap<>(); if (attributeSection != null) { for (var attrName : attributeSection.getKeys(false)) { @@ -67,8 +73,6 @@ private static void loadEntry(YamlConfiguration cfg, String node) { attributeMap.put(attrName, value); } } - - builder = builder.attributes(attributeMap); - Registries.CUSTOM_PROJECTILE_DEFINITION.register(builder.build()); + return attributeMap; } } diff --git a/cannons-bukkit/src/main/resources/projectile_definitions.yml b/cannons-bukkit/src/main/resources/projectile_definitions.yml index e72bacd9..ddd3dda5 100644 --- a/cannons-bukkit/src/main/resources/projectile_definitions.yml +++ b/cannons-bukkit/src/main/resources/projectile_definitions.yml @@ -22,6 +22,20 @@ # attributes: # scale: 2.0 # +# # available for all entities that are Display, mainly for ItemDisplay +# entityDisplayData: +# # initial rotations +# rotationX: 5.0 +# rotationY: -5.0 +# rotationZ: 0.0 +# +# # change in rotation in degrees x tick +# rotationSpeedX: -5.0 +# rotationSpeedY: 2.0 +# rotationSpeedZ: 0.0 +# +# size: 4.0 +# # # this stuff is for throwable projectiles, such as snowballs, and item displays # material: SNOWBALL # you can set any material https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html # customModelData: 123 # must be an integer, texturepack magic number goes here