Class HitBlox

java.lang.Object
  extended by HitBlox

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 Summary
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
 
Method Summary
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

HitBlox

public HitBlox(Player in_player)
Constructor requiring player, uses default values

Parameters:
in_player -

HitBlox

public HitBlox(Location in_location)
Constructor requiring location, uses default values

Parameters:
in_location -

HitBlox

public HitBlox(Player in_player,
               int in_range,
               double in_step)
Constructor requiring player, max range, and a stepping value

Parameters:
in_player -
in_range -
in_step -

HitBlox

public HitBlox(Location in_location,
               int in_range,
               double in_step)
Constructor requiring location, max range, and a stepping value

Parameters:
in_location -
in_range -
in_step -
Method Detail

init

public void init(Location in_location,
                 int in_range,
                 double in_step,
                 double in_view_height)
Initialization method

Parameters:
in_location -
in_range -
in_step -
in_view_height -

getTargetBlock

public Block getTargetBlock()
Returns the block at the cursor, or null if out of range

Returns:
Block

setTargetBlock

public void setTargetBlock(int type)
Sets the type of the block at the cursor

Parameters:
type -

getFaceBlock

public Block getFaceBlock()
Returns the block attached to the face at the cursor, or null if out of range

Returns:
Block

setFaceBlock

public void setFaceBlock(int type)
Sets the type of the block attached to the face at the cursor

Parameters:
type -

getNextBlock

public Block getNextBlock()
Returns STEPS forward along line of vision and returns block

Returns:
Block

getCurBlock

public Block getCurBlock()
Returns the current block along the line of vision

Returns:
Block

setCurBlock

public void setCurBlock(int type)
Sets current block type id

Parameters:
type -

getLastBlock

public Block getLastBlock()
Returns the previous block along the line of vision

Returns:
Block

setLastBlock

public void setLastBlock(int type)
Sets previous block type id

Parameters:
type -