mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Don't overwrite the input map with reindexed stuff
we might need this again?
This commit is contained in:
parent
38ec5da260
commit
6b0ac8adb8
@ -40,8 +40,6 @@ class CraftingTransaction extends InventoryTransaction{
|
|||||||
/** @var Item|null */
|
/** @var Item|null */
|
||||||
protected $primaryOutput;
|
protected $primaryOutput;
|
||||||
|
|
||||||
private $isReindexed = false;
|
|
||||||
|
|
||||||
/** @var CraftingRecipe|null */
|
/** @var CraftingRecipe|null */
|
||||||
protected $recipe = null;
|
protected $recipe = null;
|
||||||
|
|
||||||
@ -97,11 +95,7 @@ class CraftingTransaction extends InventoryTransaction{
|
|||||||
return $this->recipe;
|
return $this->recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function reindexInputs() : void{
|
private function reindexInputs() : array{
|
||||||
if($this->isReindexed){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$xOffset = $this->gridSize;
|
$xOffset = $this->gridSize;
|
||||||
$yOffset = $this->gridSize;
|
$yOffset = $this->gridSize;
|
||||||
|
|
||||||
@ -121,7 +115,7 @@ class CraftingTransaction extends InventoryTransaction{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($height === 0 or $width === 0){
|
if($height === 0 or $width === 0){
|
||||||
return;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$air = ItemFactory::get(Item::AIR, 0, 0);
|
$air = ItemFactory::get(Item::AIR, 0, 0);
|
||||||
@ -132,15 +126,13 @@ class CraftingTransaction extends InventoryTransaction{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->inputs = $reindexed;
|
return $reindexed;
|
||||||
|
|
||||||
$this->isReindexed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canExecute() : bool{
|
public function canExecute() : bool{
|
||||||
$this->reindexInputs();
|
$inputs = $this->reindexInputs();
|
||||||
|
|
||||||
$this->recipe = $this->source->getServer()->getCraftingManager()->matchRecipe($this->inputs, $this->primaryOutput, $this->secondaryOutputs);
|
$this->recipe = $this->source->getServer()->getCraftingManager()->matchRecipe($inputs, $this->primaryOutput, $this->secondaryOutputs);
|
||||||
|
|
||||||
return $this->recipe !== null and parent::canExecute();
|
return $this->recipe !== null and parent::canExecute();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user