|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectHitBlox
public class HitBlox extends java.lang.Object
HitBlox.java - Class for getting blocks along line of sight NOTES: This class is designed to handle the annoying parts of the seemingly simple task of getting the coordinates of the block a player is currently aimed at. This class abstracts the simpler tasks of finding the current target block and the adjacent unoccupied block to their own methods, but it also provides a public getNextBlock method for processing the entire line-of-sight from the player for more specialized tasks. This method can be used exactly as it is in getTargetBlock, for instance. WARNING: Servers with map coordinate bugs may experience a one or more block inaccuracy when in affected parts of the world. A good way to test areas for the offset bug is to use Chrisinajar's Magic Carpet plugin. Contact: For questions, contact Ho0ber@gmail.com or channel #hey0 on irc.esper.net
Constructor and Description |
---|
HitBlox(Location in_location)
Constructor requiring location, uses default values |
HitBlox(Location in_location,
int in_range,
double in_step)
Constructor requiring location, max range, and a stepping value |
HitBlox(Player in_player)
Constructor requiring player, uses default values |
HitBlox(Player in_player,
int in_range,
double in_step)
Constructor requiring player, max range, and a stepping value |
Modifier and Type | Method and Description |
---|---|
Block |
getCurBlock()
Returns the current block along the line of vision |
Block |
getFaceBlock()
Returns the block attached to the face at the cursor, or null if out of range |
Block |
getLastBlock()
Returns the previous block along the line of vision |
Block |
getNextBlock()
Returns STEPS forward along line of vision and returns block |
Block |
getTargetBlock()
Returns the block at the cursor, or null if out of range |
void |
init(Location in_location,
int in_range,
double in_step,
double in_view_height)
Initialization method |
void |
setCurBlock(int type)
Sets current block type id |
void |
setFaceBlock(int type)
Sets the type of the block attached to the face at the cursor |
void |
setLastBlock(int type)
Sets previous block type id |
void |
setTargetBlock(int type)
Sets the type of the block at the cursor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HitBlox(Player in_player)
in_player
- public HitBlox(Location in_location)
in_location
- public HitBlox(Player in_player, int in_range, double in_step)
in_player
- in_range
- in_step
- public HitBlox(Location in_location, int in_range, double in_step)
in_location
- in_range
- in_step
- Method Detail |
---|
public void init(Location in_location, int in_range, double in_step, double in_view_height)
in_location
- in_range
- in_step
- in_view_height
- public Block getTargetBlock()
public void setTargetBlock(int type)
type
- public Block getFaceBlock()
public void setFaceBlock(int type)
type
- public Block getNextBlock()
public Block getCurBlock()
public void setCurBlock(int type)
type
- public Block getLastBlock()
public void setLastBlock(int type)
type
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |