Java Code Examples for cn.nukkit.math.BlockFace#getZOffset()

The following examples show how to use cn.nukkit.math.BlockFace#getZOffset() . 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: BlockDispenser.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public Vector3 getDispensePosition() {
    BlockFace facing = getFacing();
    double x = this.getX() + 0.7 * facing.getXOffset();
    double y = this.getY() + 0.7 * facing.getYOffset();
    double z = this.getZ() + 0.7 * facing.getZOffset();
    return new Vector3(x, y, z);
}
 
Example 2
Source File: Block.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public Block getSide(BlockFace face, int step) {
    if (this.isValid()) {
        if (step == 1) {
            return this.getLevel().getBlock((int) x + face.getXOffset(), (int) y + face.getYOffset(), (int) z + face.getZOffset());
        } else {
            return this.getLevel().getBlock((int) x + face.getXOffset() * step, (int) y + face.getYOffset() * step, (int) z + face.getZOffset() * step);
        }
    }
    Block block = Block.get(Item.AIR, 0);
    block.x = (int) x + face.getXOffset() * step;
    block.y = (int) y + face.getYOffset() * step;
    block.z = (int) z + face.getZOffset() * step;
    return block;
}
 
Example 3
Source File: BlockDispenser.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public Vector3 getDispensePosition() {
    BlockFace facing = getFacing();
    double x = this.getX() + 0.7 * facing.getXOffset();
    double y = this.getY() + 0.7 * facing.getYOffset();
    double z = this.getZ() + 0.7 * facing.getZOffset();
    return new Vector3(x, y, z);
}
 
Example 4
Source File: DefaultDispenseBehavior.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
private int getParticleMetadataForFace(BlockFace face) {
    return face.getXOffset() + 1 + (face.getZOffset() + 1) * 3;
}
 
Example 5
Source File: DefaultDispenseBehavior.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
private int getParticleMetadataForFace(BlockFace face) {
    return face.getXOffset() + 1 + (face.getZOffset() + 1) * 3;
}