How To Repair Tools Durability In Minecraft Command
- Search
- Tools
Command Cake Organization for repairing items in inventory?
How To Repair Tools Durability In Minecraft Command,
Source: https://www.minecraftforum.net/forums/minecraft-java-edition/redstone-discussion-and/2222612-command-block-system-for-repairing-items-in
Posted by: gonzalezhinfore.blogspot.com

#1 Sep 22, 2022
A lot of players on my server take been ticked by the revised anvil mechanics. They had some gear they worked ages on that used to exist repairable with xp after renaming, only at present volition shortly article of clothing out. This includes really rare items similar chainmail sets with nigh-max enchantments that won't last long under the new system.
As a solution I wanted to build a control-block panel that targets the nearest player and if they accept >40 levels of xp or something will wait at the currently held detail of their hotbar (or alternatively in #1 slot of a target chest nearby) and repairs the durability. And then subtracts twoscore levels from the role player and announces that the chosen item has been restored for 40 lvls. I like this idea because it still fits into the existing xp economy system but does not make any item unrepairable. I chose xl lvls because the anvil can repair items up to 39 levels and I'm wanting them to utilise the panel when they can no longer repair via anvil. And so effectively a repair-level cap at twoscore.
I'k kinda new to control blocks only know redstone well.
So I know how to check levels of nearest player and decrease them. I also know how to requite items to the player. I just demand to know if there is a command to alter durability on existing items or look in a chest or role player inventory. If there isn't, is at that place a way to copy the stats of the detail in question just create the new item with total durability and destroy the old? Either volition work.
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Expedition to Epic 204: Go on a Infinite-Historic period Adventure to visit and explore EPIC 204, a wacky earth of dense asteroids and full of conflicting life! Experience Custom Seasons, Weather, Over fifty new creatures, Beautiful Biomes, Conflicting Ruins, Dungeons, and new space age tech crafting recipes!
#3 Sep 25, 2022
bump,
And to analyze, i'm non request this to be built for me, just the relevant commands or a "no, sorry, that can't be done" reply. I see some of what I need just can't see a way to practice this with the basic commands, but they may merely be because I'k new to command blocks.
I will need commands to address the following:
1. Reading a actor's level and subtracting levels (I know how to do this one)
2. A command to read immovability on an item (I only want this will but piece of work if a repairable detail is there so the actor'due south levels aren't wasted. I likewise don't want it to to work if the detail doesn't have a durability)
three. A control to either change the durability of an item (so I can gear up it to full) or to create a new, identical particular with the same specifications including changes to proper noun and enchantments and destroy the sometime. (this could be easier if there is no easy style to tell what "total" durability is on the particular as I know it varies and may not be recorded with the item)
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Expedition to Epic 204: Become on a Infinite-Age Adventure to visit and explore Ballsy 204, a wacky globe of dense asteroids and full of conflicting life! Experience Custom Seasons, Atmospheric condition, Over 50 new creatures, Beautiful Biomes, Alien Ruins, Dungeons, and new space historic period tech crafting recipes!
#4 Sep 25, 2022
well, I really wish someone had taken the time to help me as I'm sure this has been done earlier.
However, I take finally, afterwards most 5 hours of research figured out how to do information technology. the wiki was very vague with the datatag "impairment". Information technology was not clear at all that this was what determined the amount of uses left just I finally figured information technology out through trial and error investigating the error reports of the command blocks. also, there apparently is some bogus variable "Wellness" which I idea was impairment but seemed to do nothign when I addressed it. I finally figured out that this only governs the damage due to lava/burn down/explosions and is separate.
The solution:
I ended up having to switch to a method where yous drop the item to exist restored considering and then I tin admission the information equally a dropped item entity with entitydata and reset the damage on the item to zero. It works perfectly and simply works if a player with 41+ levels is in the area and a damaged item is dropped in the altar area. I orginally wanted it to exist placed in a furnace slot as then I could flame the furnace and make information technology look like something happened, but whenever I used blockdata and got to the variables of the stored item using Item:{slot:0,Damage:0s} it overwrote the item there. I'g unsure why every bit I simply changed the variable damage, even so, it acted like I was creating a new detail there because if I manually set an id the particular with that id popped into being with the variables set as I did. I'm gonna guess this is a bug from addressing the stored detail within the furnace. It assumes id and other vars are null if you don't set them, effectively erasing the item if yous just attempt to talk to one of the stored variables. Withal, this dropped item idea I had works perfectly, so problems solved! I even constitute a nice way using comparators to not run the xp subtraction step if the item dropped had damage already set to 0! Flawless!
Rollback Mail to Revision RollBack
Download and play my new Survival Map!
Space Trek to EPIC 204: Continue a Space-Age Adventure to visit and explore Ballsy 204, a wacky world of dumbo asteroids and full of alien life! Feel Custom Seasons, Weather condition, Over 50 new creatures, Cute Biomes, Conflicting Ruins, Dungeons, and new infinite age tech crafting recipes!
#6 Sep 27, 2022
Thanks for your response!
I have non found a way to clone items like you tin clone blocks which is why I eventually settled on what I did. I figured it might exist too complicated trying to replicate all the enchantments,name,etc on the detail. If you know how to do that I'd be interested in knowing how as that might be useful to me for future systems. Would cloning a container block as well clone the items in it? I didn't try that.
My organization needs 3 control blocks finer, merely I ended up needing to upwardly it to 6 to govern the logic and reset the output state of the showtime blocks later (considering I was using comparator logic). The system wouldn't fire again if I didn't do this. I was wondering if you knew a more than efficient mode to reset block country of command blocks so the comparators would turn off. Every bit it is I need an extra command block currently for every cake that I employ logic on. I am using blockdata to reset their successCount variable.
Since yous expressed interest here is how I accessed the datatag:
/entitydata @e[type=Item,ten=,y=,z=,r=ane] {Item:{Damage:0s}}
x,y,z is the position of the altar of healing. Basically a low in the floor that they driblet items into.
Each entity has a lot of new datatags that tin can be accessed, merely dropped item entities from using blazon=Item still human action like they are an object with a unmarried slot and thus have the Item:{...} format like at that place is an detail inside them. For whatever reason addressing it this mode did not overrwrite the item like when I tried accessing within a block but I might have just made a mistake previously.
Rollback Postal service to Revision RollBack
Download and play my new Survival Map!
Space Expedition to Ballsy 204: Proceed a Space-Age Take a chance to visit and explore Ballsy 204, a wacky world of dense asteroids and full of alien life! Experience Custom Seasons, Weather condition, Over 50 new creatures, Cute Biomes, Alien Ruins, Dungeons, and new space age tech crafting recipes!
#7 Mar 14, 2022
I know this is an old thread merely cheers so much for this! It helped tremendously! I actually tried using the entitydata command too but I had it written entitydata @e[tag=whatever] {Damage:0}, I wasn't aware that you had to add together the {Item:} part lol I am making a system where you throw three lapis and a damaged weapon/armor/tool into a special altar and they get repaired (5 lapis and 1 experience level for enchanted items)
Rollback Post to Revision RollBack
#8 Mar 14, 2022
cool man! Sounds similar fun! Glad this old thread helped.
These days if I'm unsure of the formatting of a datastructure I can access it using open curly braces on a control.
For instance if I want to see the data of an entity I run
/entitydata @e[r=2] {} - standing 2 blocks away from it. Information technology can't access you and then information technology accesses the other entity and prints all their data exactly equally information technology should be. Open up curly braces changes nothing, only prints what's already in that location. If y'all want to be able to copy it run that command from a control block and check the feedback line.
You can do the aforementioned thing with blockdata
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Expedition to EPIC 204: Go along a Space-Age Hazard to visit and explore Epic 204, a wacky world of dense asteroids and full of alien life! Experience Custom Seasons, Conditions, Over 50 new creatures, Beautiful Biomes, Alien Ruins, Dungeons, and new space age tech crafting recipes!
#ten Mar 13, 2022
@Batr3k is your Y-Coord the ground level or the one above information technology?
~MS
Rollback Post to Revision RollBack
#12 Mar xiii, 2022
I never realised you had wrote the new snapshots before that is my fault... in them they have removed the ENTITYDATA command you need to use this at present
/data merge entity @e[limit=one,type=minecraft:item] {Item: {tag: {Damage: 0}}}~MS
Rollback Mail service to Revision RollBack