-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from Ladysnake/fix/serde-binary-compatibility
Add mixined fallback for binary compatibility with beta 1
- Loading branch information
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
cardinal-components-base/src/main/java/org/ladysnake/cca/mixin/base/ComponentMixin.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Cardinal-Components-API | ||
* Copyright (C) 2019-2024 Ladysnake | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE | ||
* OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
package org.ladysnake.cca.mixin.base; | ||
|
||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.registry.RegistryWrapper; | ||
import org.ladysnake.cca.api.v3.component.Component; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(Component.class) | ||
public interface ComponentMixin { | ||
@Unique | ||
void readFromNbt(NbtCompound tag); | ||
@Unique | ||
void writeToNbt(NbtCompound tag); | ||
|
||
/** | ||
* @author Pyrofab | ||
* @reason binary compatibility with mods released for beta.1 | ||
*/ | ||
@Overwrite | ||
default void readFromNbt(NbtCompound tag, RegistryWrapper.WrapperLookup registryLookup) { | ||
readFromNbt(tag); | ||
} | ||
|
||
/** | ||
* @author Pyrofab | ||
* @reason binary compatibility with mods released for beta.1 | ||
*/ | ||
@Overwrite | ||
default void writeToNbt(NbtCompound tag, RegistryWrapper.WrapperLookup registryLookup) { | ||
writeToNbt(tag); | ||
} | ||
} |
This file contains 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
14 changes: 14 additions & 0 deletions
14
cardinal-components-base/src/main/resources/mixins.cardinal_components_base.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"package": "org.ladysnake.cca.mixin.base", | ||
"mixins": [ | ||
"ComponentMixin" | ||
], | ||
"client": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |