Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ItemFrame spawnItemFrame(Location loc, BlockFace bf) {
- int side = 0;
- if(bf == BlockFace.SOUTH) {
- side = 0;
- } else if(bf == BlockFace.WEST) {
- side = 1;
- } else if(bf == BlockFace.NORTH) {
- side = 2;
- } else if(bf == BlockFace.EAST) {
- side = 3;
- }
- // GET NMS WORLD
- WorldServer w = ((CraftWorld)loc.getWorld()).getHandle();
- // CREATE A NEW ITEMFRAME
- EntityItemFrame entity = new EntityItemFrame(((CraftWorld)loc.getWorld()).getHandle(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), side);
- // ADDS THE ITEMFRAME TO THE WORLD
- w.addEntity(entity);
- // FINALLY, RETURNS THE BUKKIT ITEMFRAME
- return (ItemFrame)entity.getBukkitEntity();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement