mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 17:20:02 +00:00
Added forceSend for attribute value setting, fixed slowness >= 7 removed client-side when sprinting
This commit is contained in:
parent
7fb3c7343f
commit
c925845173
@ -169,7 +169,7 @@ class Attribute{
|
|||||||
return $this->currentValue;
|
return $this->currentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValue($value, $fit = false){
|
public function setValue($value, $fit = false, bool $forceSend = false){
|
||||||
if($value > $this->getMaxValue() or $value < $this->getMinValue()){
|
if($value > $this->getMaxValue() or $value < $this->getMinValue()){
|
||||||
if(!$fit){
|
if(!$fit){
|
||||||
throw new \InvalidArgumentException("Value $value exceeds the range!");
|
throw new \InvalidArgumentException("Value $value exceeds the range!");
|
||||||
@ -180,7 +180,10 @@ class Attribute{
|
|||||||
if($this->currentValue != $value){
|
if($this->currentValue != $value){
|
||||||
$this->desynchronized = true;
|
$this->desynchronized = true;
|
||||||
$this->currentValue = $value;
|
$this->currentValue = $value;
|
||||||
|
}elseif($forceSend){
|
||||||
|
$this->desynchronized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
if($value !== $this->isSprinting()){
|
if($value !== $this->isSprinting()){
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SPRINTING, (bool) $value);
|
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SPRINTING, (bool) $value);
|
||||||
$attr = $this->attributeMap->getAttribute(Attribute::MOVEMENT_SPEED);
|
$attr = $this->attributeMap->getAttribute(Attribute::MOVEMENT_SPEED);
|
||||||
$attr->setValue($value ? ($attr->getValue() * 1.3) : ($attr->getValue() / 1.3));
|
$attr->setValue($value ? ($attr->getValue() * 1.3) : ($attr->getValue() / 1.3), false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user