类org.bukkit.Rotation源码实例Demo

下面列出了怎么用org.bukkit.Rotation的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Kettle   文件: CraftItemFrame.java
Rotation toBukkitRotation(int value) {
    // Translate NMS rotation integer to Bukkit API
    switch (value) {
        case 0:
            return Rotation.NONE;
        case 1:
            return Rotation.CLOCKWISE_45;
        case 2:
            return Rotation.CLOCKWISE;
        case 3:
            return Rotation.CLOCKWISE_135;
        case 4:
            return Rotation.FLIPPED;
        case 5:
            return Rotation.FLIPPED_45;
        case 6:
            return Rotation.COUNTER_CLOCKWISE;
        case 7:
            return Rotation.COUNTER_CLOCKWISE_45;
        default:
            throw new AssertionError("Unknown rotation " + value + " for " + getHandle());
    }
}
 
源代码2 项目: Kettle   文件: CraftItemFrame.java
static int toInteger(Rotation rotation) {
    // Translate Bukkit API rotation to NMS integer
    switch (rotation) {
        case NONE:
            return 0;
        case CLOCKWISE_45:
            return 1;
        case CLOCKWISE:
            return 2;
        case CLOCKWISE_135:
            return 3;
        case FLIPPED:
            return 4;
        case FLIPPED_45:
            return 5;
        case COUNTER_CLOCKWISE:
            return 6;
        case COUNTER_CLOCKWISE_45:
            return 7;
        default:
            throw new IllegalArgumentException(rotation + " is not applicable to an ItemFrame");
    }
}
 
源代码3 项目: Thermos   文件: CraftItemFrame.java
Rotation toBukkitRotation(int value) {
    // Translate NMS rotation integer to Bukkit API
    switch (value) {
    case 0:
        return Rotation.NONE;
    case 1:
        return Rotation.CLOCKWISE;
    case 2:
        return Rotation.FLIPPED;
    case 3:
        return Rotation.COUNTER_CLOCKWISE;
    default:
        throw new AssertionError("Unknown rotation " + value + " for " + getHandle());
    }
}
 
源代码4 项目: Thermos   文件: CraftItemFrame.java
static int toInteger(Rotation rotation) {
    // Translate Bukkit API rotation to NMS integer
    switch (rotation) {
    case NONE:
        return 0;
    case CLOCKWISE:
        return 1;
    case FLIPPED:
        return 2;
    case COUNTER_CLOCKWISE:
        return 3;
    default:
        throw new IllegalArgumentException(rotation + " is not applicable to an ItemFrame");
    }
}
 
源代码5 项目: FastAsyncWorldedit   文件: BukkitImageViewer.java
private ItemFrame[][] find(Location pos1, Location pos2, BlockFace facing) {
    try {
        Location distance = pos2.clone().subtract(pos1).add(1, 1, 1);
        int width = Math.max(distance.getBlockX(), distance.getBlockZ());
        ItemFrame[][] frames = new ItemFrame[width][distance.getBlockY()];

        World world = pos1.getWorld();

        this.reverse = (facing == BlockFace.NORTH || facing == BlockFace.EAST);
        int v = 0;
        for (double y = pos1.getY(); y <= pos2.getY(); y++, v++) {
            int h = 0;
            for (double z = pos1.getZ(); z <= pos2.getZ(); z++) {
                for (double x = pos1.getX(); x <= pos2.getX(); x++, h++) {
                    Location pos = new Location(world, x, y, z);
                    Collection<Entity> entities = world.getNearbyEntities(pos, 0.1, 0.1, 0.1);
                    boolean contains = false;
                    for (Entity ent : entities) {
                        if (ent instanceof ItemFrame && ((ItemFrame) ent).getFacing() == facing) {
                            ItemFrame itemFrame = (ItemFrame) ent;
                            itemFrame.setRotation(Rotation.NONE);
                            contains = true;
                            frames[reverse ? width - 1 - h : h][v] = (ItemFrame) ent;
                            break;
                        }
                    }
                    if (!contains) return null;
                }
            }
        }
        return frames;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    return null;
}
 
源代码6 项目: Kettle   文件: CraftItemFrame.java
public Rotation getRotation() {
    return toBukkitRotation(getHandle().getRotation());
}
 
源代码7 项目: Kettle   文件: CraftItemFrame.java
public void setRotation(Rotation rotation) {
    Validate.notNull(rotation, "Rotation cannot be null");
    getHandle().setItemRotation(toInteger(rotation));
}
 
源代码8 项目: Thermos   文件: CraftItemFrame.java
public Rotation getRotation() {
    return toBukkitRotation(getHandle().getRotation());
}
 
源代码9 项目: Thermos   文件: CraftItemFrame.java
public void setRotation(Rotation rotation) {
    Validate.notNull(rotation, "Rotation cannot be null");
    getHandle().setItemRotation(toInteger(rotation));
}
 
源代码10 项目: Kettle   文件: ItemFrame.java
/**
 * Get the rotation of the frame's item
 *
 * @return the direction
 */
public Rotation getRotation();
 
源代码11 项目: Kettle   文件: ItemFrame.java
/**
 * Set the rotation of the frame's item
 *
 * @param rotation the new rotation
 * @throws IllegalArgumentException if rotation is null
 */
public void setRotation(Rotation rotation) throws IllegalArgumentException;
 
 类所在包
 类方法
 同包方法