1.16.5 Placing ItemFrames on blocks/saving in schematics

Discussion in 'Spigot Plugin Development' started by 7bip, Jul 1, 2021.

  1. Problem #1

    I need to load a map containing ItemFrame's from a schematic but for some reason they do not load.

    I do //copy -e and it will display "X entities affected" as expected
    After saving and loading, it says 0 entities and none are loaded.

    If there's a way to fix this ^ that would make problem #2 redundant

    Problem #2

    As a hacky work around I placed a sign instead of an ItemFrame and attempted to spawn an itemframe there. But no matter what I do I get
    Code (Text):
    Caused by: java.lang.IllegalArgumentException: Cannot spawn hanging entity for org.bukkit.entity.ItemFrame at Location{world=CraftWorld{name=world},x=143.0,y=52.0,z=-5.0,pitch=0.0,yaw=0.0
    I use this to get the block that the sign is on
    Code (Text):

    private Location getSignBlock(Sign sign) {

        final Block signBlock = sign.getBlock();
        final WallSign signData = (WallSign) signBlock.getState().getBlockData();

        return signBlock.getRelative(signData.getFacing().getOppositeFace()).getLocation();

    Which prints out the correct location, I then remove the sign and attempt to spawn the ItemFrame but it always gives that error. Can not get it to spawn.

    Any help would be appreciated