-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Data Bug in 1_16_R3, fix for 1_14_R1 to 1_16_R2 comming soon
- Loading branch information
1 parent
f25b0df
commit 83a1380
Showing
33 changed files
with
351 additions
and
89 deletions.
There are no files selected for viewing
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
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
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
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
40 changes: 21 additions & 19 deletions
40
...main/java/net/sourcewriters/minecraft/versiontools/reflection/data/type/SkinDataType.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 |
---|---|---|
@@ -1,46 +1,48 @@ | ||
package net.sourcewriters.minecraft.versiontools.reflection.data.type; | ||
|
||
import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; | ||
import com.syntaxphoenix.syntaxapi.data.DataType; | ||
import com.syntaxphoenix.syntaxapi.data.IDataContainer; | ||
import com.syntaxphoenix.syntaxapi.data.PrimitiveDataType; | ||
|
||
import net.sourcewriters.minecraft.versiontools.reflection.VersionControl; | ||
import net.sourcewriters.minecraft.versiontools.reflection.data.WrapType; | ||
import net.sourcewriters.minecraft.versiontools.reflection.data.WrappedContainer; | ||
import net.sourcewriters.minecraft.versiontools.reflection.data.WrappedContext; | ||
import net.sourcewriters.minecraft.versiontools.utils.minecraft.Skin; | ||
|
||
public final class SkinDataType implements WrapType<WrappedContainer, Skin> { | ||
public final class SkinDataType implements DataType<IDataContainer, Skin> { | ||
|
||
public static final SkinDataType INSTANCE = new SkinDataType(); | ||
public static final WrapType<?, Skin> INSTANCE = VersionControl.get().getBukkitConversion().wrap(new SkinDataType()); | ||
|
||
private SkinDataType() {} | ||
|
||
@Override | ||
public Class<Skin> getComplexWrapped() { | ||
public Class<Skin> getComplex() { | ||
return Skin.class; | ||
} | ||
|
||
@Override | ||
public Class<WrappedContainer> getPrimitiveWrapped() { | ||
return WrappedContainer.class; | ||
public Class<IDataContainer> getPrimitive() { | ||
return IDataContainer.class; | ||
} | ||
|
||
@Override | ||
public Skin wrapToComplex(WrappedContainer primitive, WrappedContext<?> context) { | ||
IDataContainer container = primitive.getAsSyntaxContainer(); | ||
public IDataContainer toPrimitive(DataAdapterContext context, Skin complex) { | ||
IDataContainer container = context.newDataContainer(); | ||
container.set("name", complex.getName(), PrimitiveDataType.STRING); | ||
container.set("value", complex.getValue(), PrimitiveDataType.STRING); | ||
container.set("signature", complex.getSignature(), PrimitiveDataType.STRING); | ||
return container; | ||
} | ||
|
||
@Override | ||
public Skin fromPrimitive(DataAdapterContext context, IDataContainer container) { | ||
String name = container.get("name", PrimitiveDataType.STRING); | ||
String value = container.get("value", PrimitiveDataType.STRING); | ||
String signature = container.get("signature", PrimitiveDataType.STRING); | ||
if(name == null || value == null || signature == null) { | ||
return null; | ||
} | ||
return new Skin(name, value, signature, false); | ||
} | ||
|
||
@Override | ||
public WrappedContainer wrapToPrimitive(Skin complex, WrappedContext<?> context) { | ||
WrappedContainer wrapped = context.newContainer(); | ||
IDataContainer container = wrapped.getAsSyntaxContainer(); | ||
container.set("name", complex.getName(), PrimitiveDataType.STRING); | ||
container.set("value", complex.getValue(), PrimitiveDataType.STRING); | ||
container.set("signature", complex.getSignature(), PrimitiveDataType.STRING); | ||
return wrapped; | ||
} | ||
|
||
} |
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
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
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
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
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
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
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
Oops, something went wrong.