Clean up sync API & fix issues relating to generic type erasure#4489
Merged
gustovafing merged 58 commits into1.20.1-v8.0.0from Jan 31, 2026
Merged
Clean up sync API & fix issues relating to generic type erasure#4489gustovafing merged 58 commits into1.20.1-v8.0.0from
gustovafing merged 58 commits into1.20.1-v8.0.0from
Conversation
a1eb9a5 to
d6d08bb
Compare
Co-authored-by: TechLord22 <37029404+TechLord22@users.noreply.github.com>
screret
reviewed
Jan 29, 2026
|
|
||
| import javax.annotation.Nullable; | ||
|
|
||
| public class NBTSerializableTransformer implements ValueTransformer<INBTSerializable<Tag>> { |
Contributor
There was a problem hiding this comment.
Shouldn't this have a generic for the type of tag INBTSerializable takes in?
Most INBTSerializable implementations don't use a raw Tag as the generic type, usually it's CompoundTag, ListTag, etc., no?
TechLord22
reviewed
Jan 29, 2026
...java/com/gregtechceu/gtceu/api/sync_system/data_transformers/collections/MapTransformer.java
Show resolved
Hide resolved
...a/com/gregtechceu/gtceu/syncsystem/data_transformers/collections/ObjectArrayTransformer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/api/sync_system/data_transformers/EnumTransformer.java
Show resolved
Hide resolved
| } | ||
|
|
||
| for (Field field : clazz.getDeclaredFields()) { | ||
|
|
src/main/java/com/gregtechceu/gtceu/syncsystem/SyncDataHolder.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gregtechceu/gtceu/syncsystem/SyncDataHolder.java
Outdated
Show resolved
Hide resolved
| @Getter | ||
| private final Type rawType; | ||
| @Getter | ||
| private final @Nullable Class<?> classValue; |
Member
There was a problem hiding this comment.
What does this represent. It's not clear from the var name.
Member
Author
There was a problem hiding this comment.
The Class<?> of the type, if present.
| private final TypeDeclaration[] genericTypeArgs; | ||
| private final @Nullable TypeDeclaration arrayComponentType; | ||
|
|
||
| public TypeDeclaration(Type type) { |
Member
There was a problem hiding this comment.
You can make this class a record, then extract this constructor logic out into a static factory method.
Member
Author
There was a problem hiding this comment.
It's fine like this IMO
TechLord22
approved these changes
Jan 31, 2026
screret
pushed a commit
to screret/GregTech-Modern
that referenced
this pull request
Feb 8, 2026
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.
Index value transformers by
Typeinstead ofClass<?>, so that a single class can have multiple value transformers based on generic argsRemove
@FieldDataModifierand@CustomDataField, as the custom data functionality provided by them can be replicated using value transformers.Refactor value transformers API, and add more jdoc to most public methods.
Add multiple new general transformer types:
ResourceLocationReferenceTransformerfor values which are serialised based on a resource location (e.g. materials and recipe types)CodecTransformer, which just takes an existing Codec implementation for use as the transformer.