Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/main/java/net/ornithemc/meta/web/ProfileHandlerV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,17 @@ private static JsonNode buildProfileJson(int generation, LoaderInfoV3 info, Stri
}

ObjectNode arguments = OrnitheMeta.MAPPER.createObjectNode();

ArrayNode jvmArgs = arguments.putArray("jvm");
// I believe this is required to stop the launcher from complaining
arguments.putArray("game");

if (generation >= 2) {
jvmArgs.add(info.getLoaderType().getSystemProperties().fixPackageAccess());
jvmArgs.add("true"); // not needed for FLoader, but QLoader requires the value to be true
}
jvmArgs.add(info.getLoaderType().getSystemProperties().gameVersion());
jvmArgs.add(info.getIntermediary().getVersion());

profile.set("arguments", arguments);

profile.put("libraries", libraries);
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/net/ornithemc/meta/web/models/LoaderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,22 @@

public enum LoaderType {

FABRIC("fabric", VersionDatabase.FABRIC_MAVEN_URL),
QUILT("quilt", VersionDatabase.QUILT_MAVEN_URL),
FABRIC("fabric", VersionDatabase.FABRIC_MAVEN_URL, new SystemProperties("-Dfabric.fixPackageAccess", "-Dfabric.gameVersion")),
QUILT("quilt", VersionDatabase.QUILT_MAVEN_URL, new SystemProperties("-Dloader.fixPackageAccess", "-Dloader.gameVersion")),
ORNITHE("ornithe", VersionDatabase.ORNITHE_MAVEN_URL);

private final String name;
private final String maven;
private final SystemProperties systemProperties;

private LoaderType(String name, String maven) {
this(name, maven, new SystemProperties(null, null));
}

private LoaderType(String name, String maven, SystemProperties systemProperties) {
this.name = name;
this.maven = maven;
this.systemProperties = systemProperties;
}

public String getName() {
Expand All @@ -41,4 +47,8 @@ public String getName() {
public String getMavenUrl() {
return maven;
}

public SystemProperties getSystemProperties() {
return systemProperties;
}
}
38 changes: 38 additions & 0 deletions src/main/java/net/ornithemc/meta/web/models/SystemProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2019 FabricMC
*
* Modifications copyright (c) 2022 OrnitheMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.ornithemc.meta.web.models;

public class SystemProperties {

String fixPackageAccess;
String gameVersion;

public SystemProperties(String fixPackageAccess, String gameVersion) {
this.fixPackageAccess = fixPackageAccess;
this.gameVersion = gameVersion;
}

public String fixPackageAccess() {
return this.fixPackageAccess;
}

public String gameVersion() {
return this.gameVersion;
}
}