mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29: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
|
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){
|
if($item->getID() === $type and $item->getMetadata() === $damage){
|
||||||
$add = min($item->getMaxStackSize() - $item->count, $count);
|
$add = min($item->getMaxStackSize() - $item->count, $count);
|
||||||
|
|
||||||
if($add <= 0){
|
if($add <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -937,10 +938,10 @@ class Player{
|
||||||
if($count <= 0) return true;
|
if($count <= 0) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$toadd = BlockAPI::getItem($type, $damage, $count);
|
||||||
foreach($this->inventory as $s => $item){
|
foreach($this->inventory as $s => $item){
|
||||||
if($item->getID() === AIR){
|
if($item->getID() === AIR){
|
||||||
$add = min($item->getMaxStackSize(), $count);
|
$add = min($toadd->getMaxStackSize(), $count);
|
||||||
$this->inventory[$s] = BlockAPI::getItem($type, $damage, $add);
|
$this->inventory[$s] = BlockAPI::getItem($type, $damage, $add);
|
||||||
if($send) $this->sendInventorySlot($s);
|
if($send) $this->sendInventorySlot($s);
|
||||||
$count -= $add;
|
$count -= $add;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue