diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 410ac45e5..ec2f2685b 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -110,9 +110,18 @@ class BlockAPI{ if(!isset($b[1])){ $meta = 0; }else{ - $meta = (int) $b[1]; + $meta = ((int) $b[1]) & 0xFFFF; } - $block = ((int) $b[0]) & 0xFFFF; + + if(defined(strtoupper($b[0]))){ + $item = BlockAPI::getItem(constant(strtoupper($b[0])), $meta); + if($item->getID() === 0){ + $item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta); + } + }else{ + $item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta); + } + if(!isset($params[2])){ $amount = 64; }else{ @@ -122,9 +131,8 @@ class BlockAPI{ $meta = ((int) $params[3]) & 0xFFFF; } if(($player = $this->server->api->player->get($username)) !== false){ - $this->drop($player->entity->x - 0.5, $player->entity->y, $player->entity->z - 0.5, $block, $meta, $amount); - $b = BlockAPI::get($block, $meta); - console("[INFO] Giving ".$amount." of ".$b->getName()." (".$block.":".$meta.") to ".$username); + $this->drop($player->entity->x - 0.5, $player->entity->y, $player->entity->z - 0.5, $item->getID(), $item->getMetadata(), $amount); + console("[INFO] Giving ".$amount." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$username); }else{ console("[INFO] Unknown player"); } diff --git a/src/classes/material/Item.php b/src/classes/material/Item.php index 16d4fbe32..92b78a33c 100644 --- a/src/classes/material/Item.php +++ b/src/classes/material/Item.php @@ -30,6 +30,8 @@ require_once("classes/material/IDs.php"); class Item{ public static $class = array( SUGARCANE => "SugarcaneItem", + WHEAT_SEEDS => "WheatSeedsItem", + MELON_SEEDS => "MelonSeedsItem", ); protected $block; protected $id; diff --git a/src/classes/material/block/plant/Sugarcane.php b/src/classes/material/block/plant/Sugarcane.php index 43df988f4..132d3bf06 100644 --- a/src/classes/material/block/plant/Sugarcane.php +++ b/src/classes/material/block/plant/Sugarcane.php @@ -41,7 +41,7 @@ class SugarcaneBlock extends TransparentBlock{ $down = $level->getBlockFace($block, 0); if($down->getID() === SUGARCANE_BLOCK){ $level->setBlock($block, $this->id, 0); - return true; + return true; }elseif($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 12){ $block0 = $level->getBlockFace($down, 2); $block1 = $level->getBlockFace($down, 3); diff --git a/src/classes/world/Entity.php b/src/classes/world/Entity.php index b2d550523..b7fde1c0d 100644 --- a/src/classes/world/Entity.php +++ b/src/classes/world/Entity.php @@ -260,7 +260,7 @@ class Entity extends stdClass{ if($this->speedZ != 0){ $this->z += $this->speedZ * 5; } - if(isset($blockDown->isFlowable === true){ + if($blockDown->isFlowable === true){ $this->speedY -= 0.04 * 5; //$this->server->api->handle("entity.motion", $this); }elseif($this->speedY < 0){ @@ -271,7 +271,7 @@ class Entity extends stdClass{ //$this->server->api->handle("entity.motion", $this); } }else{ - if(isset($blockDown->isFlowable === true){ + if($blockDown->isFlowable === true){ if($this->fallY === false or $y > $this->fallY){ $this->fallY = $y; }