Merge branch 'next-minor'

This commit is contained in:
Dylan K. Taylor
2020-05-06 20:41:48 +01:00
7 changed files with 72 additions and 37 deletions

View File

@ -28,7 +28,6 @@ final class EntityMetadataFlags{
private function __construct(){
//NOOP
}
public const ONFIRE = 0;
public const SNEAKING = 1;
public const RIDING = 2;
@ -101,11 +100,11 @@ final class EntityMetadataFlags{
public const OVER_SCAFFOLDING = 69;
public const FALL_THROUGH_SCAFFOLDING = 70;
public const BLOCKING = 71; //shield
public const DISABLE_BLOCKING = 72;
//73 is set when a player is attacked while using shield, unclear on purpose
//74 related to shield usage, needs further investigation
public const TRANSITION_BLOCKING = 72;
public const BLOCKED_USING_SHIELD = 73;
public const BLOCKED_USING_DAMAGED_SHIELD = 74;
public const SLEEPING = 75;
//76 related to sleeping, unclear usage
public const WANTS_TO_WAKE = 76;
public const TRADE_INTEREST = 77;
public const DOOR_BREAKER = 78; //...
public const BREAKING_OBSTRUCTION = 79;
@ -115,6 +114,10 @@ final class EntityMetadataFlags{
public const ROARING = 83;
public const DELAYED_ATTACKING = 84;
public const AVOIDING_MOBS = 85;
//86 used by RangedAttackGoal
//87 used by NearestAttackableTargetGoal
public const FACING_TARGET_TO_RANGE_ATTACK = 86;
public const HIDDEN_WHEN_INVISIBLE = 87; //??????????????????
public const IS_IN_UI = 88;
public const STALKING = 89;
public const EMOTING = 90;
public const CELEBRATING = 91;
}

View File

@ -468,9 +468,15 @@ class Utils{
* @return string[] an array of tagName => tag value. If the tag has no value, an empty string is used as the value.
*/
public static function parseDocComment(string $docComment) : array{
preg_match_all('/(*ANYCRLF)^[\t ]*\* @([a-zA-Z]+)(?:[\t ]+(.+))?[\t ]*$/m', $docComment, $matches);
$rawDocComment = substr($docComment, 3, -2); //remove the opening and closing markers
if($rawDocComment === false){ //usually empty doc comment, but this is safer and statically analysable
return [];
}
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
return array_combine($matches[1], $matches[2]);
$result = array_combine($matches[1], $matches[2]);
if($result === false) throw new AssumptionFailedError("array_combine() doesn't return false with two equal-sized arrays");
return $result;
}
/**