TroZ / s2cb

Schematic To Command Block - A utility for Minecraft that will convert .schematic or .nbt structure files into commands that can be run in command blocks that will create the structure in game
Apache License 2.0
18 stars 7 forks source link

No text output. #1

Closed slinkouswasalreadytaken closed 4 years ago

slinkouswasalreadytaken commented 4 years ago

Everything about this works fine, except it literally does nothing. All of the options, and checkboxes are there, but there is no text output.

TroZ commented 4 years ago

What version of Java are you using? I mainly tested with Java 1.8. Are there any error messages in the Java Console / terminal / command line? You may need to enable the Java Console to see the error messages. What steps are you taking that is causing this issue? Are you using a .schematic file or an .nbt file? What version of Minecraft (or other utility) was used to create the file you are attempting to convert? What options have you chosen? Try following the steps I show in this video: https://www.youtube.com/watch?v=336StADsKO0

slinkouswasalreadytaken commented 4 years ago

Quite a few errors actually... I have JRE 8 and IDK what version of the JDK. I downloaded it when it was then the latest version late last year, but I'm not sure what version it was exactly. (when I click about JarRsrcLoader it says v1.0...) MacOS Catalina 10.15.4...

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap$Builder
    at com.evilco.mc.nbt.tag.TagType.<clinit>(TagType.java:30)
    at com.evilco.mc.nbt.stream.NbtInputStream.readTag(NbtInputStream.java:35)
    at s2cb.S2CB.chooseFile(S2CB.java:1721)
    at s2cb.S2CB.access$5(S2CB.java:1701)
    at s2cb.S2CB$5.actionPerformed(S2CB.java:1576)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6636)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
    at java.desktop/java.awt.Component.processEvent(Component.java:6401)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap$Builder
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 40 more
slinkous@MacBook-Air S2CBv1 % 
TroZ commented 4 years ago

I'm on Windows and don't have much experience on Mac. The library I use for reading NBT files (which both .nbt and .schematic files are) makes use of a Google data structure library. It seems that that library is failing to load for you.
A .jar file is really a renamed .zip file. Inside the s2cb .jar file is the code for s2cb and two other .jar files that s2cb uses. They are commons-lang3-3.3.2.jar and guava-18.0.jar. The guava one is the Google library. I would suggest seeing if you can extract those two jar files, and put them in the same directory with s2cb's jar file. Then you should be able to launch s2cb with a command line like this: java -cp "s2cb-113c.jar;<path to directory with s2cb>/*" s2cb.S2CB Make sure that path to directory with s2cb is the full absolute path. Also, apparently on linux you have to use a colon instead of semicolon ( : instead of ; ) in the classpath, I'm not sure which is correct for Mac, so you may need to try both. With the jars extracted and specified on the command line, Java should be able to load them and that should fix the error when you try to open a file.

slinkouswasalreadytaken commented 4 years ago

Hmm, I see... I tried that, and didn't get any errors, but still no output... Screen Shot 2020-05-23 at 9 48 07 AM Screen Shot 2020-05-23 at 9 48 44 AM Also, it's not a glitch in dark mode, (sometimes it has white text but no dark background), tried putting it into light mode as well, without any more luck...

slinkouswasalreadytaken commented 4 years ago

Oh hang on!!! There is no output text saying what it is and all, but when I upload a command, it works fine! Thanks for the help! :) One question though: I have a massive structure, and it's giving me multiple commands to copy... I'm assuming I just change the command of the old command block and re-power it?

TroZ commented 4 years ago

Ok, I've apparently been packaging the last few releases incorrectly. There is a new build: s2cb-1.13c-2

There is supposed to be an html file (and an image) that is loaded when the application first starts, that shows some instruction on how to use the application. Apparently these files have been missing for the last few releases. I have created a new release that contains them. The code is identical to the previous release, it just contains these two missing files. They are meant (at least for now, this will change in the future) to be is the same directory as the jar file.

Potentially, if those files fail to load, and cause an exception to be thrown, the text area may not get initialized properly. This could prevent the output text from being displayed. However, this is not the case on Windows 10. While the files aren't loaded on Windows 10, no exception is thrown (at least not one that isn't handled), so the text area is initialized properly, and output text is shown when converting a schematic. This may not be the case under Mac, but I don't have one to test with. Although, I would think if an unhandled exception was being thrown, there would be some error shown in your terminal window.

This packaging issue has occurred because I would test the created jars in the same directory with the source code. The two missing files were in that directory already, and so the jar would be able to find and load them. However, moving the jar to another directory, and testing today showed that I wasn't packaging the two files, and resulted in s2cb launching but not displaying the instructions, like your screenshot. However, for me on Windows 10, converting a schematic does result in the output text being displayed.

As for you, you can either download this new release, or just download the two missing files. You would need info.html and guide.png, both from this project's /src/ directory. To use the output you have already generated, based upon the settings in your screenshot (which appear to be the default settings), you would need to place as many command blocks as commands generated. The first command block would need to be placed one block north and one block west of the north west corner of the build, at the same height as the bottom of the build. Then, from there, places more command blocks to the east, directly next to the previous command block, until there are as many command blocks as you have commands. You then put the first command in the first command block, and each addition command in the command block to the east of the previous one. Finally, power the command blocks one at a time, is the same order that you filled them in. If you do get the two missing files, and re-do the conversion, the program should output in the text area a command that will place all the command block for you as well as build a small flying machine to activate all of the command blocks. If you only have ten or so commands, it may not be worth using, but it you have 20 or more, it really helps to have the command blocks place and activated for you (You still have to fill the command block with the correct commands though). If you re-do the conversion, but change the 'New Command Offset' option to 'Same Cmd Block' then you would only need one command block, replacing the command with the next command after running/powering each command.

I believe this should resolve your issue. I'm not quite sure why you don't see output, but the missing instruction files seem like a likely cause. Please comment or reopen this issue if it doesn't.