-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ParentSchema Fix ModDependencies#mmoddingLibraryVersion not having enough access rights to be modified Fix InjectedInterfaces parsing as FabricMC format even in QMJ Bump Version
- Loading branch information
1 parent
72342bd
commit 2ad9971
Showing
11 changed files
with
201 additions
and
37 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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/mmodding/gradle/api/mod/json/NamespaceProvider.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,33 @@ | ||
package com.mmodding.gradle.api.mod.json; | ||
|
||
import org.quiltmc.parsers.json.JsonWriter; | ||
|
||
import java.io.IOException; | ||
import java.io.Serializable; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class NamespaceProvider implements Serializable { | ||
|
||
private final Set<String> namespaces = new HashSet<>(); | ||
|
||
public boolean isEmpty() { | ||
return this.namespaces.isEmpty(); | ||
} | ||
|
||
public void provide(String namespace) { | ||
this.namespaces.add(namespace); | ||
} | ||
|
||
public void provide(Set<String> namespaces) { | ||
this.namespaces.addAll(namespaces); | ||
} | ||
|
||
public void writeJson(JsonWriter writer) throws IOException { | ||
writer.beginArray(); | ||
for (String namespace : this.namespaces) { | ||
writer.value(namespace); | ||
} | ||
writer.endArray(); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/main/java/com/mmodding/gradle/api/mod/json/ParentSchema.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,90 @@ | ||
package com.mmodding.gradle.api.mod.json; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class ParentSchema implements Serializable { | ||
|
||
private final String namespace; | ||
private final Set<String> badges = new HashSet<>(); | ||
|
||
private String name = null; | ||
private String description = null; | ||
private String icon = null; | ||
|
||
public ParentSchema(String namespace) { | ||
this.namespace = namespace; | ||
} | ||
|
||
public boolean isEmpty() { | ||
return this.namespace == null; | ||
} | ||
|
||
public String getNamespace() { | ||
return this.namespace; | ||
} | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getIcon() { | ||
return this.icon; | ||
} | ||
|
||
public void setIcon(String icon) { | ||
this.icon = icon; | ||
} | ||
|
||
public Set<String> getBadges() { | ||
return this.badges; | ||
} | ||
|
||
public void addBadge(String badge) { | ||
this.badges.add(badge); | ||
} | ||
|
||
public void addBadges(Set<String> badges) { | ||
this.badges.addAll(badges); | ||
} | ||
|
||
public void fill(CustomElement.CustomBlock custom) { | ||
if (this.name != null || this.description != null || this.icon != null || !this.badges.isEmpty()) { | ||
custom.putBlock("modmenu", modmenu -> | ||
modmenu.putBlock("parent", parent -> { | ||
parent.put("id", this.namespace); | ||
if (this.name != null) { | ||
parent.put("name", this.name); | ||
} | ||
if (this.description != null) { | ||
parent.put("description", this.description); | ||
} | ||
if (this.icon != null) { | ||
parent.put("icon", this.icon); | ||
} | ||
if (!this.badges.isEmpty()) { | ||
parent.putArray("badges", array -> this.badges.forEach(array::addUnique)); | ||
} | ||
}) | ||
); | ||
} | ||
else { | ||
custom.putBlock("modmenu", modmenu -> | ||
modmenu.put("parent", this.namespace) | ||
); | ||
} | ||
} | ||
} |
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