clicking on spawner with egg will change a mob there

This commit is contained in:
GameHerobrine 2023-12-02 14:05:37 +03:00
parent 60fd866de6
commit ea3babff02
7 changed files with 23 additions and 3 deletions

View file

@ -8,6 +8,18 @@ class SpawnEggItem extends Item{
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($target instanceof MonsterSpawnerBlock){
$tile = ServerAPI::request()->api->tile->get($target);
if($tile instanceof Tile){
$tile->data["EntityId"] = $this->meta;
//TODO update tile somehow
}else{
ConsoleAPI::warn("No tile was found at $target!");
}
return false;
}
$ageable = $this->meta === MOB_CHICKEN || $this->meta === MOB_COW || $this->meta === MOB_SHEEP || $this->meta === MOB_PIG;
$data = array(
"x" => $block->x + 0.5,