Skip to content

Commit d6e6b63

Browse files
committed
PocketMine-MP v5.0.0 changes
1 parent af6cc4e commit d6e6b63

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

.poggit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ projects:
77
path: ""
88
libs:
99
- src: poggit/libasynql/libasynql
10-
version: 4.1.6
10+
branch: pm5
11+
version: ^4.1.1
1112
...

plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: FloatingText
22
main: cosmicpe\floatingtext\Loader
3-
api: 4.0.0
4-
version: 0.1.1
3+
api: 5.0.0
4+
version: 0.1.2
55
commands:
66
floatingtext:
77
aliases: [ft]

src/cosmicpe/floatingtext/FloatingText.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
final class FloatingText{
88

99
public function __construct(
10-
/** @readonly */ public string $world,
11-
/** @readonly */ public float $x,
12-
/** @readonly */ public float $y,
13-
/** @readonly */ public float $z,
14-
/** @readonly */ public string $line
10+
readonly public string $world,
11+
readonly public float $x,
12+
readonly public float $y,
13+
readonly public float $z,
14+
readonly public string $line
1515
){}
1616
}

src/cosmicpe/floatingtext/FloatingTextEntity.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use pocketmine\event\entity\EntityDamageEvent;
1313
use pocketmine\math\Vector3;
1414
use pocketmine\nbt\tag\CompoundTag;
15-
use pocketmine\network\mcpe\convert\RuntimeBlockMapping;
15+
use pocketmine\network\mcpe\convert\TypeConverter;
1616
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
1717
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection;
1818
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
@@ -24,13 +24,6 @@ public static function getNetworkTypeId() : string{
2424
return EntityIds::FALLING_BLOCK;
2525
}
2626

27-
public $gravity = 0.0;
28-
public $canCollide = false;
29-
public $keepMovement = true;
30-
protected $gravityEnabled = false;
31-
protected $drag = 0.0;
32-
protected $immobile = true;
33-
3427
private int $floating_text_id;
3528
private FloatingText $floating_text;
3629

@@ -41,13 +34,18 @@ public function __construct(World $world, int $text_id, FloatingText $text){
4134
$this->setCanSaveWithChunk(false);
4235
$this->floating_text_id = $text_id;
4336
$this->floating_text = $text;
37+
$this->keepMovement = true;
38+
$this->gravity = 0.0;
39+
$this->gravityEnabled = false;
40+
$this->drag = 0.0;
41+
$this->noClientPredictions = true;
4442
parent::__construct(new Location($text->x, $text->y, $text->z, $world, 0.0, 0.0));
4543
}
4644

4745
protected function initEntity(CompoundTag $nbt) : void{
4846
parent::initEntity($nbt);
4947
$this->setNameTag($this->floating_text->line);
50-
$this->setNameTagAlwaysVisible(true);
48+
$this->setNameTagAlwaysVisible();
5149
}
5250

5351
protected function getInitialSizeInfo() : EntitySizeInfo{
@@ -56,7 +54,7 @@ protected function getInitialSizeInfo() : EntitySizeInfo{
5654

5755
protected function syncNetworkData(EntityMetadataCollection $properties) : void{
5856
parent::syncNetworkData($properties);
59-
$properties->setInt(EntityMetadataProperties::VARIANT, RuntimeBlockMapping::getInstance()->toRuntimeId(VanillaBlocks::AIR()->getFullId()));
57+
$properties->setInt(EntityMetadataProperties::VARIANT, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId(VanillaBlocks::AIR()->getStateId()));
6058
}
6159

6260
public function addDespawnCallback(Closure $callback) : void{
@@ -90,6 +88,14 @@ public function canBeMovedByCurrents() : bool{
9088
return false;
9189
}
9290

91+
protected function getInitialDragMultiplier() : float{
92+
return 0.0;
93+
}
94+
95+
protected function getInitialGravity() : float{
96+
return 0.0;
97+
}
98+
9399
public function getOffsetPosition(Vector3 $vector3) : Vector3{
94100
return parent::getOffsetPosition($vector3)->add(0.0, 0.49, 0.0);
95101
}

0 commit comments

Comments
 (0)