NostalgiaCore/src/material/block/nonfull/CobwebBlock.php
2025-04-27 20:36:24 +08:00

32 lines
No EOL
628 B
PHP

<?php
class CobwebBlock extends FlowableBlock{
public static $blockID;
public function __construct(){
parent::__construct(COBWEB, 0, "Cobweb");
$this->isSolid = true;
$this->isFullBlock = false;
$this->hardness = 25;
}
public static function getAABB(Level $level, $x, $y, $z){
return null;
}
public function getDrops(Item $item, Player $player){
if ($item->isSword()){
return [
[STRING, 0, 1],
];
}
elseif ($item->isShears()){
return [
[COBWEB, 0, 1],
];
}
}
public static function onEntityCollidedWithBlock(Level $level, $x, $y, $z, Entity $entity){
$entity->setInWeb();
}
}