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

    LucasEmanuel

    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.

    Exception:
    Code:
    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(PluginCommand.java:46)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:523)
        at net.minecraft.server.v1_5_R3.PlayerConnection.handleCommand(PlayerConnection.java:971)
        at net.minecraft.server.v1_5_R3.PlayerConnection.chat(PlayerConnection.java:889)
        at net.minecraft.server.v1_5_R3.PlayerConnection.a(PlayerConnection.java:846)
        at net.minecraft.server.v1_5_R3.Packet3Chat.handle(Packet3Chat.java:44)
        at net.minecraft.server.v1_5_R3.NetworkManager.b(NetworkManager.java:292)
        at net.minecraft.server.v1_5_R3.PlayerConnection.d(PlayerConnection.java:115)
        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(MinecraftServer.java:581)
        at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:226)
        at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:477)
        at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:410)
        at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
    Caused by: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Painting
        at org.bukkit.craftbukkit.v1_5_R3.CraftWorld.spawn(CraftWorld.java:1022)
        at org.bukkit.craftbukkit.v1_5_R3.CraftWorld.spawn(CraftWorld.java:792)
        at me.lucasemanuel.survivalgamesmultiverse.utils.LoggedEntity.reset(LoggedEntity.java:81)
        at me.lucasemanuel.survivalgamesmultiverse.managers.GameWorld.resetWorld(WorldManager.java:227)
        at me.lucasemanuel.survivalgamesmultiverse.managers.WorldManager.resetWorld(WorldManager.java:118)
        at me.lucasemanuel.survivalgamesmultiverse.Main.resetWorld(Main.java:240)
        at me.lucasemanuel.survivalgamesmultiverse.Commands.sgreset(Commands.java:264)
        at me.lucasemanuel.survivalgamesmultiverse.Commands.onCommand(Commands.java:77)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
        ... 15 more
    My code:
    Code:
    case PAINTING:
        Painting p = l.getWorld().spawn(l, Painting.class);
        p.setFacingDirection((BlockFace) data.get("FacingDirection"));
        p.setArt((Art) data.get("Art"));
        break;
    Full code here
     
  2. Offline

    caseif

    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

    LucasEmanuel

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


    EDIT:
    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

    LucasEmanuel

    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:
    https://github.com/Chilinot/Surviva...algamesmultiverse/utils/LoggedEntity.java#L99
     
  5. Offline

    LucasEmanuel

    NathanWolf likes this.
  6. Offline

    LucasEmanuel

    NathanWolf likes this.
  7. Offline

    NathanWolf

    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:

    https://github.com/Chilinot/Surviva...urvivalgamesmultiverse/misc/LoggedEntity.java

    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