SimCraft for Minecraft

!!

Welcome Guest

Dear visitor, welcome to MC Port Central. If this is your first visit here,  you should consider registering to show your support.   By registering you will give us an idea and clear indication of how in demand our work really are and will motivate our porting team to continue there work. We port vanilla mods to Bukkit and you will also find a lot of other related Minecraft material on our Forum.

Author Topic: [OBSOLETE] WorldEdit 5.4 schematic negative block ID fix  (Read 1632 times)

mushroomhostage

  • Sr. Member
  • ****
  • Posts: 483
    • Experimental Hardcore Post-Apocalyptic Server
[OBSOLETE] WorldEdit 5.4 schematic negative block ID fix
« on: July 08, 2012, 04:24:29 AM »
WorldEdit 5.4 has trouble with //schem load and //paste involving blocks with IDs >127, which occurs quite often with mods. The paste will fail with:

Code: [Select]
19:01:33 [SEVERE] java.lang.ArrayIndexOutOfBoundsException: -28
19:01:33 [SEVERE]   at org.bukkit.Material.getMaterial(Material.java:438)
19:01:33 [SEVERE]   at com.sk89q.worldedit.bukkit.BukkitWorld.isValidBlockType(BukkitWorld.java:844)
19:01:33 [SEVERE]   at com.sk89q.worldedit.EditSession.rawSetBlock(EditSession.java:178)
19:01:33 [SEVERE]   at com.sk89q.worldedit.EditSession.flushQueue(EditSession.java:731)
19:01:33 [SEVERE]   at com.sk89q.worldedit.WorldEdit.handleCommand(WorldEdit.java:1265)
19:01:33 [SEVERE]   at com.sk89q.worldedit.bukkit.WorldEditPlugin.onCommand(WorldEditPlugin.java:204)
19:01:33 [SEVERE]   at com.sk89q.bukkit.util.DynamicPluginCommand.execute(DynamicPluginCommand.java:44)
19:01:33 [SEVERE]   at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166)
19:01:33 [SEVERE]   at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:469)
19:01:33 [SEVERE]   at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:914)
19:01:33 [SEVERE]   at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:874)
19:01:33 [SEVERE]   at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:857)
19:01:33 [SEVERE]   at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:33)
19:01:33 [SEVERE]   at net.minecraft.server.NetworkManager.b(NetworkManager.java:234)
19:01:33 [SEVERE]   at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:118)
19:01:33 [SEVERE]   at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
19:01:33 [SEVERE]   at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:557)
19:01:33 [SEVERE]   at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455)
19:01:33 [SEVERE]   at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)

This occurs because the block ID is stored as a "byte", with range -128 to 127. It wraps around and causes the negative bounds error. For details see https://github.com/sk89q/worldedit/pull/192 .

Until this is properly fixed, I have a workaround available at: https://github.com/mushroomhostage/worldedit/downloads

Disclaimer: not necessarily a complete fix. See pull request discussion for possible caveats. Also note, this does not add compatibility with 4096 block IDs. Someone else I hear is working on another patch for that. This simple fix worked well for my purposes (copying schematics of abandoned factories and such for my server), and there was interest in this patched build from other server owners, so I figured I'd post about it here in case anyone else is looking for it as well.
« Last Edit: July 09, 2012, 12:39:43 AM by mushroomhostage »

mushroomhostage

  • Sr. Member
  • ****
  • Posts: 483
    • Experimental Hardcore Post-Apocalyptic Server
Re: [OBSOLETE] WorldEdit 5.4 schematic negative block ID fix
« Reply #1 on: July 09, 2012, 12:40:25 AM »
This should no longer be needed in the latest WorldEdit builds, which now have initial 4096 ID support:

https://github.com/sk89q/worldedit/commit/0d279e7706ff8630b82b0f4375246a236f935f60