Java 类net.minecraft.util.org.apache.commons.lang3.tuple.ImmutablePair 实例源码

项目:CraftBukkit    文件:BlockMonsterEggs.java   
public static ImmutablePair b(int i) {
    switch (i) {
        case 1:
            return new ImmutablePair(Blocks.COBBLESTONE, Integer.valueOf(0));

        case 2:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(0));

        case 3:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(1));

        case 4:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(2));

        case 5:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(3));

        default:
            return new ImmutablePair(Blocks.STONE, Integer.valueOf(0));
    }
}
项目:Tweakkit-Server    文件:BlockMonsterEggs.java   
public static ImmutablePair b(int i) {
    switch (i) {
        case 1:
            return new ImmutablePair(Blocks.COBBLESTONE, Integer.valueOf(0));

        case 2:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(0));

        case 3:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(1));

        case 4:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(2));

        case 5:
            return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(3));

        default:
            return new ImmutablePair(Blocks.STONE, Integer.valueOf(0));
    }
}
项目:CraftBukkit    文件:EntitySilverfish.java   
protected void bq() {
    super.bq();
    if (!this.world.isStatic) {
        int i;
        int j;
        int k;
        int l;

        if (this.bp > 0) {
            --this.bp;
            if (this.bp == 0) {
                i = MathHelper.floor(this.locX);
                j = MathHelper.floor(this.locY);
                k = MathHelper.floor(this.locZ);
                boolean flag = false;

                for (int i1 = 0; !flag && i1 <= 5 && i1 >= -5; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) {
                    for (l = 0; !flag && l <= 10 && l >= -10; l = l <= 0 ? 1 - l : 0 - l) {
                        for (int j1 = 0; !flag && j1 <= 10 && j1 >= -10; j1 = j1 <= 0 ? 1 - j1 : 0 - j1) {
                            if (this.world.getType(i + l, j + i1, k + j1) == Blocks.MONSTER_EGGS) {
                                // CraftBukkit start
                                if (CraftEventFactory.callEntityChangeBlockEvent(this, i + l, j + i1, k + j1, Blocks.AIR, 0).isCancelled()) {
                                    continue;
                                }
                                // CraftBukkit end
                                if (!this.world.getGameRules().getBoolean("mobGriefing")) {
                                    int k1 = this.world.getData(i + l, j + i1, k + j1);
                                    ImmutablePair immutablepair = BlockMonsterEggs.b(k1);

                                    this.world.setTypeAndData(i + l, j + i1, k + j1, (Block) immutablepair.getLeft(), ((Integer) immutablepair.getRight()).intValue(), 3);
                                } else {
                                    this.world.setAir(i + l, j + i1, k + j1, false);
                                }

                                Blocks.MONSTER_EGGS.postBreak(this.world, i + l, j + i1, k + j1, 0);
                                if (this.random.nextBoolean()) {
                                    flag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }

        if (this.target == null && !this.bS()) {
            i = MathHelper.floor(this.locX);
            j = MathHelper.floor(this.locY + 0.5D);
            k = MathHelper.floor(this.locZ);
            int l1 = this.random.nextInt(6);
            Block block = this.world.getType(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);

            l = this.world.getData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
            if (BlockMonsterEggs.a(block)) {
                // CraftBukkit start
                if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, Block.getId(BlockMonsterEggs.getById(l))).isCancelled()) {
                    return;
                }
                // CraftBukkit end

                this.world.setTypeAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, BlockMonsterEggs.a(block, l), 3);
                this.s();
                this.die();
            } else {
                this.bQ();
            }
        } else if (this.target != null && !this.bS()) {
            this.target = null;
        }
    }
}
项目:Tweakkit-Server    文件:EntitySilverfish.java   
protected void bq() {
    super.bq();
    if (!this.world.isStatic) {
        int i;
        int j;
        int k;
        int l;

        if (this.bp > 0) {
            --this.bp;
            if (this.bp == 0) {
                i = MathHelper.floor(this.locX);
                j = MathHelper.floor(this.locY);
                k = MathHelper.floor(this.locZ);
                boolean flag = false;

                for (int i1 = 0; !flag && i1 <= 5 && i1 >= -5; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) {
                    for (l = 0; !flag && l <= 10 && l >= -10; l = l <= 0 ? 1 - l : 0 - l) {
                        for (int j1 = 0; !flag && j1 <= 10 && j1 >= -10; j1 = j1 <= 0 ? 1 - j1 : 0 - j1) {
                            if (this.world.getType(i + l, j + i1, k + j1) == Blocks.MONSTER_EGGS) {
                                // CraftBukkit start
                                if (CraftEventFactory.callEntityChangeBlockEvent(this, i + l, j + i1, k + j1, Blocks.AIR, 0).isCancelled()) {
                                    continue;
                                }
                                // CraftBukkit end
                                if (!this.world.getGameRules().getBoolean("mobGriefing")) {
                                    int k1 = this.world.getData(i + l, j + i1, k + j1);
                                    ImmutablePair immutablepair = BlockMonsterEggs.b(k1);

                                    this.world.setTypeAndData(i + l, j + i1, k + j1, (Block) immutablepair.getLeft(), ((Integer) immutablepair.getRight()).intValue(), 3);
                                } else {
                                    this.world.setAir(i + l, j + i1, k + j1, false);
                                }

                                Blocks.MONSTER_EGGS.postBreak(this.world, i + l, j + i1, k + j1, 0);
                                if (this.random.nextBoolean()) {
                                    flag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }

        if (this.target == null && !this.bS()) {
            i = MathHelper.floor(this.locX);
            j = MathHelper.floor(this.locY + 0.5D);
            k = MathHelper.floor(this.locZ);
            int l1 = this.random.nextInt(6);
            Block block = this.world.getType(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);

            l = this.world.getData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
            if (BlockMonsterEggs.a(block)) {
                // CraftBukkit start
                if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, Block.getId(BlockMonsterEggs.getById(l))).isCancelled()) {
                    return;
                }
                // CraftBukkit end

                this.world.setTypeAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, BlockMonsterEggs.a(block, l), 3);
                this.s();
                this.die();
            } else {
                this.bQ();
            }
        } else if (this.target != null && !this.bS()) {
            this.target = null;
        }
    }
}