Added target block ray trace functionality.

By: Raphfrk <raphfrk@gmail.com>
This commit is contained in:
Bukkit/Spigot
2011-02-13 17:03:57 +00:00
parent 09916f398f
commit 5ba9ae942a
4 changed files with 455 additions and 2 deletions

View File

@@ -1,24 +1,72 @@
package org.bukkit.entity;
import java.util.HashSet;
import java.util.List;
import org.bukkit.block.Block;
/**
* Represents a living entity, such as a monster or player
*/
public interface LivingEntity extends Entity {
/**
* Gets the entitys health from 0-20, where 0 is dead and 20 is full
* Gets the entity's health from 0-20, where 0 is dead and 20 is full
*
* @return Health represented from 0-20
*/
public int getHealth();
/**
* Sets the entitys health from 0-20, where 0 is dead and 20 is full
* Sets the entity's health from 0-20, where 0 is dead and 20 is full
*
* @param health New health represented from 0-20
*/
public void setHealth(int health);
/**
* Gets the height of the entity's head above its Location
*
* @return Height of the entity's eyes above its Location
*/
public double getEyeHeight();
/**
* Gets the height of the entity's head above its Location
*
* @param boolean If set to true, the effects of sneaking will be ignored
* @return Height of the entity's eyes above its Location
*/
public double getEyeHeight(boolean ignoreSneaking);
/**
* Gets all blocks along the player's line of sight
* List iterates from player's position to target inclusive
*
* @param HashSet<Byte> HashSet containing all transparent block IDs. If set to null only air is considered transparent.
* @param int This is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks.
* @return List containing all blocks along the player's line of sight
*/
public List<Block> getLineOfSight(HashSet<Byte> transparent, int maxDistance);
/**
* Gets the block that the player has targeted
*
* @param HashSet<Byte> HashSet containing all transparent block IDs. If set to null only air is considered transparent.
* @param int This is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks.
* @return Block that the player has targeted
*/
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance);
/**
* Gets the last two blocks along the player's line of sight.
* The target block will be the last block in the list.
*
* @param HashSet<Byte> HashSet containing all transparent block IDs. If set to null only air is considered transparent.
* @param int This is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks
* @return List containing the last 2 blocks along the player's line of sight
*/
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance);
/**
* Throws an egg from the entity.
*/