Held Item Soulbound

Started by Wayward_Spud on

Topic category: Help with modding (Java Edition)

Last seen on 22:31, 20. Sep 2022
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Held Item Soulbound

I want to make it so that if the player is wearing the full set of the fox costume, then any item the player is holding will not drop when they die and stay in the same slot when they respawn. I've already got the armor detection part done, now I'm just trying to figure out how to save the players held item from death.

Last seen on 09:57, 7. Sep 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
me too :( anyone have any…
Sat, 08/27/2022 - 23:04

me too :( anyone have any answers?

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
On player death save the…
Tue, 08/30/2022 - 20:41

On player death save the item and item slot of your main hand as persistent player variables(item and number), and then place it back in that slot when the player respawns. Putting it in the same slot is harder as getting the current slot the player is using is a little difficult with mcreator.

Item Slot Number Detection:

Step 1: Create slotNum variable and slotNumTarget variable. Create and set item to local item variable itemTargetto the item in your hand.

Step 2: Remove the item and set the main hand to 1 stick.

Step 3: Set an nbtvalue to that stick (arbitrary what it is)

Step 4: Use the "For each slot in inventory" procedure. Each time it calls set the slotNum =slotNum+1. (This iterates your slot numbers) and

Step 5: In this loop, if the item is equal to a stick with your nbt value, set slotNumTarget to slotNum, and remove the stick, and replace the item with your local item variable itemTarget.

Step 6: To pass the variables on death, save slotNumTarget to player persistent number variable, save itemTarget to player persistent item variable on death, and remove the itemTarget from inventory on death (so it doesn't duplicate). On respawn, place the itemTarget in slot slotNumtarget and then reset both values.

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually this should work…
Tue, 08/30/2022 - 20:51

Actually this should work without the need for a stick.Image