diff --git a/src/data/bedrock/blockstate/BlockStateDeserializer.php b/src/data/bedrock/blockstate/BlockStateDeserializer.php index 38f8f5070..e1ce89d79 100644 --- a/src/data/bedrock/blockstate/BlockStateDeserializer.php +++ b/src/data/bedrock/blockstate/BlockStateDeserializer.php @@ -151,8 +151,8 @@ final class BlockStateDeserializer{ $this->map(Ids::BREWING_STAND, function(BlockStateReader $in) : Block{ return VanillaBlocks::BREWING_STAND() ->setSlot(BrewingStandSlot::EAST(), $in->readBool(BlockStateNames::BREWING_STAND_SLOT_A_BIT)) - ->setSlot(BrewingStandSlot::NORTHWEST(), $in->readBool(BlockStateNames::BREWING_STAND_SLOT_B_BIT)) - ->setSlot(BrewingStandSlot::SOUTHWEST(), $in->readBool(BlockStateNames::BREWING_STAND_SLOT_C_BIT)); + ->setSlot(BrewingStandSlot::SOUTHWEST(), $in->readBool(BlockStateNames::BREWING_STAND_SLOT_B_BIT)) + ->setSlot(BrewingStandSlot::NORTHWEST(), $in->readBool(BlockStateNames::BREWING_STAND_SLOT_C_BIT)); }); $this->map(Ids::BRICK_BLOCK, fn() => VanillaBlocks::BRICKS()); $this->map(Ids::BRICK_STAIRS, fn(BlockStateReader $in) => Helper::decodeStairs(VanillaBlocks::BRICK_STAIRS(), $in)); @@ -184,7 +184,7 @@ final class BlockStateDeserializer{ StringValues::CHEMISTRY_TABLE_TYPE_LAB_TABLE => VanillaBlocks::LAB_TABLE(), StringValues::CHEMISTRY_TABLE_TYPE_MATERIAL_REDUCER => VanillaBlocks::MATERIAL_REDUCER(), default => throw $in->badValueException(BlockStateNames::CHEMISTRY_TABLE_TYPE, $type), - })->setFacing($in->readLegacyHorizontalFacing()); + })->setFacing(Facing::opposite($in->readLegacyHorizontalFacing())); }); $this->map(Ids::CHEST, function(BlockStateReader $in) : Block{ return VanillaBlocks::CHEST() @@ -198,7 +198,7 @@ final class BlockStateDeserializer{ $this->map(Ids::COCOA, function(BlockStateReader $in) : Block{ return VanillaBlocks::COCOA_POD() ->setAge($in->readBoundedInt(BlockStateNames::AGE, 0, 2)) - ->setFacing($in->readLegacyHorizontalFacing()); + ->setFacing(Facing::opposite($in->readLegacyHorizontalFacing())); }); $this->map(Ids::COLORED_TORCH_BP, function(BlockStateReader $in) : Block{ return $in->readBool(BlockStateNames::COLOR_BIT) ? diff --git a/src/data/bedrock/blockstate/BlockStateReader.php b/src/data/bedrock/blockstate/BlockStateReader.php index 6d2eeb929..992a34b82 100644 --- a/src/data/bedrock/blockstate/BlockStateReader.php +++ b/src/data/bedrock/blockstate/BlockStateReader.php @@ -123,7 +123,7 @@ final class BlockStateReader{ /** @throws BlockStateDeserializeException */ public function readEndRodFacingDirection() : int{ $result = $this->readFacingDirection(); - return Facing::axis($result) === Axis::Y ? Facing::opposite($result) : $result; + return Facing::axis($result) !== Axis::Y ? Facing::opposite($result) : $result; } /** @throws BlockStateDeserializeException */ diff --git a/src/data/bedrock/blockstate/BlockStateSerializer.php b/src/data/bedrock/blockstate/BlockStateSerializer.php index 8c705ca2f..f4a680460 100644 --- a/src/data/bedrock/blockstate/BlockStateSerializer.php +++ b/src/data/bedrock/blockstate/BlockStateSerializer.php @@ -327,8 +327,8 @@ final class BlockStateSerializer{ $this->map(VanillaBlocks::BREWING_STAND(), function(BrewingStand $block) : Writer{ return Writer::create(Ids::BREWING_STAND) ->writeBool(BlockStateNames::BREWING_STAND_SLOT_A_BIT, $block->hasSlot(BrewingStandSlot::EAST())) - ->writeBool(BlockStateNames::BREWING_STAND_SLOT_B_BIT, $block->hasSlot(BrewingStandSlot::NORTHWEST())) - ->writeBool(BlockStateNames::BREWING_STAND_SLOT_C_BIT, $block->hasSlot(BrewingStandSlot::SOUTHWEST())); + ->writeBool(BlockStateNames::BREWING_STAND_SLOT_B_BIT, $block->hasSlot(BrewingStandSlot::SOUTHWEST())) + ->writeBool(BlockStateNames::BREWING_STAND_SLOT_C_BIT, $block->hasSlot(BrewingStandSlot::NORTHWEST())); }); $this->map(VanillaBlocks::BRICKS(), fn() => new Writer(Ids::BRICK_BLOCK)); $this->map(VanillaBlocks::BRICK_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab1($block, StringValues::STONE_SLAB_TYPE_BRICK)); @@ -374,7 +374,7 @@ final class BlockStateSerializer{ $this->map(VanillaBlocks::COCOA_POD(), function(CocoaBlock $block) : Writer{ return Writer::create(Ids::COCOA) ->writeInt(BlockStateNames::AGE, $block->getAge()) - ->writeLegacyHorizontalFacing($block->getFacing()); + ->writeLegacyHorizontalFacing(Facing::opposite($block->getFacing())); }); $this->map(VanillaBlocks::COMPOUND_CREATOR(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, StringValues::CHEMISTRY_TABLE_TYPE_COMPOUND_CREATOR, new Writer(Ids::CHEMISTRY_TABLE))); $this->map(VanillaBlocks::CONCRETE(), function(Concrete $block) : Writer{ diff --git a/src/data/bedrock/blockstate/BlockStateSerializerHelper.php b/src/data/bedrock/blockstate/BlockStateSerializerHelper.php index e4a1ffaf3..81d6bedbb 100644 --- a/src/data/bedrock/blockstate/BlockStateSerializerHelper.php +++ b/src/data/bedrock/blockstate/BlockStateSerializerHelper.php @@ -70,7 +70,7 @@ final class BlockStateSerializerHelper{ public static function encodeChemistryTable(ChemistryTable $block, string $chemistryTableType, BlockStateWriter $out) : BlockStateWriter{ return $out ->writeString(BlockStateNames::CHEMISTRY_TABLE_TYPE, $chemistryTableType) - ->writeLegacyHorizontalFacing($block->getFacing()); + ->writeLegacyHorizontalFacing(Facing::opposite($block->getFacing())); } public static function encodeCrops(Crops $block, BlockStateWriter $out) : BlockStateWriter{ diff --git a/src/data/bedrock/blockstate/BlockStateWriter.php b/src/data/bedrock/blockstate/BlockStateWriter.php index ef726c0a5..a3db88c33 100644 --- a/src/data/bedrock/blockstate/BlockStateWriter.php +++ b/src/data/bedrock/blockstate/BlockStateWriter.php @@ -81,8 +81,8 @@ final class BlockStateWriter{ /** @return $this */ public function writeEndRodFacingDirection(int $value) : self{ - //end rods are stupid in bedrock and have up/down the wrong way round - return $this->writeFacingDirection(Facing::axis($value) === Axis::Y ? Facing::opposite($value) : $value); + //end rods are stupid in bedrock and have everything except up/down the wrong way round + return $this->writeFacingDirection(Facing::axis($value) !== Axis::Y ? Facing::opposite($value) : $value); } /** @return $this */