fixed more stupid bullshit

This commit is contained in:
Dylan K. Taylor 2022-02-01 20:00:50 +00:00
parent 101b71ed02
commit 6644fd472c
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
5 changed files with 11 additions and 11 deletions

View File

@ -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) ?

View File

@ -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 */

View File

@ -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{

View File

@ -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{

View File

@ -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 */