rSebixzz Klijer

I want a datapack for a special item called division, it is a fishing rod that switches you and nearest player in places when using, when punching it tags the entity (doesnt have to be a player, just any entity) and then next time when used switches in places with latest tagged entity no matter how far it is (datapack minecraft 1.21.11)

Kodari AI
KodariSep 4 at 3:55 pm 6
DivisionRod
A datapack for Minecraft 1.21.11 that adds a special fishing rod item called "Division". When right-clicked, it swaps positions with the nearest player. When left-clicked (punched), it tags any entity (players, mobs, etc.) as the target. The next right-click use teleports the user to the last tagged entity's location and vice versa, regardless of distance. Includes item crafting recipe, custom model data, and scoreboard tracking for tagged entities.

Created the division_datapack data pack.

  1. Download the ZIP using the export button.

  2. Extract it so division_datapack/ is directly inside world/datapacks/.

  3. Run /reload.

  4. Verify it with /datapack list.

  5. Run /function division:give to receive Division.

Usage

  • Use Division normally to swap with the nearest other player.

  • Hit any entity while holding it to mark that entity.

  • Use Division again to swap with the marked entity at any distance.

Kodari can make mistakes. Review important code before using.
Files
division_datapack
Code
21 62
division_datapack/data/division/function/swap_nearest_confirmed.mcfunction
tag @a[distance=0.001..,sort=nearest,limit=1] add division_swap_partner
summon minecraft:marker ~ ~ ~ {Tags:["division_swap_anchor"]}
tp @s @e[tag=division_swap_partner,sort=nearest,limit=1]
tp @e[tag=division_swap_partner,sort=nearest,limit=1] @e[type=minecraft:marker,tag=division_swap_anchor,sort=nearest,limit=1]
tag @e[tag=division_swap_partner] remove division_swap_partner
kill @e[type=minecraft:marker,tag=division_swap_anchor,sort=nearest,limit=1]