Spawning An Item Frame

Discussion in 'Plugin Development' started by HouseMD, Nov 5, 2012.

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


    So i have this code:

    Location l = b.getLocation();
                        if (b.getType().equals(Material.CHEST)) {
                            EntityType frame = EntityType.ITEM_FRAME;
                            p.getWorld().spawnEntity(l, frame);
    And i just get errors in the console about an illegal entity spawn exception.

    Anyone been able to manually place item frames yet?
  2. Offline

    Ewe Loon

  3. Offline


    Im aware, thats why i tried spawning it as an entity.
  4. Offline


    any stacktrace? Because the code you use should be working fine. Though it might be that you cannot spawn it because you are spawning it in a chest (as in: same location)
  5. Offline

    Ewe Loon

    the error I get is
    java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit,entity.ItemFrame
  6. Offline


    In my full code I shift the x,y,z according to the right facing direction of the chest by 1. So it's not directly over a chest.
  7. Offline


    You will get that IllegalArgumentException if the hanging is unable to be spawned at the particular location you've given. You need to make sure that whatever location you've shifted to contains a solid block on which the entity can be hung. Note: the location has to be a solid block, not just adjacent to one.
  8. Offline


    A cursory glance at the code is telling me that you are trying to replace a chest with an item frame? Show a little more code above, so we can see what action triggers this event?
Thread Status:
Not open for further replies.

Share This Page