Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read only optimization #236

Merged
merged 4 commits into from
Jul 4, 2023
Merged

Read only optimization #236

merged 4 commits into from
Jul 4, 2023

Conversation

tr7zw
Copy link
Owner

@tr7zw tr7zw commented Jul 4, 2023

No description provided.

@tr7zw tr7zw merged commit 1bfdb93 into master Jul 4, 2023
@what-the-diff
Copy link

what-the-diff bot commented Jul 4, 2023

PR Summary

  • Enhancement of Safe and Copy-Style Data Access
    Addition of a 'read-only' mode for NBTEntity, NBTTileEntity and NBTItem that allows copying of existing entities, blocks, or items and reading data without altering the original assets. The new mode provides a safer method for interacting and assessing data, minimizing unwanted changes to original records.

  • Modification of Methods
    The 'getCompound' and 'setCompound' methods in NBTEntity, NBTTileEntity, and NBTItem have been updated to coordinate with the new 'read-only' feature. 'getCompound' will now verify if an object is in 'read-only' mode and, if applicable, return a copy of the compound instead. 'setCompound' will generate an error if attempted on a 'read-only' object, ensuring the preservation of original data.

  • Paving the Way for Future Creation of Read-Only NBTItems
    A new constructor has been introduced to NBTItem facilitating the creation of 'read-only' NBTItems, broadening the capacity for more secure interactions with item data in the future.

  • Improving Existing Test Methods
    Updates to the 'test' method within 'DirectApplyTest' forces items to be real instead of Spigot-only items, enhancing test accuracy.

  • Improving Utils for CraftItemStack
    Addition of the getCraftItemHandle method and field_handle field, in NBTReflectionUtil, offering a more streamlined way to retrieve and handle CraftItemStack specific data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant