mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
fixed ability to give invalid stacked items
This commit is contained in:
parent
dd50ffa7af
commit
dc0fdbf4ae
1 changed files with 3 additions and 2 deletions
|
|
@ -927,6 +927,7 @@ class Player{
|
|||
foreach($this->inventory as $s => $item){ //force check the inventory for non-full stacks of this item first
|
||||
if($item->getID() === $type and $item->getMetadata() === $damage){
|
||||
$add = min($item->getMaxStackSize() - $item->count, $count);
|
||||
|
||||
if($add <= 0){
|
||||
continue;
|
||||
}
|
||||
|
|
@ -937,10 +938,10 @@ class Player{
|
|||
if($count <= 0) return true;
|
||||
}
|
||||
}
|
||||
|
||||
$toadd = BlockAPI::getItem($type, $damage, $count);
|
||||
foreach($this->inventory as $s => $item){
|
||||
if($item->getID() === AIR){
|
||||
$add = min($item->getMaxStackSize(), $count);
|
||||
$add = min($toadd->getMaxStackSize(), $count);
|
||||
$this->inventory[$s] = BlockAPI::getItem($type, $damage, $add);
|
||||
if($send) $this->sendInventorySlot($s);
|
||||
$count -= $add;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue