org.bukkit.Material#STATIONARY_WATER源码实例Demo

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

源代码1 项目: Hawk   文件: BlockBreakSpeedSurvival.java
private boolean a(HawkPlayer pp) {
    Vector position = pp.getPosition();
    double d0 = position.getY() + 1.62;
    int i = floor(position.getX());
    int j = (int)d((float)floor(d0));
    int k = floor(position.getZ());
    Block block = ServerUtils.getBlockAsync(new Location(pp.getWorld(), i, j, k));
    if(block == null)
        return false;
    if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) {
        float f = b(block.getData()) - 0.11111111F;
        float f1 = (float)(j + 1) - f;
        return d0 < (double)f1;
    } else {
        return false;
    }
}
 
源代码2 项目: Hawk   文件: Strafe.java
private boolean testLiquid(Set<Material> mats) {
    for(Material mat : mats) {
        if(mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA)
            return true;
    }
    return false;
}
 
源代码3 项目: Hawk   文件: MoveEvent.java
private Vector computeWaterFlowForce() {
    Vector finalForce = new Vector();
    for(Pair<Block, Vector> liquid : liquidsAndDirections) {
        Material mat = liquid.getKey().getType();
        if(mat == Material.STATIONARY_WATER || mat == Material.WATER) {
            finalForce.add(liquid.getValue());
        }
    }
    if(finalForce.lengthSquared() > 0 && !pp.isFlying()) {
        finalForce.normalize();
        finalForce.multiply(Physics.WATER_FLOW_FORCE_MULTIPLIER);
        return finalForce;
    }
    return finalForce;
}
 
源代码4 项目: ProjectAres   文件: DefuseListener.java
private void participantDefuse(Player player, Entity entity) {
    if(!AntiGrief.Defuse.enabled()) return;

    // check tnt
    if(!(entity instanceof TNTPrimed)) return;

    TNTMatchModule tntmm = mm.getMatch(player.getWorld()).getMatchModule(TNTMatchModule.class);
    if(tntmm != null && !tntmm.getProperties().friendlyDefuse) return;

    MatchPlayer clicker = this.mm.getPlayer(player);
    if(clicker == null || !clicker.canInteract()) return;

    // check water
    Block block = entity.getLocation().getBlock();
    if(block != null && (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)) {
        clicker.sendMessage(ChatColor.RED + PGMTranslations.t("defuse.water", clicker));
        return;
    }

    // check owner
    MatchPlayer owner = this.mm.getPlayer(entityResolver.getOwner(entity));
    if(owner == null || (owner != clicker && owner.getParty() == clicker.getParty())) { // cannot defuse own TNT
        // defuse TNT
        entity.remove();
        if(owner != null) {
            this.notifyDefuse(clicker, entity, ChatColor.RED + PGMTranslations.t("defuse.player", clicker, owner.getDisplayName(clicker) + ChatColor.RED));
            adminChannel.broadcast(clicker.getDisplayName() +
                                   ChatColor.WHITE + " defused " +
                                   owner.getDisplayName()
                                   + ChatColor.WHITE + "'s " +
                                   ChatColor.DARK_RED + "TNT");
        } else {
            this.notifyDefuse(clicker, entity, ChatColor.RED + PGMTranslations.t("defuse.world", clicker));
        }
    }
}
 
源代码5 项目: askyblock   文件: LavaCheck.java
public boolean generatesCobble(Block block, Block toBlock){
    Material mirrorID1 = (block.getType().equals(Material.WATER)) || (block.getType().equals(Material.STATIONARY_WATER)) ? Material.LAVA : Material.WATER;
    Material mirrorID2 = (block.getType().equals(Material.WATER)) || (block.getType().equals(Material.STATIONARY_WATER)) ? Material.STATIONARY_LAVA : Material.STATIONARY_WATER;
    for (BlockFace face: FACES) {
        Block r = toBlock.getRelative(face);
        if ((r.getType().equals(mirrorID1)) || (r.getType().equals(mirrorID2))) {
            return true;
        }
    }
    return false;
}
 
源代码6 项目: PGM   文件: Materials.java
static boolean isWater(Material material) {
  return material == Material.WATER || material == Material.STATIONARY_WATER;
}
 
源代码7 项目: Kettle   文件: CraftBlock.java
public boolean isLiquid() {
    return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
}
 
源代码8 项目: ProjectAres   文件: Materials.java
public static boolean isWater(Material material) {
    return material == Material.WATER || material == Material.STATIONARY_WATER;
}
 
源代码9 项目: Thermos   文件: CraftBlock.java
public boolean isLiquid() {
    return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
}
 
源代码10 项目: UHC   文件: LocationUtil.java
/**
 * Checks for the highest safe to stand on block with 2 un-solid blocks above it (excluding above world height).
 *
 * <p>Does not teleport on to non-solid blocks or blocks that can damage the player.</p>
 * <p>Only teleports into water if it is not at head height (feet only)</p>
 * <p>
 *     If the world type is NETHER then searching will start at 128 instead of the world max height to avoid the
 *     bedrock roof.
 * </p>
 *
 * @param world world to check within
 * @param xcoord the x coord to check at
 * @param zcoord the z coord to check at
 * @return -1 if no valid location found, otherwise coordinate with non-air Y coord with 2 air blocks above it
 */
public static int findHighestTeleportableY(World world, int xcoord, int zcoord) {
    final Location startingLocation = new Location(
            world,
            xcoord,
            world.getEnvironment() == World.Environment.NETHER ? NETHER_MAX_HEIGHT : world.getMaxHeight(),
            zcoord
    );

    boolean above2WasSafe = false;
    boolean aboveWasSafe = false;
    boolean above2WasWater = false;
    boolean aboveWasWater = false;

    Block currentBlock = startingLocation.getBlock();

    Material type;
    boolean damagesPlayer;
    boolean canStandOn;
    boolean aboveAreSafe;
    while (currentBlock.getY() >= 0) {
        type = currentBlock.getType();

        // get info about the current block
        damagesPlayer = damagesPlayer(type);
        canStandOn = canStandOn(type);

        aboveAreSafe = aboveWasSafe && above2WasSafe && !above2WasWater;

        // valid block if it has 2 safe blocks above it, it doesn't damage the player,
        // is safe to stand on and there isn't any water in the head space
        if (aboveAreSafe && !damagesPlayer && canStandOn) {
            return currentBlock.getY();
        }

        // move safe blocks
        above2WasSafe = aboveWasSafe;
        aboveWasSafe = !canStandOn && !damagesPlayer;

        // move water blocks
        above2WasWater = aboveWasWater;
        aboveWasWater = type == Material.WATER || type == Material.STATIONARY_WATER;

        // move down a block and run again
        currentBlock = currentBlock.getRelative(BlockFace.DOWN);
    }

    return -1;
}
 
 方法所在类
 同类方法