Summary
When using vanilla components only (no scripting), thrown projectiles using Item minecraft:projectile component are oriented wrong in flight and when landed on the ground. Note: using the minecraft:arrow runtime identifier to resolve this issue is not allowed in certain project and product types.
Steps to Reproduce
Create an Item, whose Behavior includes these components. (Replace the projectile_entity name with your projectile id):
"format_version": "1.20.50", ... "components": { "minecraft:projectile": { "projectile_entity": "twf_jb:incisor_spear_projectile" }, "minecraft:throwable": { "do_swing_animation": true, "launch_power_scale": 1.5, "max_launch_power": 1.5 } ...
Create a projectile Entity with the identifier chosen in the minecraft:projectile element above, with the following components
{ "format_version": "1.20.50", "minecraft:entity": { "description": { "identifier": "twf_jb:incisor_spear_projectile", "is_spawnable": false, "is_summonable": false }, "components": { "minecraft:collision_box": { "width": 0.25, "height": 0.25 }, "minecraft:projectile": { "power": 1.5, "gravity": 0.05, "inertia": 1.0, "liquid_inertia": 0.7, "on_hit": { "impact_damage": { "damage": 6, "knockback": true }, "stop_on_hit": true, "remove_on_hit": false, "lightningStrikeOnHit": false }, "hit_ground_sound": "item.trident.hit_ground" }, "minecraft:physics": { "has_collision": true }, "minecraft:despawn": { "remove_child_entities": true }, "minecraft:conditional_bandwidth_optimization": { "default_values": { "max_optimized_distance": 80.0, "max_dropped_ticks": 7, "use_motion_prediction_hints": true } } } } }
Make the Resource Pack Entity definition and model correctly so there’s something to look at when thrown:
{ "format_version": "1.10.0", "minecraft:client_entity": { "description": { "identifier": "twf_jb:incisor_spear_projectile", "materials": { "default": "entity_alphatest" }, "textures": { "default": "textures/twf/jb/items/incisor_spear" }, "geometry": { "default": "geometry.twf_jb_spear" }, "render_controllers": ["controller.render.default"], "spawn_egg": { "base_color": "#f60000", "overlay_color": "#5cf57c" } } } } ... sample model: { "format_version": "1.12.0", "minecraft:geometry": [ { "description": { "identifier": "geometry.twf_jb_spear", "texture_width": 16, "texture_height": 16, "visible_bounds_width": 3, "visible_bounds_height": 3, "visible_bounds_offset": [0, 0.5, 0] }, "bones": [ { "name": "bones", "pivot": [0, 8, 6] }, { "name": "bone", "parent": "bones", "pivot": [0, 8, 6], "cubes": [ { "origin": [-1, -8, -8], "size": [0, 16, 16], "pivot": [0, 0, -1], "rotation": [45, 0, 0], "uv": { "east": {"uv": [0, 0], "uv_size": [16, 16]} } } ] } ] } ] }
Once everything is set up, go in game and equip the Item then use it to throw it. This results in the item moving with an orientation that is not aligned with the direction of movement except when the player is facing the same way as the item was designed. See the attached animation for an example
Workarounds
Scripting wizardry, possibly performance impacting with solutions requiring per-tick calculations or many-projectile iterations.
or
Use the minecraft:arrow runtime identifier on the projectile entity (not permitted with Marketplace Add-Ons)
or
Design your minecraft:projectile entity so that it is reasonably symmetrical and so flight orientation doesn’t matter so much
Possible Solutions
a. Scripting wizardry
or
b. Associate Projectile direction of rotation with their velocity vector
or
c. Link a projectile with an anchor on the parent when thrown/launched
Attachments
Comments 0
No comments.