Started by
Nemmy
on
Topic category: Help with Minecraft modding (Java Edition)
Recently I came up with the idea to have swords be throwable in a mod I have been working on for a while.
MCreator Version 2024.4
For Minecraft 1.20.1
Here's what worked:
- You put a sword in your off hand and R-click.
- It fires a projectile of the sword in your off hand (a 3D model rather than the default 2D item model) while removing the sword from your off hand.
- The projectile places a custom block that is modeled to look like a sword stuck in the ground.
- The custom sword block when R-clicked or broken drops a sword of the same type you threw.
Here's the problem:
I cant figure out a good way to transfer all of the initial item's data (durability/item damage, enchantments) across the various objects back into a new item.
Things that complicated the process for me:
- Multiple swords can be airborne at once
- The sword thrown first can land last (making a solution with global variables seemingly unreasonable/convoluted?)
- I couldn't figure out a way for the block placed by the sword projectile to store the durability as NBT data even after making the block an entity
- Having anything constantly ticking, rather than based on events seems inefficient, and not necessary
- I have no idea how to store enchantment data as anything
- I want item enchantments from other mods to work with the method I use
- Projectile entities cant have inventory?
Edited by Nemmy on Tue, 12/23/2025 - 18:53