BaseBanner: fixed incorrect support requirements

This commit is contained in:
Dylan K. Taylor 2023-01-12 21:31:50 +00:00
parent a79be994de
commit b25e8e26f0
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -112,7 +112,14 @@ abstract class BaseBanner extends Transparent{
return SupportType::NONE(); return SupportType::NONE();
} }
private function canBeSupportedBy(Block $block) : bool{
return $block->isSolid();
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if(!$this->canBeSupportedBy($blockReplace->getSide($this->getSupportingFace()))){
return false;
}
if($item instanceof ItemBanner){ if($item instanceof ItemBanner){
$this->color = $item->getColor(); $this->color = $item->getColor();
$this->setPatterns($item->getPatterns()); $this->setPatterns($item->getPatterns());
@ -124,7 +131,7 @@ abstract class BaseBanner extends Transparent{
abstract protected function getSupportingFace() : int; abstract protected function getSupportingFace() : int;
public function onNearbyBlockChange() : void{ public function onNearbyBlockChange() : void{
if($this->getSide($this->getSupportingFace())->getId() === BlockLegacyIds::AIR){ if(!$this->canBeSupportedBy($this->getSide($this->getSupportingFace()))){
$this->position->getWorld()->useBreakOn($this->position); $this->position->getWorld()->useBreakOn($this->position);
} }
} }