Solved Loading Schematics bug

Discussion in 'Plugin Development' started by MCCoding, Jul 17, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    MCCoding

    I'm using chasechocolate schematic method but it's throwing errors when i try and load a schematic. Here is the method i'm using and the stacktrace, hopefully chase will be able to give me hand i have screwed around with it all for a while but it seems everything i try it doesn't work.

    Code:java
    1. public static Schematic loadScheamtic(File file) {
    2. try {
    3. if (file.exists()) {
    4. NBTInputStream nbtStream = new NBTInputStream(new FileInputStream(file));
    5. CompoundTag compound = (CompoundTag) nbtStream.readTag();
    6. Map<String, Tag> tags = compound.getValue();
    7. Short width = ((ShortTag) tags.get("Width")).getValue();
    8. Short height = ((ShortTag) tags.get("Height")).getValue();
    9. Short length = ((ShortTag) tags.get("Length")).getValue();
    10.  
    11. String materials = ((StringTag) tags.get("Materials")).getValue();
    12.  
    13. byte[] blocks = ((ByteArrayTag) tags.get("Blocks")).getValue();
    14. byte[] data = ((ByteArrayTag) tags.get("Data")).getValue();
    15.  
    16. nbtStream.close();
    17. Schematic schematic = new Schematic(file.getName().replace("schematic", ""), width, height, length, materials, blocks, data);
    18. return schematic;
    19. }
    20. } catch (IOException e) {
    21. System.out.println("Failed to load the schematic: " + file.getAbsolutePath());
    22. e.printStackTrace();
    23. }
    24. return null;
    25. }


    Code:
    [17:00:18 INFO]: Failed to load the schematic: \schematics\schematic.schematic
    [17:00:18 WARN]: java.io.EOFException
    [17:00:18 WARN]:        at java.io.DataInputStream.readFully(Unknown Source)
    [17:00:18 WARN]:        at java.io.DataInputStream.readFully(Unknown Source)
    [17:00:18 WARN]:        at com.sk89q.jnbt.NBTInputStream.readTag(NBTInputStream.
    java:122)
    [17:00:18 WARN]:        at com.sk89q.jnbt.NBTInputStream.readTag(NBTInputStream.
    java:103)
    [17:00:18 WARN]:        at com.schematics.filler.Schematics.Schematic.l
    oadScheamtic(Schematic.java:122)
    [17:00:18 WARN]:        at com.schematics.filler.Schematics.Schematic.i
    nitSchematics(Schematic.java:105)
    [17:00:18 WARN]:        at com.schematics.filler.Enable.Core.onEnable(C
    ore.java:165)
    [17:00:18 WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlug
    in.java:316)
    [17:00:18 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(
    JavaPluginLoader.java:324)
    [17:00:18 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(Si
    mplePluginManager.java:404)
    [17:00:18 WARN]:        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugin
    (CraftServer.java:446)
    [17:00:18 WARN]:        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.enablePlug
    ins(CraftServer.java:380)
    [17:00:18 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.n(Minecr
    aftServer.java:352)
    [17:00:18 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.g(Minecr
    aftServer.java:326)
    [17:00:18 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.a(Minecr
    aftServer.java:282)
    [17:00:18 WARN]:        at net.minecraft.server.v1_7_R3.DedicatedServer.init(Ded
    icatedServer.java:182)
    [17:00:18 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.run(Mine
    craftServer.java:436)
    [17:00:18 WARN]:        at net.minecraft.server.v1_7_R3.ThreadServerApplication.
    run(SourceFile:628)
    [17:00:18 INFO]: Loaded 0 schematic(s)!
     
  2. Offline

    _LB

    Do other programs load the schematic without error?
     
  3. Offline

    MCCoding

    _LB
    The method was out dated i fixed it *Solved*
     
    _LB likes this.
Thread Status:
Not open for further replies.

Share This Page