Please Help Me Find Ways to Transfer Data Across Various Types of Objects, Particularly for throwing Weapons in My Mod.

Started by Nemmy on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please Help Me Find Ways to Transfer Data Across Various Types of Objects, Particularly for throwing Weapons in My Mod.
Tue, 12/23/2025 - 18:53 (edited)

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:

  1. You put a sword in your off hand and R-click.
  2. 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.
  3. The projectile places a custom block that is modeled to look like a sword stuck in the ground.
  4. 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:

  1. Multiple swords can be airborne at once
  2. The sword thrown first can land last (making a solution with global variables seemingly unreasonable/convoluted?)
  3.  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
  4. Having anything constantly ticking, rather than based on events seems inefficient, and not necessary
  5. I have no idea how to store enchantment data as anything
  6. I want item enchantments from other mods to work with the method I use
  7. Projectile entities cant have inventory?
Edited by Nemmy on Tue, 12/23/2025 - 18:53