-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add fabric-api to meta #10
Open
dexman545
wants to merge
7
commits into
FabricMC:master
Choose a base branch
from
dexman545:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2aa7b40
Add fabric-api to meta
dexman545 9c9a049
Add info about mc->api versions
dexman545 00834b5
Set all API versions to stable
dexman545 0da7fba
Refactor minecraftVersion -> majorMinecraftVersion
dexman545 7cf51e4
Added hashes to API
dexman545 0f3add4
Update to use repo and not gist
dexman545 7165a66
CHange url to be main instead of HEAD
dexman545 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
48 changes: 48 additions & 0 deletions
48
src/main/java/net/fabricmc/meta/utils/ApiVersionParser.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,48 @@ | ||
package net.fabricmc.meta.utils; | ||
|
||
public class ApiVersionParser { | ||
|
||
private String apiVersion; | ||
private String minecraftVersion; | ||
|
||
private String version; | ||
private int build; | ||
|
||
public ApiVersionParser(String version) { | ||
this.version = version; | ||
|
||
// Fix old API versions not having MC version | ||
// Recreated from curseforge version index | ||
if (version.contains("0.3.1") || version.contains("0.3.0")) { | ||
version = version + "-1.14"; | ||
} | ||
|
||
if (version.contains("+build.")) { | ||
//TODO legacy remove when no longer needed | ||
this.minecraftVersion = version.substring(version.lastIndexOf('-')); | ||
this.apiVersion = version.substring(0, version.lastIndexOf('+') - 1); | ||
this.build = Integer.parseInt(version.substring(version.lastIndexOf("+build.")+7, version.lastIndexOf('-'))); | ||
} else { | ||
this.minecraftVersion = version.substring(version.lastIndexOf('+')); | ||
this.apiVersion = version.substring(0, version.lastIndexOf('+') - 1); | ||
this.build = 999; // Build number is no longer appended to versions, use dummy version | ||
} | ||
} | ||
|
||
public String getApiVersion() { | ||
return apiVersion; | ||
} | ||
|
||
public String getMinecraftVersion() { | ||
return minecraftVersion; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return version; | ||
} | ||
|
||
public int getBuild() { | ||
return build; | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
src/main/java/net/fabricmc/meta/web/models/MavenBuildApiGameVersion.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,30 @@ | ||
package net.fabricmc.meta.web.models; | ||
|
||
import net.fabricmc.meta.utils.ApiVersionParser; | ||
|
||
public class MavenBuildApiGameVersion extends MavenBuildVersion{ | ||
|
||
String gameVersion; | ||
|
||
public MavenBuildApiGameVersion(String maven) { | ||
super(maven); | ||
|
||
String[] mavenP = maven.split(":"); | ||
String version = mavenP[mavenP.length-1]; | ||
ApiVersionParser parser = new ApiVersionParser(version); | ||
gameVersion = parser.getMinecraftVersion(); | ||
this.build = parser.getBuild(); | ||
System.out.println(version); | ||
this.version = version.substring(0, version.lastIndexOf(gameVersion.charAt(0)) != -1 ? version.lastIndexOf(gameVersion.charAt(0)) : version.length() - 1); | ||
this.gameVersion = gameVersion.replaceAll("[+-]", ""); // Remove prefix character | ||
} | ||
|
||
public String getGameVersion() { | ||
return gameVersion; | ||
} | ||
|
||
@Override | ||
public boolean test(String s) { | ||
return getGameVersion().equals(s); | ||
} | ||
} |
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
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.
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.
This isnt going to be accrate and it needs to be if provided via an api. I've been over this a few times in detail in discord.
The only way to provide good data is to have a manually managed database of what mc versions fabric api will work with. Some API versions work across a number of versions (Think pre-releases espeacially). this seems to just be using the branch provided in the version witch doesnt help decided between 1.16.1 and 1.16.2 in any way.
If launchers/installers are going to install fabric api they need to be 100% sure its going to work, this doesnt provide that.
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.
Where should this database exist, and how should it be added to?
Example in progress mc->api: https://gist.github.com/dexman545/478d9ca5598a48ed2960fbb5d06ef0be