-
Notifications
You must be signed in to change notification settings - Fork 212
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
Refactor machine ownership to use player uuid #2905
base: 1.20.1
Are you sure you want to change the base?
Refactor machine ownership to use player uuid #2905
Conversation
src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java
Outdated
Show resolved
Hide resolved
…ing' into oe/ownership-refactor # Conflicts: # src/main/java/com/gregtechceu/gtceu/common/machine/owner/ArgonautsOwner.java # src/main/java/com/gregtechceu/gtceu/common/machine/owner/FTBOwner.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One further thought - maybe you could create a static UUID->IMachineOwner cache so that you don't have to create new instances of owners every time you call a get
. Doesn't need to be persisted to savedata or anything.
src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/ArgonautsOwner.java
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/ArgonautsOwner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/ArgonautsOwner.java
Outdated
Show resolved
Hide resolved
tbh ownership should be moved from the block entity to the machine since the block entity holder can't be synced and there's no reason for the owner field to randomly just sit there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another note, are the IMachineOwner
methods save
, load
, and create
(+ impls) still necessary? Seems that the owner itself is no longer serialized unless I missed something.
src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/PlayerOwner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/common/machine/owner/PlayerOwner.java
Show resolved
Hide resolved
extract common player information provider to interface. remove save and load methods.
changed internal method access to private.
What
Stores placer uuid instead of ownership object.
Ownership objects still exist but are generated in the getter.
Outcome
This should solve some edge cases in our current implementation:
Potential Compatibility Issues
Will remove all machine ownership data from existing worlds.
Moved ownership from block entity to meta machine so...
Any addon that re-assigned ownership will need to change from machine owner object to player uuid.