Solved Issues with spawning a painting

Discussion in 'Plugin Development' started by LucasEmanuel, Jun 29, 2013.

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


    I'm having some trouble with spawning a painting.

    Im using, world.spawn(location, Painting.class) but it's not working as it should or have I got it wrong? When I check the sourcecode it should work just fine but it throws an exception.

    2013-06-29 17:32:28 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'sgreset' in plugin SurvivalGamesMultiverse v1.4
        at org.bukkit.command.PluginCommand.execute(
        at org.bukkit.command.SimpleCommandMap.dispatch(
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(
        at net.minecraft.server.v1_5_R3.PlayerConnection.handleCommand(
        at net.minecraft.server.v1_5_R3.PlayerConnection.a(
        at net.minecraft.server.v1_5_R3.Packet3Chat.handle(
        at net.minecraft.server.v1_5_R3.NetworkManager.b(
        at net.minecraft.server.v1_5_R3.PlayerConnection.d(
        at net.minecraft.server.v1_5_R3.ServerConnection.b(SourceFile:35)
        at net.minecraft.server.v1_5_R3.DedicatedServerConnection.b(SourceFile:30)
        at net.minecraft.server.v1_5_R3.MinecraftServer.r(
        at net.minecraft.server.v1_5_R3.DedicatedServer.r(
        at net.minecraft.server.v1_5_R3.MinecraftServer.q(
    Caused by: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Painting
        at org.bukkit.craftbukkit.v1_5_R3.CraftWorld.spawn(
        at org.bukkit.craftbukkit.v1_5_R3.CraftWorld.spawn(
        at me.lucasemanuel.survivalgamesmultiverse.utils.LoggedEntity.reset(
        at me.lucasemanuel.survivalgamesmultiverse.managers.GameWorld.resetWorld(
        at me.lucasemanuel.survivalgamesmultiverse.managers.WorldManager.resetWorld(
        at me.lucasemanuel.survivalgamesmultiverse.Main.resetWorld(
        at me.lucasemanuel.survivalgamesmultiverse.Commands.sgreset(
        at me.lucasemanuel.survivalgamesmultiverse.Commands.onCommand(
        at org.bukkit.command.PluginCommand.execute(
        ... 15 more
    My code:
    case PAINTING:
        Painting p = l.getWorld().spawn(l, Painting.class);
        p.setFacingDirection((BlockFace) data.get("FacingDirection"));
        p.setArt((Art) data.get("Art"));
    Full code here
  2. Offline


    Paintings are TileEntities, not actual entities. I believe you can just place a painting block at the proper location, but of course, I could be mistaken.
  3. Offline


    Hmm, but then it just seems weird that they added those lines to the world.spawn() method I linked to above.

    Well I got it semi-working now, the problem was that my locations where the problem. I have to calculate their old location based on what I have logged and what they are facing :)
  4. Offline


    I'm slowly going insane now... I have been at it for a couple of days now and as soon as I get it to work somewhat it stops working again. Any painting that isn't 1x1 blocks just get misplaced.

    If anyone knows how to spawn a painting at an exact location no matter the size I'd be glad if you could share that with me. This is how far I have gotten right now, I have had to change it over and over:
  5. Offline


    NathanWolf likes this.
  6. Offline


    NathanWolf likes this.
  7. Offline


    Thanks! I actually found it.... I've been trying to incorporate it into my own code, but honestly having trouble. Double-high paintings still spawn 1-2 block above where they're supposed to. I've been trying to figure it out.. :\

    EDIT: Well, the one I found was this:

    But.. they look the same. Still not working for me, though I could be doing something different/wrong.

    DOUBLE-EDIT: I got it working, but I had to double-apply the painting offset. Can't really tell why, but it seemed to work for me.
Thread Status:
Not open for further replies.

Share This Page