Fix copying written book and increment generation#77
Open
IS4Code wants to merge 1 commit intoDragonsPlusMinecraft:1.20.1/0.5.1-devfrom
Open
Fix copying written book and increment generation#77IS4Code wants to merge 1 commit intoDragonsPlusMinecraft:1.20.1/0.5.1-devfrom
IS4Code wants to merge 1 commit intoDragonsPlusMinecraft:1.20.1/0.5.1-devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At the moment, copying written books using printer behaves in a seemingly bugged way:
copyingWrittenBookAlwaysGetOriginalVersionset totrue, copying any written book sets the original's generation to 0 (original).copyingWrittenBookAlwaysGetOriginalVersionset tofalse, copying any written book sets the original's generation to 1 (copy of original).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 asret, but then proceeds to modifytargetwithout affectingretat 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:
copyingWrittenBookAlwaysGetOriginalVersionset totrue, a perfect copy of the original is returned. No modifications togenerationare necessary at all, ensuring that the actual original version is preserved, as stated by the description of the setting.copyingWrittenBookAlwaysGetOriginalVersionset tofalse, the result'sgenerationis incremented for values 0 (original) and 1 (copy of original), going to 1 and 2, respectively, while it is unchanged for other generations. This makes the printer more in-line with Minecraft's behaviour of copying books, while the advantage of being able to copy books in generation 2 (copy of copy) stays the same.