当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::getMetadata方法代码示例

本文整理汇总了PHP中Item::getMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getMetadata方法的具体用法?PHP Item::getMetadata怎么用?PHP Item::getMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item::getMetadata方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onActivate

 public function onActivate(Item $item, Player $player)
 {
     if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
         //Bonemeal
         TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x3);
         if (($player->gamemode & 0x1) === 0) {
             $item->count--;
         }
         return true;
     }
     return false;
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:12,代码来源:Sapling.php

示例2: onActivate

 public function onActivate(Item $item, Player $player)
 {
     if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
         //Bonemeal
         $this->meta = 0x7;
         $this->level->setBlock($this, $this, true, false, true);
         if (($player->gamemode & 0x1) === 0) {
             $item->count--;
         }
         return true;
     }
     return false;
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:13,代码来源:Beetroot.php

示例3: onActivate

 public function onActivate(Item $item, Player $player)
 {
     if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
         if (($player->gamemode & 0x1) === 0) {
             $item->count--;
         }
         TallGrassObject::growGrass($this->level, $this, new Random(), 8, 2);
         return true;
     } elseif ($item->isHoe()) {
         if (($player->gamemode & 0x1) === 0) {
             $item->useOn($this);
         }
         $this->level->setBlock($this, new FarmlandBlock());
         return true;
     }
     return false;
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:17,代码来源:Grass.php

示例4: onActivate

 public function onActivate(Item $item, Player $player)
 {
     if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
         //Bonemeal
         if ($this->getSide(0)->getID() !== SUGARCANE_BLOCK) {
             for ($y = 1; $y < 3; ++$y) {
                 $b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
                 if ($b->getID() === AIR) {
                     $this->level->setBlock($b, new SugarcaneBlock(), true, false, true);
                     break;
                 }
             }
             $this->meta = 0;
             $this->level->setBlock($this, $this, true, false, true);
         }
         if (($player->gamemode & 0x1) === 0) {
             $item->count--;
         }
         return true;
     }
     return false;
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:22,代码来源:Sugarcane.php

示例5: putSlot

 protected function putSlot(Item $item)
 {
     $this->putShort($item->getID());
     $this->putByte($item->count);
     $this->putShort($item->getMetadata());
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:6,代码来源:RakNetDataPacket.php

示例6: W_replace

 private function W_replace($selection, Item $block1, $blocks2, &$output = null)
 {
     if (!is_array($selection) or $selection[0] === false or $selection[1] === false or $selection[0][3] !== $selection[1][3]) {
         $output .= "Make a selection first.\n";
         return false;
     }
     $totalCount = $this->countBlocks($selection);
     if ($totalCount > 524288) {
         $send = false;
     } else {
         $send = true;
     }
     $level = $selection[0][3];
     $id1 = $block1->getID();
     $meta1 = $block1->getMetadata();
     $bcnt2 = count($blocks2) - 1;
     if ($bcnt2 < 0) {
         $output .= "Incorrect blocks.\n";
         return false;
     }
     $startX = min($selection[0][0], $selection[1][0]);
     $endX = max($selection[0][0], $selection[1][0]);
     $startY = min($selection[0][1], $selection[1][1]);
     $endY = max($selection[0][1], $selection[1][1]);
     $startZ = min($selection[0][2], $selection[1][2]);
     $endZ = max($selection[0][2], $selection[1][2]);
     $count = 0;
     for ($x = $startX; $x <= $endX; ++$x) {
         for ($y = $startY; $y <= $endY; ++$y) {
             for ($z = $startZ; $z <= $endZ; ++$z) {
                 $b = $level->getBlock(new Vector3($x, $y, $z));
                 if ($b->getID() === $id1 and ($meta1 === false or $b->getMetadata() === $meta1)) {
                     $count += (int) $level->setBlockRaw($b, $blocks2[mt_rand(0, $bcnt2)]->getBlock(), false, $send);
                 }
                 unset($b);
             }
         }
     }
     if ($send === false) {
         $forceSend = function ($X, $Y, $Z) {
             $this->changedCount[$X . ":" . $Y . ":" . $Z] = 4096;
         };
         $forceSend->bindTo($level, $level);
         for ($X = $startX >> 4; $X <= $endX >> 4; ++$X) {
             for ($Y = $startY >> 4; $Y <= $endY >> 4; ++$Y) {
                 for ($Z = $startZ >> 4; $Z <= $endZ >> 4; ++$Z) {
                     $forceSend($X, $Y, $Z);
                 }
             }
         }
     }
     $output .= "{$count} block(s) have been changed.\n";
     return true;
 }
开发者ID:KarNomz,项目名称:WorldEditor,代码行数:54,代码来源:WorldEditor.php

示例7: setSlot

 public function setSlot($s, Item $item, $update = true, $offset = 0)
 {
     $i = $this->getSlotIndex($s);
     $d = array("Count" => $item->count, "Slot" => $s, "id" => $item->getID(), "Damage" => $item->getMetadata());
     if ($i === false) {
         return false;
     } elseif ($item->getID() === AIR or $item->count <= 0) {
         if ($i >= 0) {
             unset($this->data["Items"][$i]);
         }
     } elseif ($i < 0) {
         $this->data["Items"][] = $d;
     } else {
         $this->data["Items"][$i] = $d;
     }
     $this->server->api->dhandle("tile.container.slot", array("tile" => $this, "slot" => $s, "offset" => $offset, "slotdata" => $item));
     if ($update === true and $this->scheduledUpdate === false) {
         $this->update();
     }
     return true;
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:21,代码来源:Tile.php

示例8: W_replace

 private function W_replace($selection, Item $block1, $blocks2, &$output = null)
 {
     if (!is_array($selection) or $selection[0] === false or $selection[1] === false or $selection[0][3] !== $selection[1][3]) {
         $output .= "Make a selection first.\n";
         return false;
     }
     $level = $selection[0][3];
     $id1 = $block1->getID();
     $meta1 = $block1->getMetadata();
     $bcnt2 = count($blocks2) - 1;
     if ($bcnt2 < 0) {
         $output .= "Incorrect blocks.\n";
         return false;
     }
     $startX = min($selection[0][0], $selection[1][0]);
     $endX = max($selection[0][0], $selection[1][0]);
     $startY = min($selection[0][1], $selection[1][1]);
     $endY = max($selection[0][1], $selection[1][1]);
     $startZ = min($selection[0][2], $selection[1][2]);
     $endZ = max($selection[0][2], $selection[1][2]);
     $count = 0;
     for ($x = $startX; $x <= $endX; ++$x) {
         for ($y = $startY; $y <= $endY; ++$y) {
             for ($z = $startZ; $z <= $endZ; ++$z) {
                 $b = $level->getBlock(new Vector3($x, $y, $z));
                 if ($b->getID() === $id1 and ($meta1 === false or $b->getMetadata() === $meta1)) {
                     $count += (int) $level->setBlock($b, $blocks2[mt_rand(0, $bcnt2)]->getBlock(), false);
                 }
             }
         }
     }
     $output .= "{$count} block(s) have been changed.\n";
     return true;
 }
开发者ID:ferryphiong,项目名称:Minecraft-MP-plugins,代码行数:34,代码来源:WorldEditor.php


注:本文中的Item::getMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。