mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Merge branch 'stable' into minor-next
This commit is contained in:
@ -1097,19 +1097,22 @@ class World implements ChunkManager{
|
||||
$blockPosition = BlockPosition::fromVector3($b);
|
||||
|
||||
$tile = $this->getTileAt($b->x, $b->y, $b->z);
|
||||
if($tile instanceof Spawnable && count($fakeStateProperties = $tile->getRenderUpdateBugWorkaroundStateProperties($fullBlock)) > 0){
|
||||
$originalStateData = $blockTranslator->internalIdToNetworkStateData($fullBlock->getStateId());
|
||||
$fakeStateData = new BlockStateData(
|
||||
$originalStateData->getName(),
|
||||
array_merge($originalStateData->getStates(), $fakeStateProperties),
|
||||
$originalStateData->getVersion()
|
||||
);
|
||||
$packets[] = UpdateBlockPacket::create(
|
||||
$blockPosition,
|
||||
$blockTranslator->getBlockStateDictionary()->lookupStateIdFromData($fakeStateData) ?? throw new AssumptionFailedError("Unmapped fake blockstate data: " . $fakeStateData->toNbt()),
|
||||
UpdateBlockPacket::FLAG_NETWORK,
|
||||
UpdateBlockPacket::DATA_LAYER_NORMAL
|
||||
);
|
||||
if($tile instanceof Spawnable){
|
||||
$expectedClass = $fullBlock->getIdInfo()->getTileClass();
|
||||
if($expectedClass !== null && $tile instanceof $expectedClass && count($fakeStateProperties = $tile->getRenderUpdateBugWorkaroundStateProperties($fullBlock)) > 0){
|
||||
$originalStateData = $blockTranslator->internalIdToNetworkStateData($fullBlock->getStateId());
|
||||
$fakeStateData = new BlockStateData(
|
||||
$originalStateData->getName(),
|
||||
array_merge($originalStateData->getStates(), $fakeStateProperties),
|
||||
$originalStateData->getVersion()
|
||||
);
|
||||
$packets[] = UpdateBlockPacket::create(
|
||||
$blockPosition,
|
||||
$blockTranslator->getBlockStateDictionary()->lookupStateIdFromData($fakeStateData) ?? throw new AssumptionFailedError("Unmapped fake blockstate data: " . $fakeStateData->toNbt()),
|
||||
UpdateBlockPacket::FLAG_NETWORK,
|
||||
UpdateBlockPacket::DATA_LAYER_NORMAL
|
||||
);
|
||||
}
|
||||
}
|
||||
$packets[] = UpdateBlockPacket::create(
|
||||
$blockPosition,
|
||||
@ -2892,15 +2895,7 @@ class World implements ChunkManager{
|
||||
}elseif($this->getTile($tilePosition) !== null){
|
||||
$logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Another tile is already at that position");
|
||||
}else{
|
||||
$block = $this->getBlockAt($tilePosition->getFloorX(), $tilePosition->getFloorY(), $tilePosition->getFloorZ());
|
||||
$expectedClass = $block->getIdInfo()->getTileClass();
|
||||
if($expectedClass === null){
|
||||
$logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Block at that position (" . $block->getName() . ") does not expect a tile");
|
||||
}elseif(!($tile instanceof $expectedClass)){
|
||||
$logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Tile is of wrong type (expected $expectedClass but have " . get_class($tile) . ")");
|
||||
}else{
|
||||
$this->addTile($tile);
|
||||
}
|
||||
$this->addTile($tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user