DragonsPlusMinecraft / CreateEnchantmentIndustry-Fabric

CEI Fabric
https://modrinth.com/mod/create-enchantment-industry-fabric
MIT License
12 stars 13 forks source link

Fix copying written book and increment generation #77

Open IS4Code opened 1 week ago

IS4Code commented 1 week ago

At the moment, copying written books using printer behaves in a seemingly bugged way:

I am not sure if this behaviour is intended or not, but it is definitely inconsistent and counter-intuitive. In normal Minecraft, copying a written book degrades the result, not the source. There are no other situations in this mod where using a printer on something would modify the actual item stored in the printer. It is also in conflict with the description of copyingWrittenBookAlwaysGetOriginalVersion:

#Whether or not copying a written book always get original version. Setting it to false let you always get copy version of the book.

My best guess is that it is an error ‒ the code copies target (the item in the printer) and stores it as ret, but then proceeds to modify target without affecting ret at all. As a result, a perfect copy of the original is outputted, while the original is modified in-place.

This pull request changes the existing behaviour to the following: