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

Public Member Functions

 onUpdate ($tick)
 
 willMove ($distance=36)
 
 attack ($damage, EntityDamageEvent $source)
 
 ifjump (Level $level, Vector3 $v3, $hate=false, $reason=false)
 
 whatBlock (Level $level, $v3)
 
 getMyYaw ($mx, $mz)
 
 getMyPitch (Vector3 $from, Vector3 $to)
 
- Public Member Functions inherited from Living
 setHealth ($amount)
 
 saveNBT ()
 
 getName ()
 
 hasLineOfSight (Entity $entity)
 
 heal ($amount, EntityRegainHealthEvent $source)
 
 attack ($damage, EntityDamageEvent $source)
 
 knockBack (Entity $attacker, $damage, $x, $z, $base=0.4)
 
 kill ()
 
 entityBaseTick ($tickDiff=1, $EnchantL=0)
 
 getDrops ()
 
 getLineOfSight ($maxDistance, $maxLength=0, array $transparent=[])
 
 getTargetBlock ($maxDistance, array $transparent=[])
 
- Public Member Functions inherited from Entity
 __construct (Level $level, CompoundTag $nbt)
 
 getHeight ()
 
 getWidth ()
 
 getLength ()
 
 setScale ($scale)
 
 getScale ()
 
 getDropExpMin ()
 
 getDropExpMax ()
 
 getNameTag ()
 
 isNameTagVisible ()
 
 isNameTagAlwaysVisible ()
 
 setNameTag ($name)
 
 setNameTagVisible ($value=true)
 
 setNameTagAlwaysVisible ($value=true)
 
 isSneaking ()
 
 setSneaking ($value=true)
 
 isSprinting ()
 
 setSprinting ($value=true)
 
 isGliding ()
 
 setGliding ($value=true)
 
 isImmobile ()
 
 setImmobile ($value=true)
 
 canClimb ()
 
 setCanClimb (bool $value)
 
 canClimbWalls ()
 
 setCanClimbWalls (bool $value=true)
 
 getOwningEntityId ()
 
 getOwningEntity ()
 
 setOwningEntity (Entity $owner)
 
 getEffects ()
 
 removeAllEffects ()
 
 removeEffect ($effectId)
 
 getEffect ($effectId)
 
 hasEffect ($effectId)
 
 addEffect (Effect $effect)
 
 getSaveId ()
 
 saveNBT ()
 
 getViewers ()
 
 spawnTo (Player $player)
 
 sendPotionEffects (Player $player)
 
 sendData ($player, array $data=null)
 
 despawnFrom (Player $player, bool $send=true)
 
 attack ($damage, EntityDamageEvent $source)
 
 heal ($amount, EntityRegainHealthEvent $source)
 
 getHealth ()
 
 isAlive ()
 
 setHealth ($amount)
 
 setLastDamageCause (EntityDamageEvent $type)
 
 getLastDamageCause ()
 
 getAttributeMap ()
 
 getMaxHealth ()
 
 setMaxHealth ($amount)
 
 canCollideWith (Entity $entity)
 
 entityBaseTick ($tickDiff=1)
 
 getDirectionVector ()
 
 getDirectionPlane ()
 
 onUpdate ($currentTick)
 
 scheduleUpdate ()
 
 isOnFire ()
 
 setOnFire ($seconds)
 
 isFireProof ()
 
 getDirection ()
 
 extinguish ()
 
 canTriggerWalking ()
 
 resetFallDistance ()
 
 getBoundingBox ()
 
 fall ($fallDistance)
 
 handleLavaMovement ()
 
 getEyeHeight ()
 
 moveFlying ()
 
 onCollideWithPlayer (Human $entityPlayer)
 
 getPosition ()
 
 getLocation ()
 
 isInsideOfPortal ()
 
 isInsideOfWater ()
 
 isInsideOfSolid ()
 
 isInsideOfFire ()
 
 fastMove ($dx, $dy, $dz)
 
 move ($dx, $dy, $dz)
 
 getBlocksAround ()
 
 setPositionAndRotation (Vector3 $pos, $yaw, $pitch)
 
 setRotation ($yaw, $pitch)
 
 setLocation (Location $pos)
 
 setPosition (Vector3 $pos)
 
 getMotion ()
 
 setMotion (Vector3 $motion)
 
 isOnGround ()
 
 kill ()
 
 teleport (Vector3 $pos, $yaw=null, $pitch=null)
 
 getId ()
 
 respawnToAll ()
 
 spawnToAll ()
 
 despawnFromAll ()
 
 close ()
 
 setDataProperty ($id, $type, $value)
 
 linkEntity (Entity $entity)
 
 sendLinkedData ()
 
 setLinked ($type=0, Entity $entity)
 
 getLinkedEntity ()
 
 getLinkedType ()
 
 getDataProperty ($id)
 
 getDataPropertyType ($id)
 
 setDataFlag ($propertyId, $id, $value=true, $type=self::DATA_TYPE_LONG)
 
 getDataFlag ($propertyId, $id)
 
 __destruct ()
 
 setMetadata ($metadataKey, MetadataValue $metadataValue)
 
 getMetadata ($metadataKey)
 
 hasMetadata ($metadataKey)
 
 removeMetadata ($metadataKey, Plugin $plugin)
 
 __toString ()
 
- Public Member Functions inherited from Location
 __construct ($x=0, $y=0, $z=0, $yaw=0.0, $pitch=0.0, Level $level=null)
 
 asLocation ()
 
 add ($x, $y=0, $z=0, $yaw=0, $pitch=0)
 
 getYaw ()
 
 getPitch ()
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
 __toString ()
 
- Public Member Functions inherited from Position
 __construct ($x=0, $y=0, $z=0, Level $level=null)
 
 asPosition ()
 
 add ($x, $y=0, $z=0)
 
 getLevel ()
 
 setLevel (Level $level=null)
 
 isValid ()
 
 getSide ($side, $step=1)
 
 __toString ()
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
- 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

 $attackingTick = 0
 
- Data Fields inherited from Entity
const NETWORK_ID = -1
 
const DATA_TYPE_BYTE = 0
 
const DATA_TYPE_SHORT = 1
 
const DATA_TYPE_INT = 2
 
const DATA_TYPE_FLOAT = 3
 
const DATA_TYPE_STRING = 4
 
const DATA_TYPE_SLOT = 5
 
const DATA_TYPE_POS = 6
 
const DATA_TYPE_LONG = 7
 
const DATA_TYPE_VECTOR3F = 8
 
const DATA_FLAGS = 0
 
const DATA_HEALTH = 1
 
const DATA_VARIANT = 2
 
const DATA_COLOR = 3
 
const DATA_COLOUR = 3
 
const DATA_NAMETAG = 4
 
const DATA_OWNER_EID = 5
 
const DATA_TARGET_EID = 6
 
const DATA_AIR = 7
 
const DATA_POTION_COLOR = 8
 
const DATA_POTION_AMBIENT = 9
 
const DATA_HURT_TIME = 11
 
const DATA_HURT_DIRECTION = 12
 
const DATA_PADDLE_TIME_LEFT = 13
 
const DATA_PADDLE_TIME_RIGHT = 14
 
const DATA_EXPERIENCE_VALUE = 15
 
const DATA_MINECART_DISPLAY_BLOCK = 16
 
const DATA_MINECART_DISPLAY_OFFSET = 17
 
const DATA_MINECART_HAS_DISPLAY = 18
 
const DATA_ENDERMAN_HELD_ITEM_ID = 23
 
const DATA_ENDERMAN_HELD_ITEM_DAMAGE = 24
 
const DATA_ENTITY_AGE = 25
 
const DATA_FIREBALL_POWER_X = 30
 
const DATA_FIREBALL_POWER_Y = 31
 
const DATA_FIREBALL_POWER_Z = 32
 
const DATA_POTION_AUX_VALUE = 37
 
const DATA_LEAD_HOLDER_EID = 38
 
const DATA_SCALE = 39
 
const DATA_INTERACTIVE_TAG = 40
 
const DATA_NPC_SKIN_ID = 41
 
const DATA_URL_TAG = 42
 
const DATA_MAX_AIR = 43
 
const DATA_MARK_VARIANT = 44
 
const DATA_BLOCK_TARGET = 48
 
const DATA_WITHER_INVULNERABLE_TICKS = 49
 
const DATA_WITHER_TARGET_1 = 50
 
const DATA_WITHER_TARGET_2 = 51
 
const DATA_WITHER_TARGET_3 = 52
 
const DATA_BOUNDING_BOX_WIDTH = 54
 
const DATA_BOUNDING_BOX_HEIGHT = 55
 
const DATA_FUSE_LENGTH = 56
 
const DATA_RIDER_SEAT_POSITION = 57
 
const DATA_RIDER_ROTATION_LOCKED = 58
 
const DATA_RIDER_MAX_ROTATION = 59
 
const DATA_RIDER_MIN_ROTATION = 60
 
const DATA_AREA_EFFECT_CLOUD_RADIUS = 61
 
const DATA_AREA_EFFECT_CLOUD_WAITING = 62
 
const DATA_AREA_EFFECT_CLOUD_PARTICLE_ID = 63
 
const DATA_SHULKER_ATTACH_FACE = 65
 
const DATA_SHULKER_ATTACH_POS = 67
 
const DATA_TRADING_PLAYER_EID = 68
 
const DATA_COMMAND_BLOCK_COMMAND = 71
 
const DATA_COMMAND_BLOCK_LAST_OUTPUT = 72
 
const DATA_COMMAND_BLOCK_TRACK_OUTPUT = 73
 
const DATA_CONTROLLING_RIDER_SEAT_NUMBER = 74
 
const DATA_STRENGTH = 75
 
const DATA_MAX_STRENGTH = 76
 
const DATA_FLAG_ONFIRE = 0
 
const DATA_FLAG_SNEAKING = 1
 
const DATA_FLAG_RIDING = 2
 
const DATA_FLAG_SPRINTING = 3
 
const DATA_FLAG_ACTION = 4
 
const DATA_FLAG_INVISIBLE = 5
 
const DATA_FLAG_TEMPTED = 6
 
const DATA_FLAG_INLOVE = 7
 
const DATA_FLAG_SADDLED = 8
 
const DATA_FLAG_POWERED = 9
 
const DATA_FLAG_IGNITED = 10
 
const DATA_FLAG_BABY = 11
 
const DATA_FLAG_CONVERTING = 12
 
const DATA_FLAG_CRITICAL = 13
 
const DATA_FLAG_CAN_SHOW_NAMETAG = 14
 
const DATA_FLAG_ALWAYS_SHOW_NAMETAG = 15
 
const DATA_FLAG_IMMOBILE = 16
 
const DATA_FLAG_NO_AI = 16
 
const DATA_FLAG_SILENT = 17
 
const DATA_FLAG_WALLCLIMBING = 18
 
const DATA_FLAG_CAN_CLIMB = 19
 
const DATA_FLAG_SWIMMER = 20
 
const DATA_FLAG_CAN_FLY = 21
 
const DATA_FLAG_RESTING = 22
 
const DATA_FLAG_SITTING = 23
 
const DATA_FLAG_ANGRY = 24
 
const DATA_FLAG_INTERESTED = 25
 
const DATA_FLAG_CHARGED = 26
 
const DATA_FLAG_TAMED = 27
 
const DATA_FLAG_LEASHED = 28
 
const DATA_FLAG_SHEARED = 29
 
const DATA_FLAG_GLIDING = 30
 
const DATA_FLAG_ELDER = 31
 
const DATA_FLAG_MOVING = 32
 
const DATA_FLAG_BREATHING = 33
 
const DATA_FLAG_CHESTED = 34
 
const DATA_FLAG_STACKABLE = 35
 
const DATA_FLAG_SHOWBASE = 36
 
const DATA_FLAG_REARING = 37
 
const DATA_FLAG_VIBRATING = 38
 
const DATA_FLAG_IDLING = 39
 
const DATA_FLAG_EVOKER_SPELL = 40
 
const DATA_FLAG_CHARGE_ATTACK = 41
 
const DATA_FLAG_LINGER = 45
 
const SOUTH = 0
 
const WEST = 1
 
const NORTH = 2
 
const EAST = 3
 
 $passenger = null
 
 $vehicle = null
 
 $chunk
 
 $lastX = null
 
 $lastY = null
 
 $lastZ = null
 
 $motionX
 
 $motionY
 
 $motionZ
 
 $temporalVector
 
 $lastMotionX
 
 $lastMotionY
 
 $lastMotionZ
 
 $lastYaw
 
 $lastPitch
 
 $boundingBox
 
 $onGround
 
 $inBlock = false
 
 $positionChanged
 
 $motionChanged
 
 $deadTicks = 0
 
 $height
 
 $eyeHeight = null
 
 $width
 
 $length
 
 $keepMovement = false
 
 $fallDistance = 0
 
 $ticksLived = 0
 
 $lastUpdate
 
 $maxFireTicks
 
 $fireTicks = 0
 
 $namedtag
 
 $canCollide = true
 
 $isCollided = false
 
 $isCollidedHorizontally = false
 
 $isCollidedVertically = false
 
 $noDamageTicks
 
 $closed = false
 
 $dropExp = [0, 0]
 
- Data Fields inherited from Location
 $yaw
 
 $pitch
 
- Data Fields inherited from Position
 $level = null
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from Entity
static init ()
 
static createEntity ($type, Level $level, CompoundTag $nbt,... $args)
 
static registerEntity ($className, $force=false)
 
- Static Public Member Functions inherited from Location
static fromObject (Vector3 $pos, Level $level=null, $yaw=0.0, $pitch=0.0)
 
- Static Public Member Functions inherited from Position
static fromObject (Vector3 $pos, Level $level=null)
 
- Static Public Member Functions inherited from Vector3
static getOppositeSide ($side)
 
static createRandomDirection (Random $random)
 
- Static Public Attributes inherited from Entity
static $entityCount = 1
 
- Protected Member Functions inherited from Living
 initEntity ()
 
- Protected Member Functions inherited from Entity
 recalculateEffectColor ()
 
 initEntity ()
 
 addAttributes ()
 
 checkObstruction ($x, $y, $z)
 
 updateMovement ()
 
 updateFallState ($distanceThisTick, $onGround)
 
 switchLevel (Level $targetLevel)
 
 checkGroundState ($movX, $movY, $movZ, $dx, $dy, $dz)
 
 checkBlockCollision ()
 
 checkChunks ()
 
- Protected Attributes inherited from Living
 $gravity = 0.08
 
 $drag = 0.02
 
 $attackTime = 0
 
 $invisible = false
 
- Protected Attributes inherited from Entity
 $hasSpawned = []
 
 $effects = []
 
 $id
 
 $dataFlags = 0
 
 $dataProperties
 
 $lastDamageCause = null
 
 $age = 0
 
 $ySize = 0
 
 $stepHeight = 0
 
 $isStatic = false
 
 $justCreated
 
 $attributeMap
 
 $gravity
 
 $drag
 
 $server
 
 $timings
 
 $isPlayer = false
 
 $linkedEntity = null
 
 $linkedType = null
 
 $riding = null
 
 $activatedPressurePlates = []
 

Member Function Documentation

◆ attack()

attack (   $damage,
EntityDamageEvent  $source 
)
Parameters
float$damage
EntityDamageEvent$source
Returns
bool|void
93  {
94  parent::attack($damage, $source);
95  if(!$source->isCancelled() and $source->getCause() == EntityDamageEvent::CAUSE_ENTITY_ATTACK){
96  $this->attackingTick = 20;
97  }
98  }

◆ getMyPitch()

getMyPitch ( Vector3  $from,
Vector3  $to 
)
Parameters
Vector3$from
Vector3$to
Returns
float|int 获取pitch角度
351  {
352  $distance = $from->distance($to);
353  $height = $to->y - $from->y;
354  if($height > 0){
355  return -rad2deg(asin($height / $distance));
356  }elseif($height < 0){
357  return rad2deg(asin(-$height / $distance));
358  }else{
359  return 0;
360  }
361  }

◆ getMyYaw()

getMyYaw (   $mx,
  $mz 
)
Parameters
$mx
$mz
Returns
float|int 获取yaw角度
314  { //根据motion计算转向角度
315  //转向计算
316  if($mz == 0){ //斜率不存在
317  if($mx < 0){
318  $yaw = -90;
319  }else{
320  $yaw = 90;
321  }
322  }else{ //存在斜率
323  if($mx >= 0 and $mz > 0){ //第一象限
324  $atan = atan($mx / $mz);
325  $yaw = rad2deg($atan);
326  }elseif($mx >= 0 and $mz < 0){ //第二象限
327  $atan = atan($mx / abs($mz));
328  $yaw = 180 - rad2deg($atan);
329  }elseif($mx < 0 and $mz < 0){ //第三象限
330  $atan = atan($mx / $mz);
331  $yaw = -(180 - rad2deg($atan));
332  }elseif($mx < 0 and $mz > 0){ //第四象限
333  $atan = atan(abs($mx) / $mz);
334  $yaw = -(rad2deg($atan));
335  }else{
336  $yaw = 0;
337  }
338  }
339 
340  $yaw = -$yaw;
341  return $yaw;
342  }

◆ ifjump()

ifjump ( Level  $level,
Vector3  $v3,
  $hate = false,
  $reason = false 
)
Parameters
Level$level
Vector3$v3
bool$hate
bool$reason
Returns
bool|float|string 判断某坐标是否可以行走 并给出原因
110  { //boybook Y轴算法核心函数
111  $x = floor($v3->getX());
112  $y = floor($v3->getY());
113  $z = floor($v3->getZ());
114 
115  //echo ($y." ");
116  if($this->whatBlock($level, new Vector3($x, $y, $z)) == "air"){
117  //echo "前方空气 ";
118  if($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "block" or new Vector3($x, $y - 1, $z) == "climb"){ //方块
119  //echo "考虑向前 ";
120  if($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "half" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "high"){ //上方一格被堵住了
121  //echo "上方卡住 \n";
122  if($reason) return 'up!';
123  return false; //上方卡住
124  }else{
125  //echo "GO向前走 \n";
126  if($reason) return 'GO';
127  return $y; //向前走
128  }
129  }elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "water"){ //水
130  //echo "下水游泳 \n";
131  if($reason) return 'swim';
132  return $y - 1; //降低一格向前走(下水游泳)
133  }elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "half"){ //半砖
134  //echo "下到半砖 \n";
135  if($reason) return 'half';
136  return $y - 0.5; //向下跳0.5格
137  }elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "lava"){ //岩浆
138  //echo "前方岩浆 \n";
139  if($reason) return 'lava';
140  return false; //前方岩浆
141  }elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "air"){ //空气
142  //echo "考虑向下跳 ";
143  if($this->whatBlock($level, new Vector3($x, $y - 2, $z)) == "block"){
144  //echo "GO向下跳 \n";
145  if($reason) return 'down';
146  return $y - 1; //向下跳
147  }else{ //前方悬崖
148  //echo "前方悬崖 \n";
149  if($reason) return 'fall';
150  if($hate === false){
151  return false;
152  }else{
153  return $y - 1; //向下跳
154  }
155  }
156  }
157  }elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == "water"){ //水
158  //echo "正在水中";
159  if($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "water"){ //上面还是水
160  //echo "向上游 \n";
161  if($reason) return 'inwater';
162  return $y + 1; //向上游,防溺水
163  }elseif($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "half"){ //上方一格被堵住了
164  if($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "half"){ //下方一格被也堵住了
165  //echo "上下都被卡住 \n";
166  if($reason) return 'up!_down!';
167  return false; //上下都被卡住
168  }else{
169  //echo "向下游 \n";
170  if($reason) return 'up!';
171  return $y - 1; //向下游,防卡住
172  }
173  }else{
174  //echo "游泳ing... \n";
175  if($reason) return 'swim...';
176  return $y; //向前游
177  }
178  }elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == "half"){ //半砖
179  //echo "前方半砖 \n";
180  if($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "half" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "high"){ //上方一格被堵住了
181  //return false; //上方卡住
182  }else{
183  if($reason) return 'halfGO';
184  return $y + 0.5;
185  }
186 
187  }elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == "lava"){ //岩浆
188  //echo "前方岩浆 \n";
189  if($reason) return 'lava';
190  return false;
191  }elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == "high"){ //1.5格高方块
192  //echo "前方栅栏 \n";
193  if($reason) return 'high';
194  return false;
195  }elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == "climb"){ //梯子
196  //echo "前方梯子 \n";
197  //return $y;
198  if($reason) return 'climb';
199  if($hate){
200  return $y + 0.7;
201  }else{
202  return $y + 0.5;
203  }
204  }else{ //考虑向上
205  //echo "考虑向上 ";
206  if($this->whatBlock($level, new Vector3($x, $y + 1, $z)) != "air"){ //前方是面墙
207  //echo "前方是墙 \n";
208  if($reason) return 'wall';
209  return false;
210  }else{
211  if($this->whatBlock($level, new Vector3($x, $y + 2, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y + 2, $z)) == "half" or $this->whatBlock($level, new Vector3($x, $y + 2, $z)) == "high"){ //上方两格被堵住了
212  //echo "2格处被堵 \n";
213  if($reason) return 'up2!';
214  return false;
215  }else{
216  //echo "GO向上跳 \n";
217  if($reason) return 'upGO';
218  return $y + 1; //向上跳
219  }
220  }
221  }
222  return false;
223  }

◆ onUpdate()

onUpdate (   $tick)
Parameters
$tick
Returns
bool
36  {
37  if(!$this instanceof Human){
38  if($this->attackingTick > 0){
39  $this->attackingTick--;
40  }
41  if(!$this->isAlive() and $this->hasSpawned){
43  if($this->deadTicks >= 20){
44  $this->despawnFromAll();
45  }
46  return true;
47  }
48  if($this->isAlive()){
49 
50  $this->motionY -= $this->gravity;
51 
52  $this->move($this->motionX, $this->motionY, $this->motionZ);
53 
54  $friction = 1 - $this->drag;
55 
56  if($this->onGround and (abs($this->motionX) > 0.00001 or abs($this->motionZ) > 0.00001)){
57  $friction = $this->getLevel()->getBlock($this->temporalVector->setComponents((int) floor($this->x), (int) floor($this->y - 1), (int) floor($this->z) - 1))->getFrictionFactor() * $friction;
58  }
59 
60  $this->motionX *= $friction;
61  $this->motionY *= 1 - $this->drag;
62  $this->motionZ *= $friction;
63 
64  if($this->onGround){
65  $this->motionY *= -0.5;
66  }
67 
68  $this->updateMovement();
69  }
70  }
71  parent::entityBaseTick();
72  return parent::onUpdate($tick);
73  }

◆ whatBlock()

whatBlock ( Level  $level,
  $v3 
)
Parameters
Level$level
$v3
Returns
string
231  { //boybook的y轴判断法 核心 什么方块?
232  $id = $level->getBlockIdAt($v3->x, $v3->y, $v3->z);
233  $damage = $level->getBlockDataAt($v3->x, $v3->y, $v3->z);
234  switch($id){
235  case 0:
236  case 6:
237  case 27:
238  case 30:
239  case 31:
240  case 37:
241  case 38:
242  case 39:
243  case 40:
244  case 50:
245  case 51:
246  case 63:
247  case 66:
248  case 68:
249  case 78:
250  case 111:
251  case 141:
252  case 142:
253  case 171:
254  case 175:
255  case 244:
256  case 323:
257  //透明方块
258  return "air";
259  break;
260  case 8:
261  case 9:
262  //水
263  return "water";
264  break;
265  case 10:
266  case 11:
267  //岩浆
268  return "lava";
269  break;
270  case 44:
271  case 158:
272  //半砖
273  if($damage >= 8){
274  return "block";
275  }else{
276  return "half";
277  }
278  break;
279  case 64:
280  //门
281  //var_dump($damage." ");
282  //TODO 不知如何判断门是否开启,因为以下条件永远满足
283  if(($damage & 0x08) === 0x08){
284  return "air";
285  }else{
286  return "block";
287  }
288  break;
289  case 85:
290  case 107:
291  case 139:
292  //1.5格高的无法跳跃物
293  return "high";
294  break;
295  case 65:
296  case 106:
297  //可攀爬物
298  return "climb";
299  break;
300  default:
301  //普通方块
302  return "block";
303  break;
304  }
305  }

◆ willMove()

willMove (   $distance = 36)
Parameters
int$distance
Returns
bool
80  {
81  foreach($this->getViewers() as $viewer){
82  if($this->distance($viewer->getLocation()) <= $distance) return true;
83  }
84  return false;
85  }

Field Documentation

◆ $attackingTick

$attackingTick = 0

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