From da3742b39eb77dd0d9477adc7a08161fc63b3ab7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 6 Feb 2020 15:58:52 +0000 Subject: [PATCH] Remove useless typecasts --- src/pocketmine/command/defaults/EffectCommand.php | 2 +- src/pocketmine/entity/object/Painting.php | 4 ++-- src/pocketmine/level/Explosion.php | 2 +- src/pocketmine/level/generator/Flat.php | 4 ++-- src/pocketmine/network/mcpe/NetworkBinaryStream.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/command/defaults/EffectCommand.php b/src/pocketmine/command/defaults/EffectCommand.php index 55d94f9929..3da54604ab 100644 --- a/src/pocketmine/command/defaults/EffectCommand.php +++ b/src/pocketmine/command/defaults/EffectCommand.php @@ -76,7 +76,7 @@ class EffectCommand extends VanillaCommand{ } if($effect === null){ - $sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.effect.notFound", [(string) $args[1]])); + $sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.effect.notFound", [$args[1]])); return true; } diff --git a/src/pocketmine/entity/object/Painting.php b/src/pocketmine/entity/object/Painting.php index 0fba4c6e10..f9767b211e 100644 --- a/src/pocketmine/entity/object/Painting.php +++ b/src/pocketmine/entity/object/Painting.php @@ -83,8 +83,8 @@ class Painting extends Entity{ $this->namedtag->setInt("TileY", (int) $this->blockIn->y); $this->namedtag->setInt("TileZ", (int) $this->blockIn->z); - $this->namedtag->setByte("Facing", (int) $this->direction); - $this->namedtag->setByte("Direction", (int) $this->direction); //Save both for full compatibility + $this->namedtag->setByte("Facing", $this->direction); + $this->namedtag->setByte("Direction", $this->direction); //Save both for full compatibility $this->namedtag->setString("Motive", $this->motive); } diff --git a/src/pocketmine/level/Explosion.php b/src/pocketmine/level/Explosion.php index a2f7684c61..4af9743650 100644 --- a/src/pocketmine/level/Explosion.php +++ b/src/pocketmine/level/Explosion.php @@ -100,7 +100,7 @@ class Explosion{ $currentChunk = null; $currentSubChunk = null; - $mRays = (int) ($this->rays - 1); + $mRays = $this->rays - 1; for($i = 0; $i < $this->rays; ++$i){ for($j = 0; $j < $this->rays; ++$j){ for($k = 0; $k < $this->rays; ++$k){ diff --git a/src/pocketmine/level/generator/Flat.php b/src/pocketmine/level/generator/Flat.php index ca05f74381..24c4888d38 100644 --- a/src/pocketmine/level/generator/Flat.php +++ b/src/pocketmine/level/generator/Flat.php @@ -134,9 +134,9 @@ class Flat extends Generator{ protected function parsePreset() : void{ $preset = explode(";", $this->preset); - $blocks = (string) ($preset[1] ?? ""); + $blocks = $preset[1] ?? ""; $this->biome = (int) ($preset[2] ?? 1); - $options = (string) ($preset[3] ?? ""); + $options = $preset[3] ?? ""; $this->structure = self::parseLayers($blocks); $this->floorLevel = count($this->structure); diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index f197ac3b7b..0e8831e6b3 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -535,7 +535,7 @@ class NetworkBinaryStream extends BinaryStream{ } public function getByteRotation() : float{ - return (float) ($this->getByte() * (360 / 256)); + return ($this->getByte() * (360 / 256)); } public function putByteRotation(float $rotation) : void{