Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-4674

Upwards/downwards facing item frames require a block adjecent in order to be spawned.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Spigot-e6eb36f-d3ed151 (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
    • Yes

      My goal has been to summon an item frame facing upwards, but it seems that you need a block to spawn the item frame, even if it wouldn't be needed to spawn it normally. See my shitty MsPaint diagram to see what I mean:

       

      Here is the code I've been using to summon the item frame:

       

      location.getBlock().setType(Material.IRON_BLOCK);
      		
      ItemFrame frame = (ItemFrame) gameBoard.getWorld()
          .spawn(gameBoard.getBlock().getLocation().clone().add(0, 1, 0),
              ItemFrame.class, 
              entity -> {
                  ItemFrame itemFrame = (ItemFrame) entity;
                  itemFrame.setFacingDirection(BlockFace.UP, true);
              });
      

      When run, it produces the following stacktrace:

      Caused by: java.lang.IllegalArgumentException: Cannot spawn hanging entity for org.bukkit.entity.ItemFrame at Location{world=CraftWorld{name=world},x=-111.0,y=116.0,z=-150.0,pitch=0.0,yaw=0.0} (no free face)
              at com.google.common.base.Preconditions.checkArgument(Preconditions.java:383) ~[spigot-1.13.2.jar:git-Spigot-e6eb36f-d3ed151]
              at org.bukkit.craftbukkit.v1_13_R2.CraftWorld.createEntity(CraftWorld.java:1316) ~[spigot-1.13.2.jar:git-Spigot-e6eb36f-d3ed151]
              at org.bukkit.craftbukkit.v1_13_R2.CraftWorld.spawn(CraftWorld.java:1382) ~[spigot-1.13.2.jar:git-Spigot-e6eb36f-d3ed151]
              at org.bukkit.craftbukkit.v1_13_R2.CraftWorld.spawn(CraftWorld.java:997) ~[spigot-1.13.2.jar:git-Spigot-e6eb36f-d3ed151]
              at reesercollins.CasinoPlus.game.blackjack.BlackjackGame.createBoard(BlackjackGame.java:50) ~[?:?]
              at reesercollins.CasinoPlus.commands.BlackjackCommand.createGame(BlackjackCommand.java:59) ~[?:?]
              at reesercollins.CasinoPlus.commands.BlackjackCommand.onCommand(BlackjackCommand.java:38) ~[?:?]
              at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.13.2.jar:git-Spigot-e6eb36f-d3ed151]
              ... 15 more
      

      This doesn't seem like logical behavior, leading me to believe this is not intentional.

      Attached is a reproduction plugin. Simply run /blackjack create to cause the behavior described.

       

            Unassigned Unassigned
            MyNameIsSlick Reese
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: