Implement 1.20.10 short sneaking (#5892)

This commit is contained in:
jasonw_4331 2023-07-13 08:36:53 -04:00 committed by GitHub
parent 7132ac0ad3
commit 259cc305df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,6 +217,7 @@ abstract class Living extends Entity{
public function setSneaking(bool $value = true) : void{
$this->sneaking = $value;
$this->networkPropertiesDirty = true;
$this->recalculateSize();
}
public function isSprinting() : bool{
@ -258,6 +259,8 @@ abstract class Living extends Entity{
if($this->isSwimming() || $this->isGliding()){
$width = $size->getWidth();
$this->setSize((new EntitySizeInfo($width, $width, $width * 0.9))->scale($this->getScale()));
}elseif($this->isSneaking()){
$this->setSize((new EntitySizeInfo(3 / 4 * $size->getHeight(), $size->getWidth(), 3 / 4 * $size->getEyeHeight()))->scale($this->getScale()));
}else{
$this->setSize($size->scale($this->getScale()));
}