UI is not displayed

Issue #86 resolved
mezzodrinker created an issue

Under certain circumstances (still needs to be reproduced, but seems to be reliably reproducible for users who have this issue) the UI of MobTalker is reduced to a box in the top left of the screen containing multiple layers of text (see attached screenshots), rendering it unreadable.

The error appears to be occurring when MobTalkerInteractionGui tries to read the GUI config and runs into a NullPointerException in configureDialogTextArea (see logs in attachments).

Issue was originally reported on the forums: "Invisible buttons and sprites", "Cannot use mobtalker in game!"

Comments (8)

  1. mezzodrinker reporter

    Apparently, for some reason, the DialogTextSettings parameter passed to configureDialogTextArea is null.

  2. mezzodrinker reporter

    For some unknown reason, the Persister class which is responsible for turning the XML configuration into useable Java objects doesn't read out the <DialogText>, <CharacterName> or <ChoiceFrame> elements.

    Requires further investigation.

  3. mezzodrinker reporter

    Added hardcoded fallback to ClientUiSettings.getDefault and checked for null values in MobTalkerInteractionGui.init to see if the fallback needs to be loaded. Definitely more of a workaround than a fix, though.

    Still confused as to why Simple XML is working all right in the dev environment but acts like a jerk after building. Error messages don't make much sense and are hard to debug.

    So tired.

  4. mezzodrinker reporter

    Running out of ideas here. Going to consult StackOverflow tomorrow with the following information:

    Input XML:

    <UI xmlns="http://www.mobtalker.net/mt2/ui">
      <DialogText parent="UI" width="300">
        <Anchors>
          <Anchor from="BOTTOM" relative="UI" to="BOTTOM" x="0" y="-5"/>
        </Anchors>
        <Text align="TOPLEFT" color="#FFFFFFFF" dropShadow="false" maxLines="3" spacing="2"/>
        <Background color="#E65B9346" insets="0,0,0,0" padding="8,6,8,6" texture=""/>
        <Border size="3" texture="ui/dialog_border.png"/>
      </DialogText>
      <CharacterName parent="DialogText" width="300">
        <Anchors>
          <Anchor from="BOTTOMLEFT" relative="DialogText" to="TOPLEFT" x="0" y="-10"/>
          <Anchor from="BOTTOMRIGHT" relative="DialogText" to="TOPRIGHT" x="0" y="-10"/>
        </Anchors>
        <Text align="TOPLEFT" color="#FFFFFFFF" dropShadow="true"/>
      </CharacterName>
      <ChoiceFrame parent="UI">
        <Anchors>
          <Anchor from="BOTTOM" relative="DialogText" to="TOP" x="0" y="-50"/>
        </Anchors>
        <Choices minWidth="80" perPage="4"/>
        <Background color="#E65B9346" insets="5,5,5,5" texture=""/>
        <Border size="8" texture="ui/dialog_border.png"/>
      </ChoiceFrame>
    </UI>
    

    Exception message: net.mobtalker.repack.simpleframework.xml.core.ElementException: Element 'DialogText' does not have a match in class net.mobtalker.mobtalker2.client.gui.settings.ClientUiSettings at line 2

    Relevant code:

    /* Copyright (C) 2013-2015 Chimaine, MobTalker2
     *
     * All Rights Reserved */
    package net.mobtalker.mobtalker2.client.gui.settings;
    
    import org.simpleframework.xml.Element;
    import org.simpleframework.xml.Namespace;
    import org.simpleframework.xml.Root;
    
    @Root( name = "UI", strict = true )
    @Namespace( reference = "http://www.mobtalker.net/mt2/ui" )
    public class ClientUiSettings
    {
        @Element( name = "DialogText" )
        public DialogTextSettings DialogText;
    
        @Element( name = "CharacterName" )
        public CharacterNameSettings CharacterName;
    
        @Element( name = "ChoiceFrame" )
        public ChoiceFrameSettings ChoiceFrame;
    }
    

    Need to add that the code works absolutely great when running Minecraft from inside IntelliJ, but doesn't when building the .jar file and using it "stand-alone".

    Link to repo so that people can verify what's going on in detail if need be.

    @DarkShadow44, could you take a look, too?

  5. mezzodrinker reporter

    Actually, nevermind! I fixed it! An (almost) ancient modification to the build script from times when Chimaine was still actively working on MobTalker2 caused the resulting .jar file to cause some sort of unknown error with SimpleXML which is connected to it being repackaged.

    Fixed in 2bb8ffe.

  6. Log in to comment