11package net .easecation .bridge .core ;
22
3+ import com .fasterxml .jackson .annotation .JsonIgnore ;
34import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
45import com .fasterxml .jackson .annotation .JsonInclude ;
56import com .fasterxml .jackson .annotation .JsonProperty ;
1213 * Contains metadata, modules, dependencies and capabilities.
1314 */
1415@ JsonIgnoreProperties (ignoreUnknown = true )
16+ @ JsonInclude (JsonInclude .Include .NON_NULL )
1517public record Manifest (
1618 @ JsonProperty ("format_version" ) int formatVersion ,
1719 @ JsonProperty ("header" ) Header header ,
@@ -33,7 +35,6 @@ public Manifest(String uuid, String name, String version) {
3335 }
3436
3537 @ JsonIgnoreProperties (ignoreUnknown = true )
36- @ JsonInclude (JsonInclude .Include .ALWAYS )
3738 public record Header (
3839 @ JsonProperty ("uuid" ) String uuid ,
3940 @ JsonProperty ("name" ) String name ,
@@ -69,14 +70,17 @@ public record Metadata(
6970 ) {}
7071
7172 // Helper methods
73+ @ JsonIgnore
7274 public String getUuid () {
7375 return header .uuid ();
7476 }
7577
78+ @ JsonIgnore
7679 public String getName () {
7780 return header .name ();
7881 }
7982
83+ @ JsonIgnore
8084 public String getVersion () {
8185 List <Integer > ver = header .version ();
8286 if (ver == null || ver .isEmpty ()) return "0.0.0" ;
@@ -86,6 +90,7 @@ public String getVersion() {
8690 return major + "." + minor + "." + patch ;
8791 }
8892
93+ @ JsonIgnore
8994 public boolean isBehaviorPack () {
9095 if (modules == null || modules .isEmpty ()) {
9196 return false ;
@@ -96,6 +101,7 @@ public boolean isBehaviorPack() {
96101 "javascript" .equalsIgnoreCase (m .type ()));
97102 }
98103
104+ @ JsonIgnore
99105 public boolean isResourcePack () {
100106 return modules != null && modules .stream ()
101107 .anyMatch (m -> "resources" .equals (m .type ()));
@@ -108,6 +114,7 @@ public boolean isResourcePack() {
108114 *
109115 * @return PackType.RESOURCE if the pack contains resources, PackType.BEHAVIOR otherwise
110116 */
117+ @ JsonIgnore
111118 public PackType getPackType () {
112119 return isResourcePack () ? PackType .RESOURCE : PackType .BEHAVIOR ;
113120 }
0 commit comments