How To Get /repair Command In Minecraft
- Search
- Tools
Command Cake System for repairing items in inventory?
Source: https://www.minecraftforum.net/forums/minecraft-java-edition/redstone-discussion-and/2222612-command-block-system-for-repairing-items-in
Posted by: comptondistravemed.blogspot.com
#1 Sep 22, 2022
A lot of players on my server accept been ticked past the revised anvil mechanics. They had some gear they worked ages on that used to be repairable with xp after renaming, but now will soon wear out. This includes really rare items similar chainmail sets with near-max enchantments that won't final long under the new arrangement.
As a solution I wanted to build a control-block console that targets the nearest player and if they have >twoscore levels of xp or something will expect at the currently held item of their hotbar (or alternatively in #i slot of a target chest nearby) and repairs the immovability. And so subtracts 40 levels from the player and announces that the chosen item has been restored for 40 lvls. I like this thought because it notwithstanding fits into the existing xp economy system but does non make whatever item unrepairable. I chose 40 lvls because the anvil tin repair items upwards to 39 levels and I'm wanting them to utilize the console when they tin can no longer repair via anvil. And so effectively a repair-level cap at 40.
I'm kinda new to control blocks but know redstone well.
So I know how to cheque levels of nearest player and subtract them. I likewise know how to give items to the player. I just need to know if in that location is a command to alter durability on existing items or look in a breast or player inventory. If there isn't, is in that location a style to copy the stats of the detail in question merely create the new item with full durability and destroy the old? Either will piece of work.
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Trek to Ballsy 204: Go on a Space-Age Take a chance to visit and explore EPIC 204, a wacky globe of dumbo asteroids and full of conflicting life! Feel Custom Seasons, Conditions, Over 50 new creatures, Beautiful Biomes, Alien Ruins, Dungeons, and new space age tech crafting recipes!
#3 Sep 25, 2022
bump,
And to clarify, i'thousand not asking this to be built for me, just the relevant commands or a "no, sorry, that can't be washed" respond. I meet some of what I need but can't encounter a way to do this with the basic commands, but they may just be considering I'g new to control blocks.
I volition need commands to accost the following:
one. Reading a player's level and subtracting levels (I know how to do this 1)
2. A command to read durability on an item (I merely desire this will only work if a repairable particular is there and then the role player's levels aren't wasted. I likewise don't want it to to piece of work if the detail doesn't accept a durability)
iii. A control to either change the immovability of an item (so I can gear up it to total) or to create a new, identical particular with the same specifications including changes to name and enchantments and destroy the old. (this could be easier if there is no easy way to tell what "total" immovability is on the detail as I know it varies and may not be recorded with the detail)
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Trek to Epic 204: Get on a Space-Age Adventure to visit and explore Epic 204, a wacky world of dense asteroids and full of alien life! Experience Custom Seasons, Weather, Over 50 new creatures, Beautiful Biomes, Alien Ruins, Dungeons, and new space age tech crafting recipes!
#4 Sep 25, 2022
well, I really wish someone had taken the time to help me as I'm certain this has been done earlier.
Still, I have finally, afterward about 5 hours of research figured out how to do it. the wiki was very vague with the datatag "damage". It was not clear at all that this was what determined the amount of uses left but I finally figured it out through trial and error investigating the fault reports of the control blocks. besides, in that location apparently is some bogus variable "Health" which I idea was damage but seemed to practice nothign when I addressed it. I finally figured out that this but governs the damage due to lava/fire/explosions and is separate.
The solution:
I ended upwardly having to switch to a method where y'all drib the item to be restored considering then I can admission the data as a dropped particular entity with entitydata and reset the harm on the item to zero. It works perfectly and only works if a player with 41+ levels is in the surface area and a damaged item is dropped in the altar area. I orginally wanted information technology to exist placed in a furnace slot as then I could flame the furnace and make it wait like something happened, only whenever I used blockdata and got to the variables of the stored item using Item:{slot:0,Harm:0s} information technology overwrote the detail in that location. I'1000 unsure why as I only changed the variable damage, however, information technology acted similar I was creating a new item there because if I manually prepare an id the particular with that id popped into being with the variables set equally I did. I'g gonna estimate this is a bug from addressing the stored particular within the furnace. It assumes id and other vars are aught if you don't set them, effectively erasing the detail if you simply effort to talk to one of the stored variables. However, this dropped particular idea I had works perfectly, and so problems solved! I even found a nice way using comparators to not run the xp subtraction stride if the particular dropped had damage already prepare to 0! Flawless!
Rollback Mail to Revision RollBack
Download and play my new Survival Map!
Space Expedition to EPIC 204: Go on a Space-Age Adventure to visit and explore Epic 204, a wacky world of dense asteroids and total of alien life! Experience Custom Seasons, Weather, Over fifty new creatures, Cute Biomes, Alien Ruins, Dungeons, and new space age tech crafting recipes!
#6 Sep 27, 2022
Thanks for your response!
I accept not institute a mode to clone items like you can clone blocks which is why I eventually settled on what I did. I figured it might exist also complicated trying to replicate all the enchantments,name,etc on the item. If you lot know how to practice that I'd exist interested in knowing how as that might be useful to me for future systems. Would cloning a container block also clone the items in it? I didn't effort that.
My system needs 3 command blocks effectively, but I concluded up needing to up it to 6 to govern the logic and reset the output state of the start blocks afterwards (because I was using comparator logic). The organisation wouldn't fire again if I didn't do this. I was wondering if you knew a more than efficient mode to reset block state of control blocks so the comparators would turn off. As information technology is I need an extra command block currently for every block that I use logic on. I am using blockdata to reset their successCount variable.
Since y'all expressed interest hither is how I accessed the datatag:
/entitydata @e[blazon=Item,x=,y=,z=,r=1] {Item:{Damage:0s}}
10,y,z is the position of the altar of healing. Basically a low in the floor that they drib items into.
Each entity has a lot of new datatags that can be accessed, but dropped particular entities from using type=Item withal act like they are an object with a single slot and thus have the Item:{...} format like there is an item within them. For whatever reason addressing it this style did not overrwrite the item like when I tried accessing within a cake only I might take just made a mistake previously.
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Expedition to Ballsy 204: Go on a Space-Historic period Adventure to visit and explore EPIC 204, a wacky world of dense asteroids and full of alien life! Experience Custom Seasons, Weather, Over 50 new creatures, Beautiful Biomes, Alien Ruins, Dungeons, and new space age tech crafting recipes!
#7 Mar 14, 2022
I know this is an sometime thread but thank yous so much for this! It helped tremendously! I really tried using the entitydata command likewise simply I had it written entitydata @east[tag=whatever] {Impairment:0}, I wasn't aware that you had to add together the {Item:} part lol I am making a arrangement where you throw three lapis and a damaged weapon/armor/tool into a special altar and they get repaired (five lapis and one experience level for enchanted items)
Rollback Post to Revision RollBack
#viii Mar xiv, 2022
cool man! Sounds like fun! Glad this old thread helped.
These days if I'chiliad unsure of the formatting of a datastructure I can access it using open curly braces on a command.
For instance if I want to encounter the data of an entity I run
/entitydata @e[r=two] {} - standing 2 blocks abroad from information technology. Information technology can't access you lot so it accesses the other entity and prints all their information exactly as information technology should be. Open curly braces changes zip, just prints what's already in that location. If you lot want to be able to copy it run that control from a command block and bank check the feedback line.
You tin do the same thing with blockdata
Rollback Post to Revision RollBack
Download and play my new Survival Map!
Space Expedition to EPIC 204: Keep a Space-Historic period Adventure to visit and explore EPIC 204, a wacky world of dense asteroids and full of conflicting life! Experience Custom Seasons, Weather, Over 50 new creatures, Beautiful Biomes, Alien Ruins, Dungeons, and new infinite age tech crafting recipes!
#x Mar xiii, 2022
@Batr3k is your Y-Coord the ground level or the one higher up it?
~MS
Rollback Post to Revision RollBack
#12 Mar thirteen, 2022
I never realised you had wrote the new snapshots before that is my fault... in them they accept removed the ENTITYDATA control yous need to apply this at present
~MS
Rollback Postal service to Revision RollBack