Torch facings are the wrong way round :(

This commit is contained in:
Dylan K. Taylor 2022-02-01 17:12:12 +00:00
parent ccfe485c06
commit 4d935aa8b6
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 10 additions and 8 deletions

View File

@ -241,13 +241,14 @@ final class BlockStateReader{
* @throws BlockStateDeserializeException * @throws BlockStateDeserializeException
*/ */
public function readTorchFacing() : int{ public function readTorchFacing() : int{
//TODO: horizontal directions are flipped (MCPE bug: https://bugs.mojang.com/browse/MCPE-152036)
return match($rawValue = $this->readString(BlockStateNames::TORCH_FACING_DIRECTION)){ return match($rawValue = $this->readString(BlockStateNames::TORCH_FACING_DIRECTION)){
StringValues::TORCH_FACING_DIRECTION_EAST => Facing::EAST, StringValues::TORCH_FACING_DIRECTION_EAST => Facing::WEST,
StringValues::TORCH_FACING_DIRECTION_NORTH => Facing::NORTH, StringValues::TORCH_FACING_DIRECTION_NORTH => Facing::SOUTH,
StringValues::TORCH_FACING_DIRECTION_SOUTH => Facing::SOUTH, StringValues::TORCH_FACING_DIRECTION_SOUTH => Facing::NORTH,
StringValues::TORCH_FACING_DIRECTION_TOP => Facing::UP, StringValues::TORCH_FACING_DIRECTION_TOP => Facing::UP,
StringValues::TORCH_FACING_DIRECTION_UNKNOWN => Facing::UP, //should be illegal, but 1.13 allows it StringValues::TORCH_FACING_DIRECTION_UNKNOWN => Facing::UP, //should be illegal, but 1.13 allows it
StringValues::TORCH_FACING_DIRECTION_WEST => Facing::WEST, StringValues::TORCH_FACING_DIRECTION_WEST => Facing::EAST,
default => throw $this->badValueException(BlockStateNames::TORCH_FACING_DIRECTION, $rawValue, "Invalid torch facing"), default => throw $this->badValueException(BlockStateNames::TORCH_FACING_DIRECTION, $rawValue, "Invalid torch facing"),
}; };
} }

View File

@ -195,12 +195,13 @@ final class BlockStateWriter{
/** @return $this */ /** @return $this */
public function writeTorchFacing(int $facing) : self{ public function writeTorchFacing(int $facing) : self{
//TODO: horizontal directions are flipped (MCPE bug: https://bugs.mojang.com/browse/MCPE-152036)
$this->writeString(BlockStateNames::TORCH_FACING_DIRECTION, match($facing){ $this->writeString(BlockStateNames::TORCH_FACING_DIRECTION, match($facing){
Facing::UP => StringValues::TORCH_FACING_DIRECTION_TOP, Facing::UP => StringValues::TORCH_FACING_DIRECTION_TOP,
Facing::NORTH => StringValues::TORCH_FACING_DIRECTION_NORTH, Facing::SOUTH => StringValues::TORCH_FACING_DIRECTION_NORTH,
Facing::SOUTH => StringValues::TORCH_FACING_DIRECTION_SOUTH, Facing::NORTH => StringValues::TORCH_FACING_DIRECTION_SOUTH,
Facing::WEST => StringValues::TORCH_FACING_DIRECTION_WEST, Facing::EAST => StringValues::TORCH_FACING_DIRECTION_WEST,
Facing::EAST => StringValues::TORCH_FACING_DIRECTION_EAST, Facing::WEST => StringValues::TORCH_FACING_DIRECTION_EAST,
default => throw new BlockStateSerializeException("Invalid Torch facing $facing") default => throw new BlockStateSerializeException("Invalid Torch facing $facing")
}); });
return $this; return $this;