1212use pocketmine \event \entity \EntityDamageEvent ;
1313use pocketmine \math \Vector3 ;
1414use pocketmine \nbt \tag \CompoundTag ;
15- use pocketmine \network \mcpe \convert \RuntimeBlockMapping ;
15+ use pocketmine \network \mcpe \convert \TypeConverter ;
1616use pocketmine \network \mcpe \protocol \types \entity \EntityIds ;
1717use pocketmine \network \mcpe \protocol \types \entity \EntityMetadataCollection ;
1818use 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