org.bukkit.block.BlockFace#getModY ( )源码实例Demo

下面列出了org.bukkit.block.BlockFace#getModY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AACAdditionPro   文件: AnglePattern.java
@Override
protected int process(User user, BlockPlaceEvent event)
{
    final BlockFace placedFace = event.getBlock().getFace(event.getBlockAgainst());
    final Vector placedVector = new Vector(placedFace.getModX(), placedFace.getModY(), placedFace.getModZ());

    // If greater than 90
    if (user.getPlayer().getLocation().getDirection().angle(placedVector) > MAX_ANGLE) {
        if (++user.getScaffoldData().angleFails >= this.violationThreshold) {
            message = "Scaffold-Verbose | Player: " + user.getPlayer().getName() + " placed a block with a suspicious angle.";
            return 3;
        }
    }
    else if (user.getScaffoldData().angleFails > 0) {
        user.getScaffoldData().angleFails--;
    }
    return 0;
}
 
源代码2 项目: BedWars   文件: MiscUtils.java
public static Vector getDirection(BlockFace face) {
	int modX = face.getModX();
	int modY = face.getModY();
	int modZ = face.getModZ();
    Vector direction = new Vector(modX, modY, modZ);
    if (modX != 0 || modY != 0 || modZ != 0) {
        direction.normalize();
    }
    return direction;
}
 
源代码3 项目: BedWars   文件: MiscUtils.java
public static Vector getDirection(BlockFace face) {
	int modX = face.getModX();
	int modY = face.getModY();
	int modZ = face.getModZ();
    Vector direction = new Vector(modX, modY, modZ);
    if (modX != 0 || modY != 0 || modZ != 0) {
        direction.normalize();
    }
    return direction;
}
 
源代码4 项目: ClaimChunk   文件: CancellableChunkEvents.java
@EventHandler
public void onLiquidPlacePickup(PlayerBucketEmptyEvent e) {
    if (e != null) {
        BlockFace bf = e.getBlockFace();
        Vector v = new Vector(bf.getModX(), bf.getModY(), bf.getModZ());
        ChunkEventHelper.handleBlockEvent(e.getPlayer(), e.getBlockClicked().getLocation().add(v).getChunk(), e);
    }
}
 
源代码5 项目: ClaimChunk   文件: CancellableChunkEvents.java
@EventHandler
public void onLiquidPlacePickup(PlayerBucketFillEvent e) {
    if (e != null) {
        BlockFace bf = e.getBlockFace();
        Vector v = new Vector(bf.getModX(), bf.getModY(), bf.getModZ());
        ChunkEventHelper.handleBlockEvent(e.getPlayer(), e.getBlockClicked().getLocation().add(v).getChunk(), e);
    }
}
 
源代码6 项目: Thermos   文件: CraftBlock.java
public BlockFace getFace(final Block block) {
    BlockFace[] values = BlockFace.values();

    for (BlockFace face : values) {
        if ((this.getX() + face.getModX() == block.getX()) &&
            (this.getY() + face.getModY() == block.getY()) &&
            (this.getZ() + face.getModZ() == block.getZ())
        ) {
            return face;
        }
    }

    return null;
}
 
源代码7 项目: FastAsyncWorldedit   文件: AsyncBlock.java
@Override
public BlockFace getFace(Block block) {
    BlockFace[] directions = BlockFace.values();
    for(int i = 0; i < directions.length; ++i) {
        BlockFace face = directions[i];
        if(this.getX() + face.getModX() == block.getX() && this.getY() + face.getModY() == block.getY() && this.getZ() + face.getModZ() == block.getZ()) {
            return face;
        }
    }
    return null;
}
 
源代码8 项目: PGM   文件: BlockFaces.java
static BlockVector getRelative(BlockVector pos, BlockFace face) {
  return new BlockVector(
      pos.getBlockX() + face.getModX(),
      pos.getBlockY() + face.getModY(),
      pos.getBlockZ() + face.getModZ());
}
 
源代码9 项目: ProjectAres   文件: BlockFaces.java
public static BlockVector getRelative(BlockVector pos, BlockFace face) {
    return new BlockVector(pos.getBlockX() + face.getModX(),
                           pos.getBlockY() + face.getModY(),
                           pos.getBlockZ() + face.getModZ());
}
 
源代码10 项目: FastAsyncWorldedit   文件: BukkitImageViewer.java
public void selectFrame(ItemFrame start) {
    Location pos1 = start.getLocation().clone();
    Location pos2 = start.getLocation().clone();

    BlockFace facing = start.getFacing();
    int planeX = facing.getModX() == 0 ? 1 : 0;
    int planeY = facing.getModY() == 0 ? 1 : 0;
    int planeZ = facing.getModZ() == 0 ? 1 : 0;

    ItemFrame[][] res = find(pos1, pos2, facing);
    Location tmp;
    while (true) {
        if (res != null) {
            frames = res;
        }
        tmp = pos1.clone().subtract(planeX, planeY, planeZ);
        if ((res = find(tmp, pos2, facing)) != null) {
            pos1 = tmp;
            continue;
        }
        tmp = pos2.clone().add(planeX, planeY, planeZ);
        if ((res = find(pos1, tmp, facing)) != null) {
            pos2 = tmp;
            continue;
        }
        tmp = pos1.clone().subtract(planeX, 0, planeZ);
        if ((res = find(tmp, pos2, facing)) != null) {
            pos1 = tmp;
            continue;
        }
        tmp = pos2.clone().add(planeX, 0, planeZ);
        if ((res = find(pos1, tmp, facing)) != null) {
            pos2 = tmp;
            continue;
        }
        tmp = pos1.clone().subtract(0, 1, 0);
        if ((res = find(tmp, pos2, facing)) != null) {
            pos1 = tmp;
            continue;
        }
        tmp = pos2.clone().add(0, 1, 0);
        if ((res = find(pos1, tmp, facing)) != null) {
            pos2 = tmp;
            continue;
        }
        break;
    }
}