Weird Painting spawn (WiP)

This commit is contained in:
Shoghi Cervantes Pueyo
2013-02-05 23:25:40 +01:00
parent 0be3379720
commit 1c05455514
8 changed files with 103 additions and 10 deletions

View File

@@ -194,11 +194,12 @@ class BlockAPI{
for($count = $stack; $count > 0; ){
$data["stack"] = min(64, $count);
$count -= $data["stack"];
$e = $this->server->api->entity->add(ENTITY_ITEM, $block, $data);
$server = ServerAPI::request();
$e = $server->api->entity->add(ENTITY_ITEM, $block, $data);
//$e->speedX = mt_rand(-10, 10) / 100;
//$e->speedY = mt_rand(0, 5) / 100;
//$e->speedZ = mt_rand(-10, 10) / 100;
$this->server->api->entity->spawnToAll($e->eid);
$server->api->entity->spawnToAll($e->eid);
}
}
}
@@ -262,6 +263,10 @@ class BlockAPI{
if($block->y > 127 or $block->y < 0){
return false;
}
if($item->isActivable === true and $item->onActivate($this, $player, $block, $target, $face, $fx, $fy, $fz)){
return $this->cancelAction($block);
}
if($item->isPlaceable()){
$hand = $item->getBlock();

View File

@@ -27,10 +27,15 @@ the Free Software Foundation, either version 3 of the License, or
class ServerAPI{
var $restart = false;
private static $serverRequest = false;
private $server;
private $config;
private $apiList = array();
public static function request(){
return self::$serverRequest;
}
public function run(){
$this->load();
return $this->init();
@@ -107,6 +112,7 @@ class ServerAPI{
$this->parseProperties();
define("DEBUG", $this->getProperty("debug"));
$this->server = new PocketMinecraftServer($this->getProperty("server-name"), $this->getProperty("gamemode"), false, $this->getProperty("port"), $this->getProperty("server-id"), $this->getProperty("server-ip"));
self::$serverRequest = $this->server;
$this->setProperty("server-id", $this->server->serverID);
$this->server->api = $this;
if($this->getProperty("upnp-forwarding") === true){