-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
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
50 changes: 50 additions & 0 deletions
50
src/main/java/zone/rong/mixinbooter/util/MockedArtifactVersionAdapter.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,50 @@ | ||
package zone.rong.mixinbooter.util; | ||
|
||
import com.google.gson.TypeAdapter; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonWriter; | ||
import net.minecraftforge.fml.common.versioning.ArtifactVersion; | ||
|
||
import java.io.IOException; | ||
|
||
public class MockedArtifactVersionAdapter extends TypeAdapter<ArtifactVersion> { | ||
|
||
@Override | ||
public void write(JsonWriter out, ArtifactVersion value) { } | ||
|
||
@Override | ||
public ArtifactVersion read(JsonReader in) throws IOException { | ||
in.nextString(); | ||
return new MockedArtifactVersion(); | ||
} | ||
|
||
private static class MockedArtifactVersion implements ArtifactVersion { | ||
|
||
@Override | ||
public String getLabel() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public String getVersionString() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public boolean containsVersion(ArtifactVersion source) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getRangeString() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public int compareTo(ArtifactVersion o) { | ||
return 0; | ||
} | ||
|
||
} | ||
|
||
} |