Removed useless confusing array indices in CompoundTag constructors (#1116)

This commit is contained in:
Dylan K. Taylor
2017-06-20 12:11:24 +01:00
committed by GitHub
parent e11f1e94e9
commit a4b8dd43e6
14 changed files with 111 additions and 112 deletions

View File

@ -2532,17 +2532,17 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
if($item->getId() === Item::SNOWBALL){
$nbt = new CompoundTag("", [
"Pos" => new ListTag("Pos", [
new ListTag("Pos", [
new DoubleTag("", $this->x),
new DoubleTag("", $this->y + $this->getEyeHeight()),
new DoubleTag("", $this->z)
]),
"Motion" => new ListTag("Motion", [
new ListTag("Motion", [
new DoubleTag("", $aimPos->x),
new DoubleTag("", $aimPos->y),
new DoubleTag("", $aimPos->z)
]),
"Rotation" => new ListTag("Rotation", [
new ListTag("Rotation", [
new FloatTag("", $this->yaw),
new FloatTag("", $this->pitch)
]),
@ -2627,22 +2627,22 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
}
$nbt = new CompoundTag("", [
"Pos" => new ListTag("Pos", [
new ListTag("Pos", [
new DoubleTag("", $this->x),
new DoubleTag("", $this->y + $this->getEyeHeight()),
new DoubleTag("", $this->z)
]),
"Motion" => new ListTag("Motion", [
new ListTag("Motion", [
new DoubleTag("", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),
new DoubleTag("", -sin($this->pitch / 180 * M_PI)),
new DoubleTag("", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))
]),
"Rotation" => new ListTag("Rotation", [
new ListTag("Rotation", [
//yaw/pitch for arrows taken crosswise, not along the arrow shaft.
new FloatTag("", ($this->yaw > 180 ? 360 : 0) - $this->yaw), //arrow yaw must range from -180 to +180
new FloatTag("", -$this->pitch)
]),
"Fire" => new ShortTag("Fire", $this->isOnFire() ? 45 * 60 : 0)
new ShortTag("Fire", $this->isOnFire() ? 45 * 60 : 0)
]);
$diff = ($this->server->getTick() - $this->startAction);