Renamed old getID() calls to getId()

This commit is contained in:
Shoghi Cervantes 2014-12-07 15:21:32 +01:00
parent f0d6128282
commit a98da3bab1
64 changed files with 228 additions and 228 deletions

View File

@ -1050,7 +1050,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
protected function getCreativeBlock(Item $item){ protected function getCreativeBlock(Item $item){
foreach(Block::$creative as $i => $d){ foreach(Block::$creative as $i => $d){
if($d[0] === $item->getID() and $d[1] === $item->getDamage()){ if($d[0] === $item->getId() and $d[1] === $item->getDamage()){
return $i; return $i;
} }
} }
@ -1241,11 +1241,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk = new TakeItemEntityPacket(); $pk = new TakeItemEntityPacket();
$pk->eid = 0; $pk->eid = 0;
$pk->target = $entity->getID(); $pk->target = $entity->getId();
$this->dataPacket($pk); $this->dataPacket($pk);
$pk = new TakeItemEntityPacket(); $pk = new TakeItemEntityPacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->target = $entity->getID(); $pk->target = $entity->getId();
Server::broadcastPacket($entity->getViewers(), $pk); Server::broadcastPacket($entity->getViewers(), $pk);
$this->inventory->addItem(clone $item, $this); $this->inventory->addItem(clone $item, $this);
$entity->kill(); $entity->kill();
@ -1264,7 +1264,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
continue; continue;
} }
switch($item->getID()){ switch($item->getId()){
case Item::WOOD: case Item::WOOD:
$this->awardAchievement("mineWood"); $this->awardAchievement("mineWood");
break; break;
@ -1275,11 +1275,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk = new TakeItemEntityPacket(); $pk = new TakeItemEntityPacket();
$pk->eid = 0; $pk->eid = 0;
$pk->target = $entity->getID(); $pk->target = $entity->getId();
$this->dataPacket($pk); $this->dataPacket($pk);
$pk = new TakeItemEntityPacket(); $pk = new TakeItemEntityPacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->target = $entity->getID(); $pk->target = $entity->getId();
Server::broadcastPacket($entity->getViewers(), $pk); Server::broadcastPacket($entity->getViewers(), $pk);
$this->inventory->addItem(clone $item, $this); $this->inventory->addItem(clone $item, $this);
$entity->kill(); $entity->kill();
@ -1592,7 +1592,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
}else{ }else{
$this->inventory->setHeldItemSlot($packet->slot); //set Air $this->inventory->setHeldItemSlot($packet->slot); //set Air
} }
}elseif(!isset($item) or $slot === -1 or $item->getID() !== $packet->item or $item->getDamage() !== $packet->meta){ // packet error or not implemented }elseif(!isset($item) or $slot === -1 or $item->getId() !== $packet->item or $item->getDamage() !== $packet->meta){ // packet error or not implemented
$this->inventory->sendContents($this); $this->inventory->sendContents($this);
break; break;
}elseif($this->isCreative()){ }elseif($this->isCreative()){
@ -1637,7 +1637,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
if($this->level->useItemOn($blockVector, $item, $packet->face, $packet->fx, $packet->fy, $packet->fz, $this) === true){ if($this->level->useItemOn($blockVector, $item, $packet->face, $packet->fx, $packet->fy, $packet->fz, $this) === true){
break; break;
} }
}elseif($this->inventory->getItemInHand()->getID() !== $packet->item or (($damage = $this->inventory->getItemInHand()->getDamage()) !== $packet->meta and $damage !== null)){ }elseif($this->inventory->getItemInHand()->getId() !== $packet->item or (($damage = $this->inventory->getItemInHand()->getDamage()) !== $packet->meta and $damage !== null)){
$this->inventory->sendHeldItem($this); $this->inventory->sendHeldItem($this);
}else{ }else{
$item = $this->inventory->getItemInHand(); $item = $this->inventory->getItemInHand();
@ -1658,7 +1658,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->x = $target->x; $pk->x = $target->x;
$pk->y = $target->y; $pk->y = $target->y;
$pk->z = $target->z; $pk->z = $target->z;
$pk->block = $target->getID(); $pk->block = $target->getId();
$pk->meta = $target->getDamage(); $pk->meta = $target->getDamage();
$this->dataPacket($pk); $this->dataPacket($pk);
@ -1666,14 +1666,14 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->x = $block->x; $pk->x = $block->x;
$pk->y = $block->y; $pk->y = $block->y;
$pk->z = $block->z; $pk->z = $block->z;
$pk->block = $block->getID(); $pk->block = $block->getId();
$pk->meta = $block->getDamage(); $pk->meta = $block->getDamage();
$this->dataPacket($pk); $this->dataPacket($pk);
break; break;
}elseif($packet->face === 0xff){ }elseif($packet->face === 0xff){
if($this->isCreative()){ if($this->isCreative()){
$item = $this->inventory->getItemInHand(); $item = $this->inventory->getItemInHand();
}elseif($this->inventory->getItemInHand()->getID() !== $packet->item or (($damage = $this->inventory->getItemInHand()->getDamage()) !== $packet->meta and $damage !== null)){ }elseif($this->inventory->getItemInHand()->getId() !== $packet->item or (($damage = $this->inventory->getItemInHand()->getDamage()) !== $packet->meta and $damage !== null)){
$this->inventory->sendHeldItem($this); $this->inventory->sendHeldItem($this);
break; break;
}else{ }else{
@ -1690,7 +1690,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
} }
if($item->getID() === Item::SNOWBALL){ if($item->getId() === Item::SNOWBALL){
$nbt = new Compound("", [ $nbt = new Compound("", [
"Pos" => new Enum("Pos", [ "Pos" => new Enum("Pos", [
new Double("", $this->x), new Double("", $this->x),
@ -1740,7 +1740,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
switch($packet->action){ switch($packet->action){
case 5: //Shot arrow case 5: //Shot arrow
if($this->inventory->getItemInHand()->getID() === Item::BOW){ if($this->inventory->getItemInHand()->getId() === Item::BOW){
$bow = $this->inventory->getItemInHand(); $bow = $this->inventory->getItemInHand();
if($this->isSurvival()){ if($this->isSurvival()){
if(!$this->inventory->contains(Item::get(Item::ARROW, 0, 1))){ if(!$this->inventory->contains(Item::get(Item::ARROW, 0, 1))){
@ -1841,7 +1841,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->x = $target->x; $pk->x = $target->x;
$pk->y = $target->y; $pk->y = $target->y;
$pk->z = $target->z; $pk->z = $target->z;
$pk->block = $target->getID(); $pk->block = $target->getId();
$pk->meta = $target->getDamage(); $pk->meta = $target->getDamage();
$this->dataPacket($pk); $this->dataPacket($pk);
@ -1907,7 +1907,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
]; ];
$damage = [ $damage = [
EntityDamageEvent::MODIFIER_BASE => isset($damageTable[$item->getID()]) ? $damageTable[$item->getID()] : 1, EntityDamageEvent::MODIFIER_BASE => isset($damageTable[$item->getId()]) ? $damageTable[$item->getId()] : 1,
]; ];
if($this->distance($target) > 8){ if($this->distance($target) > 8){
@ -1943,8 +1943,8 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
]; ];
$points = 0; $points = 0;
foreach($target->getInventory()->getArmorContents() as $index => $i){ foreach($target->getInventory()->getArmorContents() as $index => $i){
if(isset($armorValues[$i->getID()])){ if(isset($armorValues[$i->getId()])){
$points += $armorValues[$i->getID()]; $points += $armorValues[$i->getId()];
} }
} }
@ -1987,7 +1987,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
$pk = new AnimatePacket(); $pk = new AnimatePacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->action = $ev->getAnimationType(); $pk->action = $ev->getAnimationType();
Server::broadcastPacket($this->getViewers(), $pk); Server::broadcastPacket($this->getViewers(), $pk);
break; break;
@ -2053,7 +2053,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
//Item::RAW_FISH => 2, //Item::RAW_FISH => 2,
]; ];
$slot = $this->inventory->getItemInHand(); $slot = $this->inventory->getItemInHand();
if($this->getHealth() < 20 and isset($items[$slot->getID()])){ if($this->getHealth() < 20 and isset($items[$slot->getId()])){
$this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $slot)); $this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $slot));
if($ev->isCancelled()){ if($ev->isCancelled()){
$this->inventory->sendContents($this); $this->inventory->sendContents($this);
@ -2064,10 +2064,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->eid = 0; $pk->eid = 0;
$pk->event = 9; $pk->event = 9;
$this->dataPacket($pk); $this->dataPacket($pk);
$pk->eid = $this->getID(); $pk->eid = $this->getId();
Server::broadcastPacket($this->getViewers(), $pk); Server::broadcastPacket($this->getViewers(), $pk);
$amount = $items[$slot->getID()]; $amount = $items[$slot->getId()];
$this->server->getPluginManager()->callEvent($ev = new EntityRegainHealthEvent($this, $amount, EntityRegainHealthEvent::CAUSE_EATING)); $this->server->getPluginManager()->callEvent($ev = new EntityRegainHealthEvent($this, $amount, EntityRegainHealthEvent::CAUSE_EATING));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$this->heal($ev->getAmount(), $ev); $this->heal($ev->getAmount(), $ev);
@ -2075,7 +2075,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
--$slot->count; --$slot->count;
$this->inventory->setItemInHand($slot, $this); $this->inventory->setItemInHand($slot, $this);
if($slot->getID() === Item::MUSHROOM_STEW or $slot->getID() === Item::BEETROOT_SOUP){ if($slot->getId() === Item::MUSHROOM_STEW or $slot->getId() === Item::BEETROOT_SOUP){
$this->inventory->addItem(Item::get(Item::BOWL, 0, 1), $this); $this->inventory->addItem(Item::get(Item::BOWL, 0, 1), $this);
} }
} }
@ -2206,7 +2206,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$inv = $ts->getInventory(); $inv = $ts->getInventory();
if($inv instanceof FurnaceInventory){ if($inv instanceof FurnaceInventory){
if($ts->getSlot() === 2){ if($ts->getSlot() === 2){
switch($inv->getResult()->getID()){ switch($inv->getResult()->getId()){
case Item::IRON_INGOT: case Item::IRON_INGOT:
$this->awardAchievement("acquireIron"); $this->awardAchievement("acquireIron");
break; break;
@ -2227,7 +2227,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
if($craftingGroup->execute()){ if($craftingGroup->execute()){
switch($craftingGroup->getResult()->getID()){ switch($craftingGroup->getResult()->getId()){
case Item::WORKBENCH: case Item::WORKBENCH:
$this->awardAchievement("buildWorkBench"); $this->awardAchievement("buildWorkBench");
break; break;

View File

@ -944,7 +944,7 @@ class Server{
*/ */
public function unloadLevel(Level $level, $forceUnload = false){ public function unloadLevel(Level $level, $forceUnload = false){
if($level->unload($forceUnload) === true){ if($level->unload($forceUnload) === true){
unset($this->levels[$level->getID()]); unset($this->levels[$level->getId()]);
return true; return true;
} }
@ -995,7 +995,7 @@ class Server{
return false; return false;
} }
$this->levels[$level->getID()] = $level; $this->levels[$level->getId()] = $level;
$level->initLevel(); $level->initLevel();
@ -1130,7 +1130,7 @@ class Server{
$provider::generate($path, $name, $seed, $generator, $options); $provider::generate($path, $name, $seed, $generator, $options);
$level = new Level($this, $name, $path, $provider); $level = new Level($this, $name, $path, $provider);
$this->levels[$level->getID()] = $level; $this->levels[$level->getId()] = $level;
$level->initLevel(); $level->initLevel();

View File

@ -79,13 +79,13 @@ class Bed extends Transparent{
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
$b = $this; $b = $this;
}else{ //Bottom Part of Bed }else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){ if($blockNorth->getId() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$b = $blockNorth; $b = $blockNorth;
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){ }elseif($blockSouth->getId() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$b = $blockSouth; $b = $blockSouth;
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){ }elseif($blockEast->getId() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$b = $blockEast; $b = $blockEast;
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){ }elseif($blockWest->getId() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$b = $blockWest; $b = $blockWest;
}else{ }else{
if($player instanceof Player){ if($player instanceof Player){
@ -138,23 +138,23 @@ class Bed extends Transparent{
$blockWest = $this->getSide(4); $blockWest = $this->getSide(4);
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
if($blockNorth->getID() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right if($blockNorth->getId() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right
$this->getLevel()->setBlock($blockNorth, new Air(), true, true); $this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){ }elseif($blockSouth->getId() === $this->id and $blockSouth->meta !== 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true); $this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){ }elseif($blockEast->getId() === $this->id and $blockEast->meta !== 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, true); $this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){ }elseif($blockWest->getId() === $this->id and $blockWest->meta !== 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, true); $this->getLevel()->setBlock($blockWest, new Air(), true, true);
} }
}else{ //Bottom Part of Bed }else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){ if($blockNorth->getId() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockNorth, new Air(), true, true); $this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){ }elseif($blockSouth->getId() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true); $this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){ }elseif($blockEast->getId() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, true); $this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){ }elseif($blockWest->getId() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, true); $this->getLevel()->setBlock($blockWest, new Air(), true, true);
} }
} }

View File

@ -72,7 +72,7 @@ class Cactus extends Transparent{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){ if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
}else{ }else{
for($side = 2; $side <= 5; ++$side){ for($side = 2; $side <= 5; ++$side){
@ -83,11 +83,11 @@ class Cactus extends Transparent{
} }
} }
}elseif($type === Level::BLOCK_UPDATE_RANDOM){ }elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::CACTUS){ if($this->getSide(0)->getId() !== self::CACTUS){
if($this->meta == 0x0F){ if($this->meta == 0x0F){
for($y = 1; $y < 3; ++$y){ for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); $b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === self::AIR){ if($b->getId() === self::AIR){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Cactus())); Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Cactus()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$this->getLevel()->setBlock($b, $ev->getNewState(), true); $this->getLevel()->setBlock($b, $ev->getNewState(), true);
@ -108,7 +108,7 @@ class Cactus extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::SAND or $down->getID() === self::CACTUS){ if($down->getId() === self::SAND or $down->getId() === self::CACTUS){
$block0 = $this->getSide(2); $block0 = $this->getSide(2);
$block1 = $this->getSide(3); $block1 = $this->getSide(3);
$block2 = $this->getSide(4); $block2 = $this->getSide(4);

View File

@ -64,7 +64,7 @@ class Cake extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() !== self::AIR){ if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;
@ -75,7 +75,7 @@ class Cake extends Transparent{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true); $this->getLevel()->setBlock($this, new Air(), true);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -74,7 +74,7 @@ class Carpet extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() !== self::AIR){ if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;
@ -85,7 +85,7 @@ class Carpet extends Flowable{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ if($this->getSide(0)->getId() === self::AIR){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -35,7 +35,7 @@ abstract class Crops extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::FARMLAND){ if($down->getId() === self::FARMLAND){
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;
@ -46,7 +46,7 @@ abstract class Crops extends Flowable{
public function onActivate(Item $item, Player $player = null){ public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$block = clone $this; $block = clone $this;
$block->meta += mt_rand(2, 5); $block->meta += mt_rand(2, 5);
if($block->meta > 7){ if($block->meta > 7){

View File

@ -40,7 +40,7 @@ class Dandelion extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){ if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;

View File

@ -205,7 +205,7 @@ abstract class Door extends Transparent{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false); $this->getLevel()->setBlock($this, new Air(), false);
if($this->getSide(1) instanceof Door){ if($this->getSide(1) instanceof Door){
$this->getLevel()->setBlock($this->getSide(1), new Air(), false); $this->getLevel()->setBlock($this->getSide(1), new Air(), false);
@ -235,7 +235,7 @@ abstract class Door extends Transparent{
$next = $this->getSide($face[(($direction + 2) % 4)]); $next = $this->getSide($face[(($direction + 2) % 4)]);
$next2 = $this->getSide($face[$direction]); $next2 = $this->getSide($face[$direction]);
$metaUp = 0x08; $metaUp = 0x08;
if($next->getID() === $this->id or ($next2->isTransparent() === false and $next->isTransparent() === true)){ //Door hinge if($next->getId() === $this->id or ($next2->isTransparent() === false and $next->isTransparent() === true)){ //Door hinge
$metaUp |= 0x01; $metaUp |= 0x01;
} }
@ -251,12 +251,12 @@ abstract class Door extends Transparent{
public function onBreak(Item $item){ public function onBreak(Item $item){
if(($this->meta & 0x08) === 0x08){ if(($this->meta & 0x08) === 0x08){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === $this->id){ if($down->getId() === $this->id){
$this->getLevel()->setBlock($down, new Air(), true); $this->getLevel()->setBlock($down, new Air(), true);
} }
}else{ }else{
$up = $this->getSide(1); $up = $this->getSide(1);
if($up->getID() === $this->id){ if($up->getId() === $this->id){
$this->getLevel()->setBlock($up, new Air(), true); $this->getLevel()->setBlock($up, new Air(), true);
} }
} }
@ -268,12 +268,12 @@ abstract class Door extends Transparent{
public function onActivate(Item $item, Player $player = null){ public function onActivate(Item $item, Player $player = null){
if(($this->meta & 0x08) === 0x08){ //Top if(($this->meta & 0x08) === 0x08){ //Top
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === $this->id){ if($down->getId() === $this->id){
$meta = $down->getDamage() ^ 0x04; $meta = $down->getDamage() ^ 0x04;
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true); $this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4); $players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
if($player instanceof Player){ if($player instanceof Player){
unset($players[$player->getID()]); unset($players[$player->getId()]);
} }
$pk = new LevelEventPacket(); $pk = new LevelEventPacket();
$pk->x = $this->x; $pk->x = $this->x;
@ -292,7 +292,7 @@ abstract class Door extends Transparent{
$this->getLevel()->setBlock($this, $this, true); $this->getLevel()->setBlock($this, $this, true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4); $players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
if($player instanceof Player){ if($player instanceof Player){
unset($players[$player->getID()]); unset($players[$player->getId()]);
} }
$pk = new LevelEventPacket(); $pk = new LevelEventPacket();
$pk->x = $this->x; $pk->x = $this->x;

View File

@ -43,7 +43,7 @@ abstract class Fallable extends Solid{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::AIR or ($down instanceof Liquid)){ if($down->getId() === self::AIR or ($down instanceof Liquid)){
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [ $fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [ "Pos" => new Enum("Pos", [
new Double("", $this->x + 0.5), new Double("", $this->x + 0.5),
@ -59,7 +59,7 @@ abstract class Fallable extends Solid{
new Float("", 0), new Float("", 0),
new Float("", 0) new Float("", 0)
]), ]),
"TileID" => new Int("TileID", $this->getID()), "TileID" => new Int("TileID", $this->getId()),
"Data" => new Byte("Data", $this->getDamage()), "Data" => new Byte("Data", $this->getDamage()),
])); ]));

View File

@ -76,7 +76,7 @@ class Fire extends Flowable{
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
for($s = 0; $s <= 5; ++$s){ for($s = 0; $s <= 5; ++$s){
$side = $this->getSide($s); $side = $this->getSide($s);
if($side->getID() !== self::AIR and !($side instanceof Liquid)){ if($side->getId() !== self::AIR and !($side instanceof Liquid)){
return false; return false;
} }
} }
@ -84,7 +84,7 @@ class Fire extends Flowable{
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;
}elseif($type === Level::BLOCK_UPDATE_RANDOM){ }elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::NETHERRACK){ if($this->getSide(0)->getId() !== self::NETHERRACK){
$this->getLevel()->setBlock($this, new Air(), true); $this->getLevel()->setBlock($this, new Air(), true);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -63,7 +63,7 @@ class Grass extends Solid{
$y = mt_rand($this->y - 2, $this->y + 2); $y = mt_rand($this->y - 2, $this->y + 2);
$z = mt_rand($this->z - 1, $this->z + 1); $z = mt_rand($this->z - 1, $this->z + 1);
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z)); $block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));
if($block->getID() === Block::DIRT){ if($block->getId() === Block::DIRT){
if($block->getSide(1) instanceof Transparent){ if($block->getSide(1) instanceof Transparent){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass())); Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
@ -75,7 +75,7 @@ class Grass extends Solid{
} }
public function onActivate(Item $item, Player $player = null){ public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
$item->count--; $item->count--;
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2); TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);

View File

@ -123,7 +123,7 @@ class Ladder extends Transparent{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
/*if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method /*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1)); Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));
$this->getLevel()->setBlock($this, new Air(), true, true, true); $this->getLevel()->setBlock($this, new Air(), true, true, true);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -61,11 +61,11 @@ class Leaves extends Transparent{
if(isset($visited[$index])){ if(isset($visited[$index])){
return false; return false;
} }
if($pos->getID() === self::WOOD){ if($pos->getId() === self::WOOD){
return true; return true;
}elseif($pos->getID() === self::LEAVES and $distance < 3){ }elseif($pos->getId() === self::LEAVES and $distance < 3){
$visited[$index] = true; $visited[$index] = true;
$down = $pos->getSide(0)->getID(); $down = $pos->getSide(0)->getId();
if($down === Item::WOOD){ if($down === Item::WOOD){
return true; return true;
} }

View File

@ -49,11 +49,11 @@ class Leaves2 extends Leaves{
if(isset($visited[$index])){ if(isset($visited[$index])){
return false; return false;
} }
if($pos->getID() === self::WOOD2){ if($pos->getId() === self::WOOD2){
return true; return true;
}elseif($pos->getID() === self::LEAVES2 and $distance < 3){ }elseif($pos->getId() === self::LEAVES2 and $distance < 3){
$visited[$index] = true; $visited[$index] = true;
$down = $pos->getSide(0)->getID(); $down = $pos->getSide(0)->getId();
if($down === Item::WOOD2){ if($down === Item::WOOD2){
return true; return true;
} }

View File

@ -63,7 +63,7 @@ abstract class Liquid extends Transparent{
$pos = $this->getLevel()->getBlock($pos); $pos = $this->getLevel()->getBlock($pos);
} }
if($pos->getID() !== $this->getID()){ if($pos->getId() !== $this->getId()){
return -1; return -1;
}else{ }else{
return $pos->getDamage(); return $pos->getDamage();
@ -75,7 +75,7 @@ abstract class Liquid extends Transparent{
$pos = $this->getLevel()->getBlock($pos); $pos = $this->getLevel()->getBlock($pos);
} }
if($pos->getID() !== $this->getID()){ if($pos->getId() !== $this->getId()){
return -1; return -1;
} }
@ -291,7 +291,7 @@ abstract class Liquid extends Transparent{
private function flowIntoBlock(Block $block, $newFlowDecay){ private function flowIntoBlock(Block $block, $newFlowDecay){
if($block->canBeFlowedInto()){ if($block->canBeFlowedInto()){
if($block->getID() > 0){ if($block->getId() > 0){
$this->getLevel()->useBreakOn($block); $this->getLevel()->useBreakOn($block);
} }

View File

@ -58,13 +58,13 @@ class MelonStem extends Crops{
}else{ }else{
for($side = 2; $side <= 5; ++$side){ for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side); $b = $this->getSide($side);
if($b->getID() === self::MELON_BLOCK){ if($b->getId() === self::MELON_BLOCK){
return Level::BLOCK_UPDATE_RANDOM; return Level::BLOCK_UPDATE_RANDOM;
} }
} }
$side = $this->getSide(mt_rand(2, 5)); $side = $this->getSide(mt_rand(2, 5));
$d = $side->getSide(0); $d = $side->getSide(0);
if($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)){ if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Melon())); Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Melon()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$this->getLevel()->setBlock($side, $ev->getNewState(), true); $this->getLevel()->setBlock($side, $ev->getNewState(), true);

View File

@ -56,7 +56,7 @@ class Mycelium extends Solid{
$y = mt_rand($this->y - 2, $this->y + 2); $y = mt_rand($this->y - 2, $this->y + 2);
$z = mt_rand($this->z - 1, $this->z + 1); $z = mt_rand($this->z - 1, $this->z + 1);
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z)); $block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));
if($block->getID() === Block::DIRT){ if($block->getId() === Block::DIRT){
if($block->getSide(1) instanceof Transparent){ if($block->getSide(1) instanceof Transparent){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Mycelium())); Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Mycelium()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){

View File

@ -40,7 +40,7 @@ class Poppy extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){ if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;

View File

@ -58,13 +58,13 @@ class PumpkinStem extends Crops{
}else{ }else{
for($side = 2; $side <= 5; ++$side){ for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side); $b = $this->getSide($side);
if($b->getID() === self::PUMPKIN){ if($b->getId() === self::PUMPKIN){
return Level::BLOCK_UPDATE_RANDOM; return Level::BLOCK_UPDATE_RANDOM;
} }
} }
$side = $this->getSide(mt_rand(2, 5)); $side = $this->getSide(mt_rand(2, 5));
$d = $side->getSide(0); $d = $side->getSide(0);
if($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)){ if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Pumpkin())); Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Pumpkin()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$this->getLevel()->setBlock($side, $ev->getNewState(), true); $this->getLevel()->setBlock($side, $ev->getNewState(), true);

View File

@ -62,7 +62,7 @@ class Sapling extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::FARMLAND){ if($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::FARMLAND){
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;
@ -72,7 +72,7 @@ class Sapling extends Flowable{
} }
public function onActivate(Item $item, Player $player = null){ public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
//TODO: change log type //TODO: change log type
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07); Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){

View File

@ -76,7 +76,7 @@ class SignPost extends Transparent{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ if($this->getSide(0)->getId() === self::AIR){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -77,11 +77,11 @@ class Slab extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$this->meta &= 0x07; $this->meta &= 0x07;
if($face === 0){ if($face === 0){
if($target->getID() === self::SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){ if($target->getId() === self::SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true); $this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
return true; return true;
}elseif($block->getID() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){ }elseif($block->getId() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true); $this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
return true; return true;
@ -89,18 +89,18 @@ class Slab extends Transparent{
$this->meta |= 0x08; $this->meta |= 0x08;
} }
}elseif($face === 1){ }elseif($face === 1){
if($target->getID() === self::SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){ if($target->getId() === self::SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true); $this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
return true; return true;
}elseif($block->getID() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){ }elseif($block->getId() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true); $this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
return true; return true;
} }
//TODO: check for collision //TODO: check for collision
}else{ }else{
if($block->getID() === self::SLAB){ if($block->getId() === self::SLAB){
if(($block->getDamage() & 0x07) === ($this->meta & 0x07)){ if(($block->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true); $this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
@ -115,7 +115,7 @@ class Slab extends Transparent{
} }
} }
if($block->getID() === self::SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){ if($block->getId() === self::SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){
return false; return false;
} }
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);

View File

@ -59,7 +59,7 @@ class SnowLayer extends Flowable{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true); $this->getLevel()->setBlock($this, new Air(), true);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -79,7 +79,7 @@ class StoneWall extends Transparent{
} }
public function canConnect(Block $block){ public function canConnect(Block $block){
return ($block->getID() !== self::COBBLE_WALL and $block->getID() !== self::FENCE_GATE) ? $block->isSolid() : true; return ($block->getId() !== self::COBBLE_WALL and $block->getId() !== self::FENCE_GATE) ? $block->isSolid() : true;
} }
} }

View File

@ -48,11 +48,11 @@ class Sugarcane extends Flowable{
} }
public function onActivate(Item $item, Player $player = null){ public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
if($this->getSide(0)->getID() !== self::SUGARCANE_BLOCK){ if($this->getSide(0)->getId() !== self::SUGARCANE_BLOCK){
for($y = 1; $y < 3; ++$y){ for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); $b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === self::AIR){ if($b->getId() === self::AIR){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Sugarcane())); Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Sugarcane()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$this->getLevel()->setBlock($b, $ev->getNewState(), true); $this->getLevel()->setBlock($b, $ev->getNewState(), true);
@ -76,17 +76,17 @@ class Sugarcane extends Flowable{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->isTransparent() === true and $down->getID() !== self::SUGARCANE_BLOCK){ if($down->isTransparent() === true and $down->getId() !== self::SUGARCANE_BLOCK){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;
} }
}elseif($type === Level::BLOCK_UPDATE_RANDOM){ }elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::SUGARCANE_BLOCK){ if($this->getSide(0)->getId() !== self::SUGARCANE_BLOCK){
if($this->meta === 0x0F){ if($this->meta === 0x0F){
for($y = 1; $y < 3; ++$y){ for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); $b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === self::AIR){ if($b->getId() === self::AIR){
$this->getLevel()->setBlock($b, new Sugarcane(), true); $this->getLevel()->setBlock($b, new Sugarcane(), true);
break; break;
} }
@ -107,11 +107,11 @@ class Sugarcane extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::SUGARCANE_BLOCK){ if($down->getId() === self::SUGARCANE_BLOCK){
$this->getLevel()->setBlock($block, new Sugarcane(), true); $this->getLevel()->setBlock($block, new Sugarcane(), true);
return true; return true;
}elseif($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::SAND){ }elseif($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::SAND){
$block0 = $down->getSide(2); $block0 = $down->getSide(2);
$block1 = $down->getSide(3); $block1 = $down->getSide(3);
$block2 = $down->getSide(4); $block2 = $down->getSide(4);

View File

@ -52,7 +52,7 @@ class TNT extends Solid{
} }
public function onActivate(Item $item, Player $player = null){ public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::FLINT_STEEL){ if($item->getId() === Item::FLINT_STEEL){
$item->useOn($this); $item->useOn($this);
$this->getLevel()->setBlock($this, new Air(), true); $this->getLevel()->setBlock($this, new Air(), true);

View File

@ -76,7 +76,7 @@ abstract class Thin extends Transparent{
public function canConnect(Block $block){ public function canConnect(Block $block){
return $block->isSolid() or $block->getID() === $this->getID() or $block->getID() === self::GLASS_PANE or $block->getID() === self::GLASS; return $block->isSolid() or $block->getId() === $this->getId() or $block->getId() === self::GLASS_PANE or $block->getId() === self::GLASS;
} }
} }

View File

@ -55,7 +55,7 @@ class Torch extends Flowable{
0 => 0, 0 => 0,
]; ];
if($this->getSide($faces[$side])->isTransparent()=== true and !($side === 0 and $this->getSide(0)->getID() === self::FENCE)){ if($this->getSide($faces[$side])->isTransparent()=== true and !($side === 0 and $this->getSide(0)->getId() === self::FENCE)){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;
@ -78,7 +78,7 @@ class Torch extends Flowable{
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);
return true; return true;
}elseif($this->getSide(0)->isTransparent() === false or $this->getSide(0)->getID() === self::FENCE){ }elseif($this->getSide(0)->isTransparent() === false or $this->getSide(0)->getId() === self::FENCE){
$this->meta = 0; $this->meta = 0;
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);

View File

@ -115,7 +115,7 @@ class Trapdoor extends Transparent{
} }
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if(($target->isTransparent() === false or $target->getID() === self::SLAB) and $face !== 0 and $face !== 1){ if(($target->isTransparent() === false or $target->getId() === self::SLAB) and $face !== 0 and $face !== 1){
$faces = [ $faces = [
2 => 0, 2 => 0,
3 => 1, 3 => 1,

View File

@ -163,7 +163,7 @@ class Vine extends Transparent{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
/*if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method /*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1)); Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));
$this->getLevel()->setBlock($this, new Air(), true, true, true); $this->getLevel()->setBlock($this, new Air(), true, true, true);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;

View File

@ -77,11 +77,11 @@ class WoodSlab extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$this->meta &= 0x07; $this->meta &= 0x07;
if($face === 0){ if($face === 0){
if($target->getID() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){ if($target->getId() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true); $this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
return true; return true;
}elseif($block->getID() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){ }elseif($block->getId() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true); $this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
return true; return true;
@ -89,17 +89,17 @@ class WoodSlab extends Transparent{
$this->meta |= 0x08; $this->meta |= 0x08;
} }
}elseif($face === 1){ }elseif($face === 1){
if($target->getID() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){ if($target->getId() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true); $this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
return true; return true;
}elseif($block->getID() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){ }elseif($block->getId() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true); $this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
return true; return true;
} }
}else{ //TODO: collision }else{ //TODO: collision
if($block->getID() === self::WOOD_SLAB){ if($block->getId() === self::WOOD_SLAB){
if(($block->getDamage() & 0x07) === ($this->meta & 0x07)){ if(($block->getDamage() & 0x07) === ($this->meta & 0x07)){
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true); $this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
@ -114,7 +114,7 @@ class WoodSlab extends Transparent{
} }
} }
if($block->getID() === self::WOOD_SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){ if($block->getId() === self::WOOD_SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){
return false; return false;
} }
$this->getLevel()->setBlock($block, $this, true, true); $this->getLevel()->setBlock($block, $this, true, true);

View File

@ -64,7 +64,7 @@ class GiveCommand extends VanillaCommand{
return true; return true;
} }
if($item->getID() == 0){ if($item->getId() == 0){
$sender->sendMessage(TextFormat::RED . "There is no item called " . $args[1] . "."); $sender->sendMessage(TextFormat::RED . "There is no item called " . $args[1] . ".");
return true; return true;
@ -78,7 +78,7 @@ class GiveCommand extends VanillaCommand{
return true; return true;
} }
Command::broadcastCommandMessage($sender, "Gave " . $player->getName() . " " . $item->getCount() . " of " . $item->getName() . " (" . $item->getID() . ":" . $item->getDamage() . ")"); Command::broadcastCommandMessage($sender, "Gave " . $player->getName() . " " . $item->getCount() . " of " . $item->getName() . " (" . $item->getId() . ":" . $item->getDamage() . ")");
return true; return true;
} }

View File

@ -65,7 +65,7 @@ class Arrow extends Projectile{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddEntityPacket(); $pk = new AddEntityPacket();
$pk->type = Arrow::NETWORK_ID; $pk->type = Arrow::NETWORK_ID;
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;

View File

@ -312,8 +312,8 @@ abstract class Entity extends Location implements Metadatable{
* @param Player $player * @param Player $player
*/ */
public function spawnTo(Player $player){ public function spawnTo(Player $player){
if(!isset($this->hasSpawned[$player->getID()]) and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){ if(!isset($this->hasSpawned[$player->getId()]) and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){
$this->hasSpawned[$player->getID()] = $player; $this->hasSpawned[$player->getId()] = $player;
} }
} }
@ -347,11 +347,11 @@ abstract class Entity extends Location implements Metadatable{
* @param Player $player * @param Player $player
*/ */
public function despawnFrom(Player $player){ public function despawnFrom(Player $player){
if(isset($this->hasSpawned[$player->getID()])){ if(isset($this->hasSpawned[$player->getId()])){
$pk = new RemoveEntityPacket(); $pk = new RemoveEntityPacket();
$pk->eid = $this->id; $pk->eid = $this->id;
$player->dataPacket($pk); $player->dataPacket($pk);
unset($this->hasSpawned[$player->getID()]); unset($this->hasSpawned[$player->getId()]);
} }
} }
@ -1117,10 +1117,10 @@ abstract class Entity extends Location implements Metadatable{
if(!$this->justCreated){ if(!$this->justCreated){
$newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4); $newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
foreach($this->hasSpawned as $player){ foreach($this->hasSpawned as $player){
if(!isset($newChunk[$player->getID()])){ if(!isset($newChunk[$player->getId()])){
$this->despawnFrom($player); $this->despawnFrom($player);
}else{ }else{
unset($newChunk[$player->getID()]); unset($newChunk[$player->getId()]);
} }
} }
foreach($newChunk as $player){ foreach($newChunk as $player){
@ -1273,7 +1273,7 @@ abstract class Entity extends Location implements Metadatable{
} }
public function __toString(){ public function __toString(){
return (new \ReflectionClass($this))->getShortName() . "(" . $this->getID() . ")"; return (new \ReflectionClass($this))->getShortName() . "(" . $this->getId() . ")";
} }
} }

View File

@ -88,7 +88,7 @@ class FallingSand extends Entity{
if(!$this->dead){ if(!$this->dead){
if($this->ticksLived === 1){ if($this->ticksLived === 1){
$block = $this->level->getBlock($pos = (new Vector3($this->x, $this->y, $this->z))->floor()); $block = $this->level->getBlock($pos = (new Vector3($this->x, $this->y, $this->z))->floor());
if($block->getID() != $this->blockId){ if($block->getId() != $this->blockId){
$this->kill(); $this->kill();
return true; return true;
} }
@ -151,7 +151,7 @@ class FallingSand extends Entity{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddEntityPacket(); $pk = new AddEntityPacket();
$pk->type = FallingSand::NETWORK_ID; $pk->type = FallingSand::NETWORK_ID;
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;

View File

@ -99,13 +99,13 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$hotbarSlot = $this->inventory->getHotbarSlotIndex($slot); $hotbarSlot = $this->inventory->getHotbarSlotIndex($slot);
if($hotbarSlot !== -1){ if($hotbarSlot !== -1){
$item = $this->inventory->getItem($hotbarSlot); $item = $this->inventory->getItem($hotbarSlot);
if($item->getID() !== 0 and $item->getCount() > 0){ if($item->getId() !== 0 and $item->getCount() > 0){
$this->namedtag->Inventory[$slot] = new Compound(false, [ $this->namedtag->Inventory[$slot] = new Compound(false, [
new Byte("Count", $item->getCount()), new Byte("Count", $item->getCount()),
new Short("Damage", $item->getDamage()), new Short("Damage", $item->getDamage()),
new Byte("Slot", $slot), new Byte("Slot", $slot),
new Byte("TrueSlot", $hotbarSlot), new Byte("TrueSlot", $hotbarSlot),
new Short("id", $item->getID()), new Short("id", $item->getId()),
]); ]);
continue; continue;
} }
@ -128,19 +128,19 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
new Byte("Count", $item->getCount()), new Byte("Count", $item->getCount()),
new Short("Damage", $item->getDamage()), new Short("Damage", $item->getDamage()),
new Byte("Slot", $slot), new Byte("Slot", $slot),
new Short("id", $item->getID()), new Short("id", $item->getId()),
]); ]);
} }
//Armor //Armor
for($slot = 100; $slot < 104; ++$slot){ for($slot = 100; $slot < 104; ++$slot){
$item = $this->inventory->getItem($this->inventory->getSize() + $slot - 100); $item = $this->inventory->getItem($this->inventory->getSize() + $slot - 100);
if($item instanceof ItemItem and $item->getID() !== ItemItem::AIR){ if($item instanceof ItemItem and $item->getId() !== ItemItem::AIR){
$this->namedtag->Inventory[$slot] = new Compound(false, [ $this->namedtag->Inventory[$slot] = new Compound(false, [
new Byte("Count", $item->getCount()), new Byte("Count", $item->getCount()),
new Short("Damage", $item->getDamage()), new Short("Damage", $item->getDamage()),
new Byte("Slot", $slot), new Byte("Slot", $slot),
new Short("id", $item->getID()), new Short("id", $item->getId()),
]); ]);
} }
} }
@ -148,8 +148,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
} }
public function spawnTo(Player $player){ public function spawnTo(Player $player){
if($player !== $this and !isset($this->hasSpawned[$player->getID()])){ if($player !== $this and !isset($this->hasSpawned[$player->getId()])){
$this->hasSpawned[$player->getID()] = $player; $this->hasSpawned[$player->getId()] = $player;
$pk = new AddPlayerPacket(); $pk = new AddPlayerPacket();
$pk->clientID = 0; $pk->clientID = 0;
@ -158,14 +158,14 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
}else{ }else{
$pk->username = $this->nameTag; $pk->username = $this->nameTag;
} }
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->yaw = $this->yaw; $pk->yaw = $this->yaw;
$pk->pitch = $this->pitch; $pk->pitch = $this->pitch;
$item = $this->getInventory()->getItemInHand(); $item = $this->getInventory()->getItemInHand();
$pk->item = $item->getID(); $pk->item = $item->getId();
$pk->meta = $item->getDamage(); $pk->meta = $item->getDamage();
$pk->metadata = $this->getData(); $pk->metadata = $this->getData();
$player->dataPacket($pk); $player->dataPacket($pk);
@ -177,12 +177,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
} }
public function despawnFrom(Player $player){ public function despawnFrom(Player $player){
if(isset($this->hasSpawned[$player->getID()])){ if(isset($this->hasSpawned[$player->getId()])){
$pk = new RemovePlayerPacket(); $pk = new RemovePlayerPacket();
$pk->eid = $this->id; $pk->eid = $this->id;
$pk->clientID = 0; $pk->clientID = 0;
$player->dataPacket($pk); $player->dataPacket($pk);
unset($this->hasSpawned[$player->getID()]); unset($this->hasSpawned[$player->getId()]);
} }
} }

View File

@ -147,7 +147,7 @@ class Item extends Entity{
public function saveNBT(){ public function saveNBT(){
parent::saveNBT(); parent::saveNBT();
$this->namedtag->Item = new Compound("Item", [ $this->namedtag->Item = new Compound("Item", [
"id" => new Short("id", $this->item->getID()), "id" => new Short("id", $this->item->getId()),
"Damage" => new Short("Damage", $this->item->getDamage()), "Damage" => new Short("Damage", $this->item->getDamage()),
"Count" => new Byte("Count", $this->item->getCount()) "Count" => new Byte("Count", $this->item->getCount())
]); ]);
@ -226,7 +226,7 @@ class Item extends Entity{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddItemEntityPacket(); $pk = new AddItemEntityPacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;

View File

@ -94,7 +94,7 @@ abstract class Living extends Entity implements Damageable{
} }
$pk = new EntityEventPacket(); $pk = new EntityEventPacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->event = 2; //Ouch! $pk->event = 2; //Ouch!
Server::broadcastPacket($this->hasSpawned, $pk); Server::broadcastPacket($this->hasSpawned, $pk);
$this->setLastDamageCause($source); $this->setLastDamageCause($source);
@ -213,7 +213,7 @@ abstract class Living extends Entity implements Damageable{
--$nextIndex; --$nextIndex;
} }
$id = $block->getID(); $id = $block->getId();
if($transparent === null){ if($transparent === null){
if($id !== 0){ if($id !== 0){

View File

@ -139,7 +139,7 @@ class PrimedTNT extends Entity implements Explosive{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddEntityPacket(); $pk = new AddEntityPacket();
$pk->type = PrimedTNT::NETWORK_ID; $pk->type = PrimedTNT::NETWORK_ID;
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;

View File

@ -64,7 +64,7 @@ class Snowball extends Projectile{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddEntityPacket(); $pk = new AddEntityPacket();
$pk->type = Snowball::NETWORK_ID; $pk->type = Snowball::NETWORK_ID;
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;

View File

@ -53,7 +53,7 @@ class Villager extends Creature implements NPC, Ageable{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddMobPacket(); $pk = new AddMobPacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->type = Villager::NETWORK_ID; $pk->type = Villager::NETWORK_ID;
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;

View File

@ -41,7 +41,7 @@ class Zombie extends Monster{
public function spawnTo(Player $player){ public function spawnTo(Player $player){
$pk = new AddMobPacket(); $pk = new AddMobPacket();
$pk->eid = $this->getID(); $pk->eid = $this->getId();
$pk->type = Zombie::NETWORK_ID; $pk->type = Zombie::NETWORK_ID;
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;

View File

@ -124,7 +124,7 @@ abstract class BaseInventory implements Inventory{
$item = clone $item; $item = clone $item;
if($index < 0 or $index >= $this->size){ if($index < 0 or $index >= $this->size){
return false; return false;
}elseif($item->getID() === 0 or $item->getCount() <= 0){ }elseif($item->getId() === 0 or $item->getCount() <= 0){
return $this->clear($index, $source); return $this->clear($index, $source);
} }
@ -195,7 +195,7 @@ abstract class BaseInventory implements Inventory{
public function firstEmpty(){ public function firstEmpty(){
for($i = 0; $i < $this->size; ++$i){ for($i = 0; $i < $this->size; ++$i){
if($this->getItem($i)->getID() === Item::AIR){ if($this->getItem($i)->getId() === Item::AIR){
return $i; return $i;
} }
} }
@ -212,7 +212,7 @@ abstract class BaseInventory implements Inventory{
if(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){ if(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){
$item->setCount($item->getCount() - $diff); $item->setCount($item->getCount() - $diff);
} }
}elseif($slot->getID() === Item::AIR){ }elseif($slot->getId() === Item::AIR){
$item->setCount($item->getCount() - $this->getMaxStackSize()); $item->setCount($item->getCount() - $this->getMaxStackSize());
} }
@ -345,7 +345,7 @@ abstract class BaseInventory implements Inventory{
} }
$item = $ev->getNewItem(); $item = $ev->getNewItem();
} }
if($item->getID() !== Item::AIR){ if($item->getId() !== Item::AIR){
$this->slots[$index] = clone $item; $this->slots[$index] = clone $item;
}else{ }else{
unset($this->slots[$index]); unset($this->slots[$index]);

View File

@ -291,9 +291,9 @@ class CraftingManager{
} }
public function sort(Item $i1, Item $i2){ public function sort(Item $i1, Item $i2){
if($i1->getID() > $i2->getID()){ if($i1->getId() > $i2->getId()){
return 1; return 1;
}elseif($i1->getID() < $i2->getID()){ }elseif($i1->getId() < $i2->getId()){
return -1; return -1;
}elseif($i1->getDamage() > $i2->getDamage()){ }elseif($i1->getDamage() > $i2->getDamage()){
return 1; return 1;
@ -329,10 +329,10 @@ class CraftingManager{
* @return FurnaceRecipe * @return FurnaceRecipe
*/ */
public function matchFurnaceRecipe(Item $input){ public function matchFurnaceRecipe(Item $input){
if(isset($this->furnaceRecipes[$input->getID() . ":" . $input->getDamage()])){ if(isset($this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()])){
return $this->furnaceRecipes[$input->getID() . ":" . $input->getDamage()]; return $this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()];
}elseif(isset($this->furnaceRecipes[$input->getID() . ":?"])){ }elseif(isset($this->furnaceRecipes[$input->getId() . ":?"])){
return $this->furnaceRecipes[$input->getID() . ":?"]; return $this->furnaceRecipes[$input->getId() . ":?"];
} }
return null; return null;
@ -355,9 +355,9 @@ class CraftingManager{
$ingredients = $recipe->getIngredientList(); $ingredients = $recipe->getIngredientList();
usort($ingredients, [$this, "sort"]); usort($ingredients, [$this, "sort"]);
foreach($ingredients as $item){ 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){ public function registerFurnaceRecipe(FurnaceRecipe $recipe){
$input = $recipe->getInput(); $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)){ if(!($result instanceof Item)){
return false; return false;
} }
$k = $result->getID() . ":" . $result->getDamage(); $k = $result->getId() . ":" . $result->getDamage();
if(!isset($this->recipeLookup[$k])){ if(!isset($this->recipeLookup[$k])){
return false; return false;
@ -390,7 +390,7 @@ class CraftingManager{
$inputCount = 0; $inputCount = 0;
foreach($input as $item){ foreach($input as $item){
$inputCount += $item->getCount(); $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])){ if(!isset($this->recipeLookup[$k][$hash])){
$hasRecipe = null; $hasRecipe = null;

View File

@ -68,8 +68,8 @@ class PlayerInventory extends BaseInventory{
$item = $this->getItemInHand(); $item = $this->getItemInHand();
$pk = new PlayerEquipmentPacket(); $pk = new PlayerEquipmentPacket();
$pk->eid = $this->getHolder()->getID(); $pk->eid = $this->getHolder()->getId();
$pk->item = $item->getID(); $pk->item = $item->getId();
$pk->meta = $item->getDamage(); $pk->meta = $item->getDamage();
$pk->slot = $this->getHeldItemIndex(); $pk->slot = $this->getHeldItemIndex();
@ -128,8 +128,8 @@ class PlayerInventory extends BaseInventory{
$item = $this->getItemInHand(); $item = $this->getItemInHand();
$pk = new PlayerEquipmentPacket(); $pk = new PlayerEquipmentPacket();
$pk->eid = $this->getHolder()->getID(); $pk->eid = $this->getHolder()->getId();
$pk->item = $item->getID(); $pk->item = $item->getId();
$pk->meta = $item->getDamage(); $pk->meta = $item->getDamage();
$pk->slot = 0; $pk->slot = 0;
$pk->isEncoded = true; $pk->isEncoded = true;
@ -202,7 +202,7 @@ class PlayerInventory extends BaseInventory{
public function setItem($index, Item $item, $source = null){ public function setItem($index, Item $item, $source = null){
if($index < 0 or $index >= $this->size){ if($index < 0 or $index >= $this->size){
return false; return false;
}elseif($item->getID() === 0 or $item->getCount() <= 0){ }elseif($item->getId() === 0 or $item->getCount() <= 0){
return $this->clear($index, $source); return $this->clear($index, $source);
} }
@ -265,7 +265,7 @@ class PlayerInventory extends BaseInventory{
} }
$item = $ev->getNewItem(); $item = $ev->getNewItem();
} }
if($item->getID() !== Item::AIR){ if($item->getId() !== Item::AIR){
$this->slots[$index] = clone $item; $this->slots[$index] = clone $item;
}else{ }else{
unset($this->slots[$index]); unset($this->slots[$index]);
@ -308,15 +308,15 @@ class PlayerInventory extends BaseInventory{
$slots = []; $slots = [];
foreach($armor as $i => $slot){ foreach($armor as $i => $slot){
if($slot->getID() === Item::AIR){ if($slot->getId() === Item::AIR){
$slots[$i] = 255; $slots[$i] = 255;
}else{ }else{
$slots[$i] = $slot->getID(); $slots[$i] = $slot->getId();
} }
} }
$pk = new PlayerArmorEquipmentPacket(); $pk = new PlayerArmorEquipmentPacket();
$pk->eid = $this->getHolder()->getID(); $pk->eid = $this->getHolder()->getId();
$pk->slots = $slots; $pk->slots = $slots;
$pk->encode(); $pk->encode();
$pk->isEncoded = true; $pk->isEncoded = true;
@ -346,7 +346,7 @@ class PlayerInventory extends BaseInventory{
$items[$i] = Item::get(Item::AIR, null, 0); $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); $this->clear($this->getSize() + $i);
}else{ }else{
$this->setItem($this->getSize() + $i, $items[$i]); $this->setItem($this->getSize() + $i, $items[$i]);
@ -369,15 +369,15 @@ class PlayerInventory extends BaseInventory{
$slots = []; $slots = [];
foreach($armor as $i => $slot){ foreach($armor as $i => $slot){
if($slot->getID() === Item::AIR){ if($slot->getId() === Item::AIR){
$slots[$i] = 255; $slots[$i] = 255;
}else{ }else{
$slots[$i] = $slot->getID(); $slots[$i] = $slot->getId();
} }
} }
$pk = new PlayerArmorEquipmentPacket(); $pk = new PlayerArmorEquipmentPacket();
$pk->eid = $this->getHolder()->getID(); $pk->eid = $this->getHolder()->getId();
$pk->slots = $slots; $pk->slots = $slots;
$pk->encode(); $pk->encode();
$pk->isEncoded = true; $pk->isEncoded = true;

View File

@ -93,7 +93,7 @@ class SimpleTransactionGroup implements TransactionGroup{
*/ */
protected function matchItems(array &$needItems, array &$haveItems){ protected function matchItems(array &$needItems, array &$haveItems){
foreach($this->transactions as $key => $ts){ foreach($this->transactions as $key => $ts){
if($ts->getTargetItem()->getID() !== Item::AIR){ if($ts->getTargetItem()->getId() !== Item::AIR){
$needItems[] = $ts->getTargetItem(); $needItems[] = $ts->getTargetItem();
} }
$checkSourceItem = $ts->getInventory()->getItem($ts->getSlot()); $checkSourceItem = $ts->getInventory()->getItem($ts->getSlot());
@ -101,7 +101,7 @@ class SimpleTransactionGroup implements TransactionGroup{
if(!$checkSourceItem->equals($sourceItem, true) or $sourceItem->getCount() !== $checkSourceItem->getCount()){ if(!$checkSourceItem->equals($sourceItem, true) or $sourceItem->getCount() !== $checkSourceItem->getCount()){
return false; return false;
} }
if($sourceItem->getID() !== Item::AIR){ if($sourceItem->getId() !== Item::AIR){
$haveItems[] = $sourceItem; $haveItems[] = $sourceItem;
} }
} }

View File

@ -41,7 +41,7 @@ class Bucket extends Item{
if($targetBlock instanceof Air){ if($targetBlock instanceof Air){
if($target instanceof Liquid and $target->getDamage() === 0){ if($target instanceof Liquid and $target->getDamage() === 0){
$result = clone $this; $result = clone $this;
$result->setDamage($target->getID()); $result->setDamage($target->getId());
$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $block, $face, $this, $result)); $player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $block, $face, $this, $result));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$player->getLevel()->setBlock($target, new Air(), true, true); $player->getLevel()->setBlock($target, new Air(), true, true);

View File

@ -38,7 +38,7 @@ class FlintSteel extends Tool{
$player->getInventory()->setItemInHand(new Item(Item::AIR, 0, 0)); $player->getInventory()->setItemInHand(new Item(Item::AIR, 0, 0));
} }
if($block->getID() === self::AIR and ($target instanceof Solid)){ if($block->getId() === self::AIR and ($target instanceof Solid)){
$level->setBlock($block, new Fire(), true); $level->setBlock($block, new Fire(), true);
return true; return true;

View File

@ -519,7 +519,7 @@ class Item{
if(defined(Item::class . "::" . strtoupper($b[0]))){ if(defined(Item::class . "::" . strtoupper($b[0]))){
$item = self::get(constant(Item::class . "::" . strtoupper($b[0])), $meta); $item = self::get(constant(Item::class . "::" . strtoupper($b[0])), $meta);
if($item->getID() === self::AIR and strtoupper($b[0]) !== "AIR"){ if($item->getId() === self::AIR and strtoupper($b[0]) !== "AIR"){
$item = self::get(((int) $b[0]) & 0xFFFF, $meta); $item = self::get(((int) $b[0]) & 0xFFFF, $meta);
} }
}else{ }else{
@ -656,7 +656,7 @@ class Item{
} }
public final function equals(Item $item, $checkDamage = false){ public final function equals(Item $item, $checkDamage = false){
return $this->id === $item->getID() and ($checkDamage === false or $this->getDamage() === $item->getDamage()); return $this->id === $item->getId() and ($checkDamage === false or $this->getDamage() === $item->getDamage());
} }
} }

View File

@ -29,7 +29,7 @@ use pocketmine\block\Block;
class ItemBlock extends Item{ class ItemBlock extends Item{
public function __construct(Block $block, $meta = 0, $count = 1){ public function __construct(Block $block, $meta = 0, $count = 1){
$this->block = clone $block; $this->block = clone $block;
parent::__construct($block->getID(), $block->getDamage(), $count, $block->getName()); parent::__construct($block->getId(), $block->getDamage(), $count, $block->getName());
} }
public function setDamage($meta){ public function setDamage($meta){

View File

@ -82,7 +82,7 @@ class Painting extends Item{
//$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data); //$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data);
//$e->spawnToAll(); //$e->spawnToAll();
/*if(($player->gamemode & 0x01) === 0x00){ /*if(($player->gamemode & 0x01) === 0x00){
$player->removeItem(Item::get($this->getID(), $this->getDamage(), 1)); $player->removeItem(Item::get($this->getId(), $this->getDamage(), 1));
}*/ }*/
return true; return true;

View File

@ -46,7 +46,7 @@ abstract class Tool extends Item{
*/ */
public function useOn($object){ public function useOn($object){
if($this->isHoe()){ if($this->isHoe()){
if(($object instanceof Block) and ($object->getID() === self::GRASS or $object->getID() === self::DIRT)){ if(($object instanceof Block) and ($object->getId() === self::GRASS or $object->getId() === self::DIRT)){
$this->meta++; $this->meta++;
} }
}elseif(($object instanceof Entity) and !$this->isSword()){ }elseif(($object instanceof Entity) and !$this->isSword()){

View File

@ -407,7 +407,7 @@ class Level implements ChunkManager, Metadatable{
public function useChunk($X, $Z, Player $player){ public function useChunk($X, $Z, Player $player){
$index = Level::chunkHash($X, $Z); $index = Level::chunkHash($X, $Z);
$this->loadChunk($X, $Z); $this->loadChunk($X, $Z);
$this->usedChunks[$index][$player->getID()] = $player; $this->usedChunks[$index][$player->getId()] = $player;
} }
/** /**
@ -419,7 +419,7 @@ class Level implements ChunkManager, Metadatable{
* @param Player $player * @param Player $player
*/ */
public function freeChunk($X, $Z, Player $player){ public function freeChunk($X, $Z, Player $player){
unset($this->usedChunks[$index = Level::chunkHash($X, $Z)][$player->getID()]); unset($this->usedChunks[$index = Level::chunkHash($X, $Z)][$player->getId()]);
$this->unloadChunkRequest($X, $Z, true); $this->unloadChunkRequest($X, $Z, true);
} }
@ -537,7 +537,7 @@ class Level implements ChunkManager, Metadatable{
$pk->x = $b->x; $pk->x = $b->x;
$pk->y = $b->y; $pk->y = $b->y;
$pk->z = $b->z; $pk->z = $b->z;
$pk->block = $b->getID(); $pk->block = $b->getId();
$pk->meta = $b->getDamage(); $pk->meta = $b->getDamage();
Server::broadcastPacket($this->getUsingChunk($b->x >> 4, $b->z >> 4), $pk); Server::broadcastPacket($this->getUsingChunk($b->x >> 4, $b->z >> 4), $pk);
} }
@ -1046,14 +1046,14 @@ class Level implements ChunkManager, Metadatable{
unset($this->blockCache["{$pos->x}:{$pos->y}:{$pos->z}"]); unset($this->blockCache["{$pos->x}:{$pos->y}:{$pos->z}"]);
if($this->getChunk($pos->x >> 4, $pos->z >> 4, true)->setBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $block->getID(), $block->getDamage())){ if($this->getChunk($pos->x >> 4, $pos->z >> 4, true)->setBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $block->getId(), $block->getDamage())){
if(!($pos instanceof Position)){ if(!($pos instanceof Position)){
$pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z); $pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z);
} }
$block->position($pos); $block->position($pos);
$index = Level::chunkHash($pos->x >> 4, $pos->z >> 4); $index = Level::chunkHash($pos->x >> 4, $pos->z >> 4);
if(ADVANCED_CACHE == true){ if(ADVANCED_CACHE == true){
Cache::remove("world:" . $this->getID() . ":" . $index); Cache::remove("world:" . $this->getId() . ":" . $index);
} }
if($direct === true){ if($direct === true){
@ -1061,7 +1061,7 @@ class Level implements ChunkManager, Metadatable{
$pk->x = $pos->x; $pk->x = $pos->x;
$pk->y = $pos->y; $pk->y = $pos->y;
$pk->z = $pos->z; $pk->z = $pos->z;
$pk->block = $block->getID(); $pk->block = $block->getId();
$pk->meta = $block->getDamage(); $pk->meta = $block->getDamage();
Server::broadcastPacket($this->getUsingChunk($pos->x >> 4, $pos->z >> 4), $pk); Server::broadcastPacket($this->getUsingChunk($pos->x >> 4, $pos->z >> 4), $pk);
@ -1105,7 +1105,7 @@ class Level implements ChunkManager, Metadatable{
*/ */
public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, $delay = 10){ public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, $delay = 10){
$motion = $motion === null ? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1) : $motion; $motion = $motion === null ? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1) : $motion;
if($item->getID() > 0 and $item->getCount() > 0){ if($item->getId() > 0 and $item->getCount() > 0){
$itemEntity = Entity::createEntity("Item", $this->getChunk($source->getX() >> 4, $source->getZ() >> 4), new Compound("", [ $itemEntity = Entity::createEntity("Item", $this->getChunk($source->getX() >> 4, $source->getZ() >> 4), new Compound("", [
"Pos" => new Enum("Pos", [ "Pos" => new Enum("Pos", [
new Double("", $source->getX()), new Double("", $source->getX()),
@ -1124,7 +1124,7 @@ class Level implements ChunkManager, Metadatable{
]), ]),
"Health" => new Short("Health", 5), "Health" => new Short("Health", 5),
"Item" => new Compound("Item", [ "Item" => new Compound("Item", [
"id" => new Short("id", $item->getID()), "id" => new Short("id", $item->getId()),
"Damage" => new Short("Damage", $item->getDamage()), "Damage" => new Short("Damage", $item->getDamage()),
"Count" => new Byte("Count", $item->getCount()) "Count" => new Byte("Count", $item->getCount())
]), ]),
@ -1189,7 +1189,7 @@ class Level implements ChunkManager, Metadatable{
if($level instanceof Level){ if($level instanceof Level){
$above = $level->getBlock(new Vector3($target->x, $target->y + 1, $target->z)); $above = $level->getBlock(new Vector3($target->x, $target->y + 1, $target->z));
if($above instanceof Block){ if($above instanceof Block){
if($above->getID() === Item::FIRE){ if($above->getId() === Item::FIRE){
$level->setBlock($above, new Air(), true); $level->setBlock($above, new Air(), true);
} }
} }
@ -1250,7 +1250,7 @@ class Level implements ChunkManager, Metadatable{
return false; return false;
} }
if($target->getID() === Item::AIR){ if($target->getId() === Item::AIR){
return false; return false;
} }
@ -1285,7 +1285,7 @@ class Level implements ChunkManager, Metadatable{
if($item->isPlaceable()){ if($item->isPlaceable()){
$hand = $item->getBlock(); $hand = $item->getBlock();
$hand->position($block); $hand->position($block);
}elseif($block->getID() === Item::FIRE){ }elseif($block->getId() === Item::FIRE){
$this->setBlock($block, new Air(), true); $this->setBlock($block, new Air(), true);
return false; return false;
@ -1293,7 +1293,7 @@ class Level implements ChunkManager, Metadatable{
return false; return false;
} }
if(!($block->canBeReplaced() === true or ($hand->getID() === Item::SLAB and $block->getID() === Item::SLAB))){ if(!($block->canBeReplaced() === true or ($hand->getId() === Item::SLAB and $block->getId() === Item::SLAB))){
return false; return false;
} }
@ -1338,7 +1338,7 @@ class Level implements ChunkManager, Metadatable{
return false; return false;
} }
if($hand->getID() === Item::SIGN_POST or $hand->getID() === Item::WALL_SIGN){ if($hand->getId() === Item::SIGN_POST or $hand->getId() === Item::WALL_SIGN){
$tile = Tile::createTile("Sign", $this->getChunk($block->x >> 4, $block->z >> 4), new Compound(false, [ $tile = Tile::createTile("Sign", $this->getChunk($block->x >> 4, $block->z >> 4), new Compound(false, [
"id" => new String("id", Tile::SIGN), "id" => new String("id", Tile::SIGN),
"x" => new Int("x", $block->x), "x" => new Int("x", $block->x),
@ -1709,7 +1709,7 @@ class Level implements ChunkManager, Metadatable{
$this->chunks[$index] = $chunk; $this->chunks[$index] = $chunk;
} }
if(ADVANCED_CACHE == true){ if(ADVANCED_CACHE == true){
Cache::remove("world:" . $this->getID() . ":". Level::chunkHash($x, $z)); Cache::remove("world:" . $this->getId() . ":". Level::chunkHash($x, $z));
} }
$chunk->setChanged(); $chunk->setChanged();
} }
@ -1802,7 +1802,7 @@ class Level implements ChunkManager, Metadatable{
continue; continue;
} }
Level::getXZ($index, $x, $z); Level::getXZ($index, $x, $z);
if(ADVANCED_CACHE == true and ($cache = Cache::get("world:" . $this->getID() . ":" . $index)) !== false){ if(ADVANCED_CACHE == true and ($cache = Cache::get("world:" . $this->getId() . ":" . $index)) !== false){
/** @var Player[] $players */ /** @var Player[] $players */
foreach($players as $player){ foreach($players as $player){
if($player->isConnected() and isset($player->usedChunks[$index])){ if($player->isConnected() and isset($player->usedChunks[$index])){
@ -1830,7 +1830,7 @@ class Level implements ChunkManager, Metadatable{
if(isset($this->chunkSendTasks[$index])){ if(isset($this->chunkSendTasks[$index])){
if(ADVANCED_CACHE == true){ if(ADVANCED_CACHE == true){
Cache::add("world:" . $this->getID() . ":" . $index, $payload, 60); Cache::add("world:" . $this->getId() . ":" . $index, $payload, 60);
} }
foreach($this->chunkSendQueue[$index] as $player){ foreach($this->chunkSendQueue[$index] as $player){
/** @var Player $player */ /** @var Player $player */
@ -1856,14 +1856,14 @@ class Level implements ChunkManager, Metadatable{
} }
if($entity instanceof Player){ if($entity instanceof Player){
unset($this->players[$entity->getID()]); unset($this->players[$entity->getId()]);
//$this->everyoneSleeping(); //$this->everyoneSleeping();
}else{ }else{
$entity->kill(); $entity->kill();
} }
unset($this->entities[$entity->getID()]); unset($this->entities[$entity->getId()]);
unset($this->updateEntities[$entity->getID()]); unset($this->updateEntities[$entity->getId()]);
} }
/** /**
@ -1876,9 +1876,9 @@ class Level implements ChunkManager, Metadatable{
throw new LevelException("Invalid Entity level"); throw new LevelException("Invalid Entity level");
} }
if($entity instanceof Player){ if($entity instanceof Player){
$this->players[$entity->getID()] = $entity; $this->players[$entity->getId()] = $entity;
} }
$this->entities[$entity->getID()] = $entity; $this->entities[$entity->getId()] = $entity;
} }
/** /**
@ -1890,7 +1890,7 @@ class Level implements ChunkManager, Metadatable{
if($tile->getLevel() !== $this){ if($tile->getLevel() !== $this){
throw new LevelException("Invalid Tile level"); throw new LevelException("Invalid Tile level");
} }
$this->tiles[$tile->getID()] = $tile; $this->tiles[$tile->getId()] = $tile;
} }
/** /**
@ -1903,8 +1903,8 @@ class Level implements ChunkManager, Metadatable{
throw new LevelException("Invalid Tile level"); throw new LevelException("Invalid Tile level");
} }
unset($this->tiles[$tile->getID()]); unset($this->tiles[$tile->getId()]);
unset($this->updateTiles[$tile->getID()]); unset($this->updateTiles[$tile->getId()]);
} }
/** /**
@ -2005,7 +2005,7 @@ class Level implements ChunkManager, Metadatable{
unset($this->chunks[$index]); unset($this->chunks[$index]);
unset($this->usedChunks[$index]); unset($this->usedChunks[$index]);
Cache::remove("world:" . $this->getID() . ":$index"); Cache::remove("world:" . $this->getId() . ":$index");
$this->timings->doChunkUnload->stopTiming(); $this->timings->doChunkUnload->stopTiming();

View File

@ -66,7 +66,7 @@ class Anvil extends McRegion{
} }
public function requestChunkTask($x, $z){ public function requestChunkTask($x, $z){
return new ChunkRequestTask($this, $this->getLevel()->getID(), $x, $z); return new ChunkRequestTask($this, $this->getLevel()->getId(), $x, $z);
} }
/** /**

View File

@ -226,17 +226,17 @@ abstract class BaseFullChunk implements FullChunk{
} }
public function addEntity(Entity $entity){ public function addEntity(Entity $entity){
$this->entities[$entity->getID()] = $entity; $this->entities[$entity->getId()] = $entity;
$this->hasChanged = true; $this->hasChanged = true;
} }
public function removeEntity(Entity $entity){ public function removeEntity(Entity $entity){
unset($this->entities[$entity->getID()]); unset($this->entities[$entity->getId()]);
$this->hasChanged = true; $this->hasChanged = true;
} }
public function addTile(Tile $tile){ public function addTile(Tile $tile){
$this->tiles[$tile->getID()] = $tile; $this->tiles[$tile->getId()] = $tile;
if(isset($this->tileList[$index = (($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)]) and $this->tileList[$index] !== $tile){ if(isset($this->tileList[$index = (($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)]) and $this->tileList[$index] !== $tile){
$this->tileList[$index]->close(); $this->tileList[$index]->close();
} }
@ -245,7 +245,7 @@ abstract class BaseFullChunk implements FullChunk{
} }
public function removeTile(Tile $tile){ public function removeTile(Tile $tile){
unset($this->tiles[$tile->getID()]); unset($this->tiles[$tile->getId()]);
unset($this->tileList[(($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)]); unset($this->tileList[(($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)]);
$this->hasChanged = true; $this->hasChanged = true;
} }

View File

@ -95,7 +95,7 @@ class Flat extends Generator{
$b = Item::fromString($b); $b = Item::fromString($b);
$cnt = $matches[2][$i] === "" ? 1 : intval($matches[2][$i]); $cnt = $matches[2][$i] === "" ? 1 : intval($matches[2][$i]);
for($cY = $y, $y += $cnt; $cY < $y; ++$cY){ for($cY = $y, $y += $cnt; $cY < $y; ++$cY){
$this->structure[$cY] = [$b->getID(), $b->getDamage()]; $this->structure[$cY] = [$b->getId(), $b->getDamage()];
} }
} }

View File

@ -55,14 +55,14 @@ class GenerationInstanceManager extends GenerationRequestManager{
* @param array $options * @param array $options
*/ */
public function openLevel(Level $level, $generator, array $options = []){ public function openLevel(Level $level, $generator, array $options = []){
$this->generationManager->openLevel($level->getID(), $level->getSeed(), $generator, $options); $this->generationManager->openLevel($level->getId(), $level->getSeed(), $generator, $options);
} }
/** /**
* @param Level $level * @param Level $level
*/ */
public function closeLevel(Level $level){ public function closeLevel(Level $level){
$this->generationManager->closeLevel($level->getID()); $this->generationManager->closeLevel($level->getId());
} }
public function addNamespace($namespace, $path){ public function addNamespace($namespace, $path){
@ -70,7 +70,7 @@ class GenerationInstanceManager extends GenerationRequestManager{
} }
public function requestChunk(Level $level, $chunkX, $chunkZ){ public function requestChunk(Level $level, $chunkX, $chunkZ){
$this->generationManager->enqueueChunk($level->getID(), $chunkX, $chunkZ); $this->generationManager->enqueueChunk($level->getId(), $chunkX, $chunkZ);
} }
public function getChunk($levelID, $chunkX, $chunkZ){ public function getChunk($levelID, $chunkX, $chunkZ){

View File

@ -53,7 +53,7 @@ class GenerationRequestManager{
* @param array $options * @param array $options
*/ */
public function openLevel(Level $level, $generator, array $options = []){ public function openLevel(Level $level, $generator, array $options = []){
$buffer = chr(GenerationManager::PACKET_OPEN_LEVEL) . Binary::writeInt($level->getID()) . Binary::writeInt($level->getSeed()) . $buffer = chr(GenerationManager::PACKET_OPEN_LEVEL) . Binary::writeInt($level->getId()) . Binary::writeInt($level->getSeed()) .
Binary::writeShort(strlen($generator)) . $generator . serialize($options); Binary::writeShort(strlen($generator)) . $generator . serialize($options);
$this->generationThread->pushMainToThreadPacket($buffer); $this->generationThread->pushMainToThreadPacket($buffer);
@ -63,7 +63,7 @@ class GenerationRequestManager{
* @param Level $level * @param Level $level
*/ */
public function closeLevel(Level $level){ public function closeLevel(Level $level){
$buffer = chr(GenerationManager::PACKET_CLOSE_LEVEL) . Binary::writeInt($level->getID()); $buffer = chr(GenerationManager::PACKET_CLOSE_LEVEL) . Binary::writeInt($level->getId());
$this->generationThread->pushMainToThreadPacket($buffer); $this->generationThread->pushMainToThreadPacket($buffer);
} }
@ -78,7 +78,7 @@ class GenerationRequestManager{
} }
public function requestChunk(Level $level, $chunkX, $chunkZ){ public function requestChunk(Level $level, $chunkX, $chunkZ){
$buffer = chr(GenerationManager::PACKET_REQUEST_CHUNK) . Binary::writeInt($level->getID()) . Binary::writeInt($chunkX) . Binary::writeInt($chunkZ); $buffer = chr(GenerationManager::PACKET_REQUEST_CHUNK) . Binary::writeInt($level->getId()) . Binary::writeInt($chunkX) . Binary::writeInt($chunkZ);
$this->generationThread->pushMainToThreadPacket($buffer); $this->generationThread->pushMainToThreadPacket($buffer);
} }

View File

@ -80,7 +80,7 @@ class Ore{
$sizeZ **= 2; $sizeZ **= 2;
if(($sizeX + $sizeY + $sizeZ) < 1 and $level->getBlockIdAt($x, $y, $z) === 1){ if(($sizeX + $sizeY + $sizeZ) < 1 and $level->getBlockIdAt($x, $y, $z) === 1){
$level->setBlockIdAt($x, $y, $z, $this->type->material->getID()); $level->setBlockIdAt($x, $y, $z, $this->type->material->getId());
$level->setBlockDataAt($x, $y, $z, $this->type->material->getDamage()); $level->setBlockDataAt($x, $y, $z, $this->type->material->getDamage());
} }
} }

View File

@ -30,6 +30,6 @@ class EntityMetadataStore extends MetadataStore{
throw new \InvalidArgumentException("Argument must be an Entity instance"); throw new \InvalidArgumentException("Argument must be an Entity instance");
} }
return $entity->getID() . ":" . $metadataKey; return $entity->getId() . ":" . $metadataKey;
} }
} }

View File

@ -156,7 +156,7 @@ abstract class DataPacket extends \stdClass{
} }
protected function putSlot(Item $item){ protected function putSlot(Item $item){
$this->putShort($item->getID()); $this->putShort($item->getId());
$this->putByte($item->getCount()); $this->putByte($item->getCount());
$this->putShort($item->getDamage()); $this->putShort($item->getDamage());
} }

View File

@ -129,11 +129,11 @@ class Chest extends Spawnable implements InventoryHolder, Container{
$d = new Compound(false, [ $d = new Compound(false, [
new Byte("Count", $item->getCount()), new Byte("Count", $item->getCount()),
new Byte("Slot", $index), new Byte("Slot", $index),
new Short("id", $item->getID()), new Short("id", $item->getId()),
new Short("Damage", $item->getDamage()), new Short("Damage", $item->getDamage()),
]); ]);
if($item->getID() === Item::AIR or $item->getCount() <= 0){ if($item->getId() === Item::AIR or $item->getCount() <= 0){
if($i >= 0){ if($i >= 0){
unset($this->namedtag->Items[$i]); unset($this->namedtag->Items[$i]);
} }

View File

@ -137,11 +137,11 @@ class Furnace extends Tile implements InventoryHolder, Container{
$d = new Compound(false, [ $d = new Compound(false, [
new Byte("Count", $item->getCount()), new Byte("Count", $item->getCount()),
new Byte("Slot", $index), new Byte("Slot", $index),
new Short("id", $item->getID()), new Short("id", $item->getId()),
new Short("Damage", $item->getDamage()), new Short("Damage", $item->getDamage()),
]); ]);
if($item->getID() === Item::AIR or $item->getCount() <= 0){ if($item->getId() === Item::AIR or $item->getCount() <= 0){
if($i >= 0){ if($i >= 0){
unset($this->namedtag->Items[$i]); unset($this->namedtag->Items[$i]);
} }
@ -176,7 +176,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
$this->namedtag->MaxTime = new Short("MaxTime", $ev->getBurnTime()); $this->namedtag->MaxTime = new Short("MaxTime", $ev->getBurnTime());
$this->namedtag->BurnTime = new Short("BurnTime", $ev->getBurnTime()); $this->namedtag->BurnTime = new Short("BurnTime", $ev->getBurnTime());
$this->namedtag->BurnTicks = new Short("BurnTicks", 0); $this->namedtag->BurnTicks = new Short("BurnTicks", 0);
if($this->getBlock()->getID() === Item::FURNACE){ if($this->getBlock()->getId() === Item::FURNACE){
$this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $this->getBlock()->getDamage()), true); $this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $this->getBlock()->getDamage()), true);
} }
@ -202,7 +202,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
$raw = $this->inventory->getSmelting(); $raw = $this->inventory->getSmelting();
$product = $this->inventory->getResult(); $product = $this->inventory->getResult();
$smelt = $this->server->getCraftingManager()->matchFurnaceRecipe($raw); $smelt = $this->server->getCraftingManager()->matchFurnaceRecipe($raw);
$canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product, true) and $product->getCount() < $product->getMaxStackSize()) or $product->getID() === Item::AIR)); $canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product, true) and $product->getCount() < $product->getMaxStackSize()) or $product->getId() === Item::AIR));
if($this->namedtag["BurnTime"] <= 0 and $canSmelt and $fuel->getFuelTime() !== null and $fuel->getCount() > 0){ if($this->namedtag["BurnTime"] <= 0 and $canSmelt and $fuel->getFuelTime() !== null and $fuel->getCount() > 0){
$this->checkFuel($fuel); $this->checkFuel($fuel);
@ -215,7 +215,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
if($smelt instanceof FurnaceRecipe and $canSmelt){ if($smelt instanceof FurnaceRecipe and $canSmelt){
$this->namedtag->CookTime = new Short("CookTime", $this->namedtag["CookTime"] + 1); $this->namedtag->CookTime = new Short("CookTime", $this->namedtag["CookTime"] + 1);
if($this->namedtag["CookTime"] >= 200){ //10 seconds if($this->namedtag["CookTime"] >= 200){ //10 seconds
$product = Item::get($smelt->getResult()->getID(), $smelt->getResult()->getDamage(), $product->getCount() + 1); $product = Item::get($smelt->getResult()->getId(), $smelt->getResult()->getDamage(), $product->getCount() + 1);
$this->server->getPluginManager()->callEvent($ev = new FurnaceSmeltEvent($this, $raw, $product)); $this->server->getPluginManager()->callEvent($ev = new FurnaceSmeltEvent($this, $raw, $product));
@ -239,7 +239,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
} }
$ret = true; $ret = true;
}else{; }else{;
if($this->getBlock()->getID() === Item::BURNING_FURNACE){ if($this->getBlock()->getId() === Item::BURNING_FURNACE){
$this->getLevel()->setBlock($this, Block::get(Item::FURNACE, $this->getBlock()->getDamage()), true); $this->getLevel()->setBlock($this, Block::get(Item::FURNACE, $this->getBlock()->getDamage()), true);
} }
$this->namedtag->BurnTime = new Short("BurnTime", 0); $this->namedtag->BurnTime = new Short("BurnTime", 0);