diff --git a/guicore/src/main/java/org/scaminc/minefork/guicore/NBTWriter.java b/guicore/src/main/java/org/scaminc/minefork/guicore/NBTWriter.java index 90d0d26..d7f0226 100644 --- a/guicore/src/main/java/org/scaminc/minefork/guicore/NBTWriter.java +++ b/guicore/src/main/java/org/scaminc/minefork/guicore/NBTWriter.java @@ -8,8 +8,10 @@ public class NBTWriter { { NBTOutput out = new NBTOutput(); - out.put(NBTTags.IsInGame.value(), scr.IsInGame); - out.put(NBTTags.IsPanorama.value(), scr.IsPanorama); + if (scr.IsPanorama != null) + out.put(NBTTags.IsPanorama.value(), scr.IsPanorama); + if (scr.Background != null) + out.put(NBTTags.Background.value(), scr.Background); if (!scr.Children.isEmpty()) { diff --git a/guicore/src/main/java/org/scaminc/minefork/guicore/XMLReader.java b/guicore/src/main/java/org/scaminc/minefork/guicore/XMLReader.java index 67a21f0..3e951fb 100644 --- a/guicore/src/main/java/org/scaminc/minefork/guicore/XMLReader.java +++ b/guicore/src/main/java/org/scaminc/minefork/guicore/XMLReader.java @@ -38,16 +38,18 @@ public class XMLReader { Node scrXml = nodes.item(0); - Node panorama = scrXml.getAttributes().getNamedItem("panorama"); - if (panorama == null) - return null; - Node ingame = scrXml.getAttributes().getNamedItem("ingame"); - if (ingame == null) - return null; - Screen scr = new Screen(); - scr.IsInGame = Boolean.parseBoolean(ingame.getNodeValue()); - scr.IsPanorama = Boolean.parseBoolean(panorama.getNodeValue()); + + NamedNodeMap attrs = scrXml.getAttributes(); + for (int i = 0; i < attrs.getLength(); i++) + { + Node attr = attrs.item(i); + switch (attr.getNodeName()) + { + case "panorama" -> scr.IsPanorama = Boolean.parseBoolean(attr.getNodeValue()); + case "background" -> scr.Background = Integer.parseInt(attr.getNodeValue()); + } + } NodeList children = scrXml.getChildNodes(); int childrenlen = children.getLength(); diff --git a/guicore/src/main/java/org/scaminc/minefork/guicore/entity/Screen.java b/guicore/src/main/java/org/scaminc/minefork/guicore/entity/Screen.java index 9ffb708..9473100 100644 --- a/guicore/src/main/java/org/scaminc/minefork/guicore/entity/Screen.java +++ b/guicore/src/main/java/org/scaminc/minefork/guicore/entity/Screen.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; public class Screen { - public boolean IsPanorama = false; - public boolean IsInGame = false; + public Boolean IsPanorama = null; + public Integer Background = null; public List Children = new ArrayList<>(); } diff --git a/guicore/src/main/java/org/scaminc/minefork/guicore/nbt/NBTTags.java b/guicore/src/main/java/org/scaminc/minefork/guicore/nbt/NBTTags.java index e5c4ea3..ee4849a 100644 --- a/guicore/src/main/java/org/scaminc/minefork/guicore/nbt/NBTTags.java +++ b/guicore/src/main/java/org/scaminc/minefork/guicore/nbt/NBTTags.java @@ -14,9 +14,9 @@ public enum NBTTags { AnchorX, AnchorY, // Screen tags - IsInGame, IsPanorama, Childs, + Background, // Label tags Rotation, Scale, @@ -36,6 +36,7 @@ public enum NBTTags { DrawRight, DrawTop, DrawBottom; + // end of Version 1 tags public String value() { diff --git a/guicore/src/main/xsd/GuiScreen.xsd b/guicore/src/main/xsd/GuiScreen.xsd index a09563f..2b3aa79 100644 --- a/guicore/src/main/xsd/GuiScreen.xsd +++ b/guicore/src/main/xsd/GuiScreen.xsd @@ -117,7 +117,7 @@ - + \ No newline at end of file