mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
feat: Implement Brewing (#4413)
The following API constants have been added: - tile\BrewingStand::BREW_TIME_TICKS The following public API methods have been added: - utils\BrewingStandSlot->getSlotNumber() : int - CraftingManager->getPotionTypeRecipes() : array<string, array<string, PotionTypeRecipe>> - CraftingManager->getPotionContainerChangeRecipes() : array<int, array<string, PotionContainerChangeRecipe>> - CraftingManager->registerPotionTypeRecipe(PotionTypeRecipe $recipe) : void - CraftingManager->registerPotionContainerChangeRecipe(PotionContainerChangeRecipe $recipe) : void The following classes have been added: - BrewingRecipe - PotionTypeRecipe - PotionContainerChangeRecipe - BrewItemEvent - BrewingFuelUseEvent - PotionFinishBrewingSound
This commit is contained in:
@ -125,6 +125,24 @@ class BrewingStand extends Transparent{
|
||||
}
|
||||
|
||||
public function onScheduledUpdate() : void{
|
||||
//TODO
|
||||
$brewing = $this->position->getWorld()->getTile($this->position);
|
||||
if($brewing instanceof TileBrewingStand){
|
||||
if($brewing->onUpdate()){
|
||||
$this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, 1);
|
||||
}
|
||||
|
||||
$changed = false;
|
||||
foreach(BrewingStandSlot::getAll() as $slot){
|
||||
$occupied = !$brewing->getInventory()->isSlotEmpty($slot->getSlotNumber());
|
||||
if($occupied !== $this->hasSlot($slot)){
|
||||
$this->setSlot($slot, $occupied);
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($changed){
|
||||
$this->position->getWorld()->setBlock($this->position, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user