Add ray tracing methods to LivingEntity

This commit is contained in:
BillyGalbreath
2018-09-03 18:13:53 -05:00
parent 8ce80096b6
commit c708d136f7
2 changed files with 159 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
package com.destroystokyo.paper.block;
import org.bukkit.FluidCollisionMode;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.jetbrains.annotations.NotNull;
/**
* Represents information about a targeted block
* @deprecated use {@link org.bukkit.util.RayTraceResult}
*/
@Deprecated(forRemoval = true, since = "1.19.3")
public class TargetBlockInfo {
private final Block block;
private final BlockFace blockFace;
public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) {
this.block = block;
this.blockFace = blockFace;
}
/**
* Get the block that is targeted
*
* @return Targeted block
*/
@NotNull
public Block getBlock() {
return block;
}
/**
* Get the targeted BlockFace
*
* @return Targeted blockface
*/
@NotNull
public BlockFace getBlockFace() {
return blockFace;
}
/**
* Get the relative Block to the targeted block on the side it is targeted at
*
* @return Block relative to targeted block
*/
@NotNull
public Block getRelativeBlock() {
return block.getRelative(blockFace);
}
/**
* @deprecated use {@link org.bukkit.FluidCollisionMode}
*/
@Deprecated(forRemoval = true, since = "1.19.3")
public enum FluidMode {
NEVER(FluidCollisionMode.NEVER),
SOURCE_ONLY(FluidCollisionMode.SOURCE_ONLY),
ALWAYS(FluidCollisionMode.ALWAYS);
public final FluidCollisionMode bukkit;
FluidMode(FluidCollisionMode bukkit) {
this.bukkit = bukkit;
}
}
}