mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 11:18:52 +00:00
Fixed end rod up/down state
This commit is contained in:
parent
1a800cf4df
commit
ccfe485c06
@ -430,7 +430,7 @@ final class BlockStateDeserializer{
|
||||
});
|
||||
$this->map(Ids::END_ROD, function(BlockStateReader $in) : Block{
|
||||
return VanillaBlocks::END_ROD()
|
||||
->setFacing($in->readFacingDirection());
|
||||
->setFacing($in->readEndRodFacingDirection());
|
||||
});
|
||||
$this->map(Ids::END_STONE, fn() => VanillaBlocks::END_STONE());
|
||||
$this->map(Ids::ENDER_CHEST, function(BlockStateReader $in) : Block{
|
||||
|
@ -125,6 +125,12 @@ final class BlockStateReader{
|
||||
]);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readEndRodFacingDirection() : int{
|
||||
$result = $this->readFacingDirection();
|
||||
return Facing::axis($result) === Axis::Y ? Facing::opposite($result) : $result;
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readHorizontalFacing() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::FACING_DIRECTION), [
|
||||
|
@ -595,9 +595,8 @@ final class BlockStateSerializer{
|
||||
->writeLegacyHorizontalFacing($block->getFacing());
|
||||
});
|
||||
$this->map(VanillaBlocks::END_ROD(), function(EndRod $block) : Writer{
|
||||
//TODO: not sure if this needs down/up to be flipped like legacy metadata?
|
||||
return Writer::create(Ids::END_ROD)
|
||||
->writeFacingDirection($block->getFacing());
|
||||
->writeEndRodFacingDirection($block->getFacing());
|
||||
});
|
||||
$this->map(VanillaBlocks::END_STONE(), fn() => new Writer(Ids::END_STONE));
|
||||
$this->map(VanillaBlocks::END_STONE_BRICKS(), fn() => new Writer(Ids::END_BRICKS));
|
||||
|
@ -79,6 +79,12 @@ final class BlockStateWriter{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @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);
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeHorizontalFacing(int $value) : self{
|
||||
if($value === Facing::UP || $value === Facing::DOWN){
|
||||
|
Loading…
x
Reference in New Issue
Block a user