cn.nukkit.block.BlockWater Java Examples
The following examples show how to use
cn.nukkit.block.BlockWater.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 5 votes |
public boolean isInsideOfWater() { double y = this.y + this.getEyeHeight(); Block block = this.level.getBlock(this.temporalVector.setComponents(NukkitMath.floorDouble(this.x), NukkitMath.floorDouble(y), NukkitMath.floorDouble(this.z))); if (block instanceof BlockWater) { double f = (block.y + 1) - (((BlockWater) block).getFluidHeightPercent() - 0.1111111); return y < f; } return false; }
Example #2
Source File: ItemBoat.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) { if (face != BlockFace.UP) return false; EntityBoat boat = (EntityBoat) Entity.createEntity("Boat", level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("") .putList(new ListTag<DoubleTag>("Pos") .add(new DoubleTag("", block.getX() + 0.5)) .add(new DoubleTag("", block.getY() - (target instanceof BlockWater ? 0.0625 : 0))) .add(new DoubleTag("", block.getZ() + 0.5))) .putList(new ListTag<DoubleTag>("Motion") .add(new DoubleTag("", 0)) .add(new DoubleTag("", 0)) .add(new DoubleTag("", 0))) .putList(new ListTag<FloatTag>("Rotation") .add(new FloatTag("", (float) ((player.yaw + 90f) % 360))) .add(new FloatTag("", 0))) .putByte("woodID", this.getDamage()) ); if (boat == null) { return false; } if (player.isSurvival()) { Item item = player.getInventory().getItemInHand(); item.setCount(item.getCount() - 1); player.getInventory().setItemInHand(item); } boat.spawnToAll(); return true; }
Example #3
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public boolean isInsideOfWater() { double y = this.y + this.getEyeHeight(); Block block = this.level.getBlock(this.temporalVector.setComponents(NukkitMath.floorDouble(this.x), NukkitMath.floorDouble(y), NukkitMath.floorDouble(this.z))); if (block instanceof BlockWater) { double f = (block.y + 1) - (((BlockWater) block).getFluidHeightPercent() - 0.1111111); return y < f; } return false; }