mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Renamed old getID() calls to getId()
This commit is contained in:
@ -124,7 +124,7 @@ abstract class BaseInventory implements Inventory{
|
||||
$item = clone $item;
|
||||
if($index < 0 or $index >= $this->size){
|
||||
return false;
|
||||
}elseif($item->getID() === 0 or $item->getCount() <= 0){
|
||||
}elseif($item->getId() === 0 or $item->getCount() <= 0){
|
||||
return $this->clear($index, $source);
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ abstract class BaseInventory implements Inventory{
|
||||
|
||||
public function firstEmpty(){
|
||||
for($i = 0; $i < $this->size; ++$i){
|
||||
if($this->getItem($i)->getID() === Item::AIR){
|
||||
if($this->getItem($i)->getId() === Item::AIR){
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ abstract class BaseInventory implements Inventory{
|
||||
if(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){
|
||||
$item->setCount($item->getCount() - $diff);
|
||||
}
|
||||
}elseif($slot->getID() === Item::AIR){
|
||||
}elseif($slot->getId() === Item::AIR){
|
||||
$item->setCount($item->getCount() - $this->getMaxStackSize());
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
$item = $ev->getNewItem();
|
||||
}
|
||||
if($item->getID() !== Item::AIR){
|
||||
if($item->getId() !== Item::AIR){
|
||||
$this->slots[$index] = clone $item;
|
||||
}else{
|
||||
unset($this->slots[$index]);
|
||||
|
@ -291,9 +291,9 @@ class CraftingManager{
|
||||
}
|
||||
|
||||
public function sort(Item $i1, Item $i2){
|
||||
if($i1->getID() > $i2->getID()){
|
||||
if($i1->getId() > $i2->getId()){
|
||||
return 1;
|
||||
}elseif($i1->getID() < $i2->getID()){
|
||||
}elseif($i1->getId() < $i2->getId()){
|
||||
return -1;
|
||||
}elseif($i1->getDamage() > $i2->getDamage()){
|
||||
return 1;
|
||||
@ -329,10 +329,10 @@ class CraftingManager{
|
||||
* @return FurnaceRecipe
|
||||
*/
|
||||
public function matchFurnaceRecipe(Item $input){
|
||||
if(isset($this->furnaceRecipes[$input->getID() . ":" . $input->getDamage()])){
|
||||
return $this->furnaceRecipes[$input->getID() . ":" . $input->getDamage()];
|
||||
}elseif(isset($this->furnaceRecipes[$input->getID() . ":?"])){
|
||||
return $this->furnaceRecipes[$input->getID() . ":?"];
|
||||
if(isset($this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()])){
|
||||
return $this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()];
|
||||
}elseif(isset($this->furnaceRecipes[$input->getId() . ":?"])){
|
||||
return $this->furnaceRecipes[$input->getId() . ":?"];
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -355,9 +355,9 @@ class CraftingManager{
|
||||
$ingredients = $recipe->getIngredientList();
|
||||
usort($ingredients, [$this, "sort"]);
|
||||
foreach($ingredients as $item){
|
||||
$hash .= $item->getID() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ",";
|
||||
$hash .= $item->getId() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ",";
|
||||
}
|
||||
$this->recipeLookup[$result->getID() . ":" . $result->getDamage()][$hash] = $recipe;
|
||||
$this->recipeLookup[$result->getId() . ":" . $result->getDamage()][$hash] = $recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -365,7 +365,7 @@ class CraftingManager{
|
||||
*/
|
||||
public function registerFurnaceRecipe(FurnaceRecipe $recipe){
|
||||
$input = $recipe->getInput();
|
||||
$this->furnaceRecipes[$input->getID() . ":" . ($input->getDamage() === null ? "?" : $input->getDamage())] = $recipe;
|
||||
$this->furnaceRecipes[$input->getId() . ":" . ($input->getDamage() === null ? "?" : $input->getDamage())] = $recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -379,7 +379,7 @@ class CraftingManager{
|
||||
if(!($result instanceof Item)){
|
||||
return false;
|
||||
}
|
||||
$k = $result->getID() . ":" . $result->getDamage();
|
||||
$k = $result->getId() . ":" . $result->getDamage();
|
||||
|
||||
if(!isset($this->recipeLookup[$k])){
|
||||
return false;
|
||||
@ -390,7 +390,7 @@ class CraftingManager{
|
||||
$inputCount = 0;
|
||||
foreach($input as $item){
|
||||
$inputCount += $item->getCount();
|
||||
$hash .= $item->getID() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ",";
|
||||
$hash .= $item->getId() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ",";
|
||||
}
|
||||
if(!isset($this->recipeLookup[$k][$hash])){
|
||||
$hasRecipe = null;
|
||||
|
@ -68,8 +68,8 @@ class PlayerInventory extends BaseInventory{
|
||||
$item = $this->getItemInHand();
|
||||
|
||||
$pk = new PlayerEquipmentPacket();
|
||||
$pk->eid = $this->getHolder()->getID();
|
||||
$pk->item = $item->getID();
|
||||
$pk->eid = $this->getHolder()->getId();
|
||||
$pk->item = $item->getId();
|
||||
$pk->meta = $item->getDamage();
|
||||
$pk->slot = $this->getHeldItemIndex();
|
||||
|
||||
@ -128,8 +128,8 @@ class PlayerInventory extends BaseInventory{
|
||||
$item = $this->getItemInHand();
|
||||
|
||||
$pk = new PlayerEquipmentPacket();
|
||||
$pk->eid = $this->getHolder()->getID();
|
||||
$pk->item = $item->getID();
|
||||
$pk->eid = $this->getHolder()->getId();
|
||||
$pk->item = $item->getId();
|
||||
$pk->meta = $item->getDamage();
|
||||
$pk->slot = 0;
|
||||
$pk->isEncoded = true;
|
||||
@ -202,7 +202,7 @@ class PlayerInventory extends BaseInventory{
|
||||
public function setItem($index, Item $item, $source = null){
|
||||
if($index < 0 or $index >= $this->size){
|
||||
return false;
|
||||
}elseif($item->getID() === 0 or $item->getCount() <= 0){
|
||||
}elseif($item->getId() === 0 or $item->getCount() <= 0){
|
||||
return $this->clear($index, $source);
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ class PlayerInventory extends BaseInventory{
|
||||
}
|
||||
$item = $ev->getNewItem();
|
||||
}
|
||||
if($item->getID() !== Item::AIR){
|
||||
if($item->getId() !== Item::AIR){
|
||||
$this->slots[$index] = clone $item;
|
||||
}else{
|
||||
unset($this->slots[$index]);
|
||||
@ -308,15 +308,15 @@ class PlayerInventory extends BaseInventory{
|
||||
$slots = [];
|
||||
|
||||
foreach($armor as $i => $slot){
|
||||
if($slot->getID() === Item::AIR){
|
||||
if($slot->getId() === Item::AIR){
|
||||
$slots[$i] = 255;
|
||||
}else{
|
||||
$slots[$i] = $slot->getID();
|
||||
$slots[$i] = $slot->getId();
|
||||
}
|
||||
}
|
||||
|
||||
$pk = new PlayerArmorEquipmentPacket();
|
||||
$pk->eid = $this->getHolder()->getID();
|
||||
$pk->eid = $this->getHolder()->getId();
|
||||
$pk->slots = $slots;
|
||||
$pk->encode();
|
||||
$pk->isEncoded = true;
|
||||
@ -346,7 +346,7 @@ class PlayerInventory extends BaseInventory{
|
||||
$items[$i] = Item::get(Item::AIR, null, 0);
|
||||
}
|
||||
|
||||
if($items[$i]->getID() === Item::AIR){
|
||||
if($items[$i]->getId() === Item::AIR){
|
||||
$this->clear($this->getSize() + $i);
|
||||
}else{
|
||||
$this->setItem($this->getSize() + $i, $items[$i]);
|
||||
@ -369,15 +369,15 @@ class PlayerInventory extends BaseInventory{
|
||||
$slots = [];
|
||||
|
||||
foreach($armor as $i => $slot){
|
||||
if($slot->getID() === Item::AIR){
|
||||
if($slot->getId() === Item::AIR){
|
||||
$slots[$i] = 255;
|
||||
}else{
|
||||
$slots[$i] = $slot->getID();
|
||||
$slots[$i] = $slot->getId();
|
||||
}
|
||||
}
|
||||
|
||||
$pk = new PlayerArmorEquipmentPacket();
|
||||
$pk->eid = $this->getHolder()->getID();
|
||||
$pk->eid = $this->getHolder()->getId();
|
||||
$pk->slots = $slots;
|
||||
$pk->encode();
|
||||
$pk->isEncoded = true;
|
||||
|
@ -93,7 +93,7 @@ class SimpleTransactionGroup implements TransactionGroup{
|
||||
*/
|
||||
protected function matchItems(array &$needItems, array &$haveItems){
|
||||
foreach($this->transactions as $key => $ts){
|
||||
if($ts->getTargetItem()->getID() !== Item::AIR){
|
||||
if($ts->getTargetItem()->getId() !== Item::AIR){
|
||||
$needItems[] = $ts->getTargetItem();
|
||||
}
|
||||
$checkSourceItem = $ts->getInventory()->getItem($ts->getSlot());
|
||||
@ -101,7 +101,7 @@ class SimpleTransactionGroup implements TransactionGroup{
|
||||
if(!$checkSourceItem->equals($sourceItem, true) or $sourceItem->getCount() !== $checkSourceItem->getCount()){
|
||||
return false;
|
||||
}
|
||||
if($sourceItem->getID() !== Item::AIR){
|
||||
if($sourceItem->getId() !== Item::AIR){
|
||||
$haveItems[] = $sourceItem;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user