Can you disable the repair cost increasing in Minecraft 1.8?

As you might know, starting with Minecraft 1.8, the repair cost for an item goes up the more it was previously repaired, to the point where the item can no longer be repaired.
Is there a way to revert this change using command blocks?
Best Answer
The repair cost of an item is saved in the items NBT data, specifically the RepairCost
tag. Knowing this, we can easily create a command block contraption that resets this tag.
Simple version:
Create a redstone clock inside your spawn-chunks (I suggest placing it inside a bedrock box), and use it to power a command block with the following command:
/entitydata @e[type=Item] {tag:{RepairCost:0}}
This will add the RepairCost
tag to every item that is lying on the ground, including those who never had it, or for which it makes no sense, such as Cobblestone or Logs. I can't think of a better, non-tedious method, however.
Pictures about "Can you disable the repair cost increasing in Minecraft 1.8?"



How do I reduce the cost of repairs in Minecraft?
Each time you repair or combine an item, the level cost increases by 2. You can mitigate this, somewhat, by renaming the item first. This will add some to the level cost for future repairs/combinations, but it makes the item exempt from the increasing cost each time you do.Does repairing items in Minecraft become more expensive?
When an item is enchanted on an anvil for the first time, the players will have to pay a certain amount of XP levels. However, as they start adding more enchantments to an item, the cost will begin to increase. At one point, players won't be able to repair or enchant an item as the cost will become too expensive.How many times can you repair an item in Minecraft?
In survival, you can only work an item 6 times, including repairs (but as I stated not including renames alone), with the xp cost increasing each time.Can you repair an enchanted pickaxe in Minecraft?
An enchanted diamond axe can be repaired using either a diamond, or another diamond axe. Place two enchanted items of the same type on the left, and if possible their enchantments will be combined into a new item.How To Bypass \
More answers regarding can you disable the repair cost increasing in Minecraft 1.8?
Answer 2
Updated version from 1.13+
Some commands have been reworked in 1.13, and /entitydata
doesn't exist anymore.
Here is a modern, up-to-date solution (works as of 1.16 snapshots even!) using /execute
and /data
:
/execute as @e[type=item] run data remove entity @s Item.tag.RepairCost
This has the advantage of only removing the RepairCost
tag without making any unnecessary changes.
Usage
Drop items, run command, pick items up again, cleared of repair penalty. Optionally stick the command into a command block with a button, drop items, push button, pick up.
How it works:
/execute as @e[type=item] run
/execute
causes a command to be run for every item selected by the selector (here @e[type=item]
: all entities of a type "item" - dropped items are entities of this exact type)
as
makes the command's "executor" the actual entity targeted (as opposed to the player/server who runs it, this will be important later on
run
specifies that the rest is the actual command to execute
Now every dropped item "runs" the following:
/data remove entity @s Item.tag.RepairCost
/data
is the new command for all your entity and block data manipulation needs, it has very many complex options...
remove
specifies we will be removing something
entity
specifies we are targeting an entity, you can also target a block or "storage", I am guessing you can use this to store data for later use without tying it to an entity - sort of like included in your world's savefile.
@s
targets "self", or the entity executing the command (that's why the as
in /execute
is important - it makes it so now @s
actually selects the specific dropped item).
Item.tag.RepairCost
-this simply selects what we want to target for remove
to do its work. You can run the command with get
instead of remove to show how it works - it will display that particular item's repair cost if it has any. In case of RepairCost, it is stored under the Inventory Item's "tag" list, which also can contain enchantments, damage values, and other extra data, while the Inventory Item itself is stored as an "Item" object on the actual minecraft:item entity.
As a bonus, the command provides instant feedback with the changes that actually occurred - if no items were modified, there is no output, and otherwise a line per item modified is shown.
More details/rambling
The below screenshot documents some of my poking around; lines saying "such and such has the following entity data" are where I used get
instead of remove
to get a hang of the structure. The first few lines with eggs and salmon items I targeted simply Item
, which then returns the typename of the Inventory Item; then I ran Item.tag
which technically ran on the salmon and eggs, too, but since they did not have any tags on their Item
no message was shown; the Enchanted book had a tag
containing a list StoredEnchantments
and a RepairCost
(getting closer!). Next was the entire command, just with get
instead of remove
, confirming items with a RepairCost
of "1". Next messages ("Modified entity data") is where I ran remove - afterwards the get
command did not result in messages as all items with RepairCost
were gone now. As a test, I ran the get
command with Item.tag
as target to see if my pickaxe had a repair cost tacked on, and it didn't - it did nicely show the Damage
value and the list of Enchantments
.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: cottonbro, Blue Bird, Delcea Nicolae Cosmin, Andrea Piacquadio