GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
NoteblockSound Class Reference

Public Member Functions

 __construct (Vector3 $pos, $instrument=self::INSTRUMENT_PIANO, $pitch=0)
 
 encode ()
 
- Public Member Functions inherited from GenericSound
 __construct (Vector3 $pos, $id, $pitch=0)
 
 getPitch ()
 
 setPitch ($pitch)
 
 encode ()
 
- Public Member Functions inherited from Sound
 encode ()
 
- Public Member Functions inherited from Vector3
 __construct ($x=0, $y=0, $z=0)
 
 getX ()
 
 getY ()
 
 getZ ()
 
 getFloorX ()
 
 getFloorY ()
 
 getFloorZ ()
 
 getRight ()
 
 getUp ()
 
 getForward ()
 
 getSouth ()
 
 getWest ()
 
 add ($x, $y=0, $z=0)
 
 subtract ($x=0, $y=0, $z=0)
 
 multiply ($number)
 
 divide ($number)
 
 ceil ()
 
 floor ()
 
 round ()
 
 abs ()
 
 getSide ($side, $step=1)
 
 asVector3 ()
 
 distance (Vector3 $pos)
 
 distanceSquared (Vector3 $pos)
 
 maxPlainDistance ($x=0, $z=0)
 
 length ()
 
 lengthSquared ()
 
 normalize ()
 
 dot (Vector3 $v)
 
 cross (Vector3 $v)
 
 equals (Vector3 $v)
 
 getIntermediateWithXValue (Vector3 $v, $x)
 
 getIntermediateWithYValue (Vector3 $v, $y)
 
 getIntermediateWithZValue (Vector3 $v, $z)
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
 __toString ()
 

Data Fields

const INSTRUMENT_PIANO = 0
 
const INSTRUMENT_BASS_DRUM = 1
 
const INSTRUMENT_CLICK = 2
 
const INSTRUMENT_TABOUR = 3
 
const INSTRUMENT_BASS = 4
 
- Data Fields inherited from Vector3
const SIDE_DOWN = 0
 
const SIDE_UP = 1
 
const SIDE_NORTH = 2
 
const SIDE_SOUTH = 3
 
const SIDE_WEST = 4
 
const SIDE_EAST = 5
 
 $x
 
 $y
 
 $z
 

Protected Attributes

 $instrument
 
 $pitch
 
- Protected Attributes inherited from GenericSound
 $pitch = 0
 
 $id
 

Additional Inherited Members

- Static Public Member Functions inherited from Vector3
static getOppositeSide ($side)
 
static createRandomDirection (Random $random)
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Vector3  $pos,
  $instrument = self::INSTRUMENT_PIANO,
  $pitch = 0 
)

NoteblockSound constructor.

Parameters
Vector3$pos
int$instrument
int$pitch
49  {
50  parent::__construct($pos, $instrument, $pitch);
51  $this->instrument = $instrument;
52  $this->pitch = $pitch;
53  }

Member Function Documentation

◆ encode()

encode ( )
Returns
array
58  {
59  $pk = new BlockEventPacket();
60  $pk->x = $this->x;
61  $pk->y = $this->y;
62  $pk->z = $this->z;
63  $pk->case1 = $this->instrument;
64  $pk->case2 = $this->pitch;
65 
66  $pk2 = new LevelSoundEventPacket();
68  $pk2->x = $this->x;
69  $pk2->y = $this->y;
70  $pk2->z = $this->z;
71  $pk2->extraData = $this->instrument;
72  $pk2->pitch = $this->pitch;
73 
74  return [$pk, $pk2];
75  }

Field Documentation

◆ $instrument

$instrument
protected

◆ $pitch

$pitch
protected

◆ INSTRUMENT_BASS

const INSTRUMENT_BASS = 4

◆ INSTRUMENT_BASS_DRUM

const INSTRUMENT_BASS_DRUM = 1

◆ INSTRUMENT_CLICK

const INSTRUMENT_CLICK = 2

◆ INSTRUMENT_PIANO

const INSTRUMENT_PIANO = 0

◆ INSTRUMENT_TABOUR

const INSTRUMENT_TABOUR = 3

The documentation for this class was generated from the following file: