Spawning An Item Frame

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

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

    HouseMD

    So i have this code:

    Code:
    Location l = b.getLocation();
                        if (b.getType().equals(Material.CHEST)) {
                            p.sendMessage("Execute");
                            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

    HouseMD

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

    fireblast709

    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

    HouseMD

    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

    desht

    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

    Tehmaker

    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