mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
clicking on spawner with egg will change a mob there
This commit is contained in:
parent
60fd866de6
commit
ea3babff02
7 changed files with 23 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue