mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
commit
1350e1bc4e
@ -22,7 +22,6 @@
|
||||
|
||||
/***REM_START***/
|
||||
require_once(dirname(__FILE__)."/src/config.php");
|
||||
require_once(FILE_PATH . "/src/language/en_us.php");
|
||||
|
||||
require_once(FILE_PATH."/src/functions.php");
|
||||
require_once(FILE_PATH."/src/dependencies.php");
|
||||
|
153
src/API/AchievementAPI.php
Normal file
153
src/API/AchievementAPI.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class AchievementAPI{
|
||||
public static $achievements = array(
|
||||
/*"openInventory" => array(
|
||||
"name" => "Taking Inventory",
|
||||
"requires" => array(),
|
||||
),*/
|
||||
"mineWood" => array(
|
||||
"name" => "Getting Wood",
|
||||
"requires" => array(
|
||||
//"openInventory",
|
||||
),
|
||||
),
|
||||
"buildWorkBench" => array(
|
||||
"name" => "Benchmarking",
|
||||
"requires" => array(
|
||||
"mineWood",
|
||||
),
|
||||
),
|
||||
"buildPickaxe" => array(
|
||||
"name" => "Time to Mine!",
|
||||
"requires" => array(
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"buildFurnace" => array(
|
||||
"name" => "Hot Topic",
|
||||
"requires" => array(
|
||||
"buildPickaxe",
|
||||
),
|
||||
),
|
||||
"acquireIron" => array(
|
||||
"name" => "Acquire hardware",
|
||||
"requires" => array(
|
||||
"buildFurnace",
|
||||
),
|
||||
),
|
||||
"buildHoe" => array(
|
||||
"name" => "Time to Farm!",
|
||||
"requires" => array(
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"makeBread" => array(
|
||||
"name" => "Bake Bread",
|
||||
"requires" => array(
|
||||
"buildHoe",
|
||||
),
|
||||
),
|
||||
"bakeCake" => array(
|
||||
"name" => "The Lie",
|
||||
"requires" => array(
|
||||
"buildHoe",
|
||||
),
|
||||
),
|
||||
"buildBetterPickaxe" => array(
|
||||
"name" => "Getting an Upgrade",
|
||||
"requires" => array(
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"buildSword" => array(
|
||||
"name" => "Time to Strike!",
|
||||
"requires" => array(
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"diamonds" => array(
|
||||
"name" => "DIAMONDS!",
|
||||
"requires" => array(
|
||||
"acquireIron",
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
function __construct(){
|
||||
}
|
||||
|
||||
public static function broadcastAchievement(Player $player, $achievementId){
|
||||
if(ServerAPI::request()->api->getProperty("announce-player-achievements") == true){
|
||||
ServerAPI::request()->api->chat->broadcast($player->username." has just earned the achievement ".self::$achievements[$achievementId]["name"]);
|
||||
}else{
|
||||
$player->sendChat("You have just earned the achievement ".self::$achievements[$achievementId]["name"]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function addAchievement($achievementId, $achievementName, array $requires = array()){
|
||||
if(!isset(self::$achievements[$achievementId])){
|
||||
self::$achievements[$achievementId] = array(
|
||||
"name" => $achievementName,
|
||||
"requires" => $requires,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function hasAchievement(Player $player, $achievementId){
|
||||
if(!isset(self::$achievements[$achievementId]) or !isset($player->achievements)){
|
||||
$player->achievements = array();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isset($player->achievements[$achievementId]) or $player->achievements[$achievementId] == false){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function grantAchievement(Player $player, $achievementId){
|
||||
if(isset(self::$achievements[$achievementId]) and !self::hasAchievement($player, $achievementId)){
|
||||
foreach(self::$achievements[$achievementId]["requires"] as $requerimentId){
|
||||
if(!self::hasAchievement($player, $requerimentId)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$player->achievements[$achievementId] = true;
|
||||
self::broadcastAchievement($player, $achievementId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function removeAchievement(Player $player, $achievementId){
|
||||
if(self::hasAchievement($player, $achievementId)){
|
||||
$player->achievements[$achievementId] = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function init(){
|
||||
}
|
||||
}
|
@ -273,7 +273,7 @@ class ConsoleAPI{
|
||||
return;
|
||||
}
|
||||
if($this->loop->line !== false){
|
||||
$line = trim($this->loop->line);
|
||||
$line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($this->loop->line));
|
||||
$this->loop->line = false;
|
||||
$output = $this->run($line, "console");
|
||||
if($output != ""){
|
||||
|
@ -449,6 +449,7 @@ class PlayerAPI{
|
||||
"health" => 20,
|
||||
"lastIP" => "",
|
||||
"lastID" => 0,
|
||||
"achievements" => array(),
|
||||
);
|
||||
|
||||
if(!file_exists(DATA_PATH."players/".$iname.".yml")){
|
||||
|
@ -61,6 +61,7 @@ class ServerAPI{
|
||||
"memory-limit" => "128M",
|
||||
"last-update" => false,
|
||||
"white-list" => false,
|
||||
"announce-player-achievements" => true,
|
||||
"spawn-protection" => 16,
|
||||
"view-distance" => 10,
|
||||
"max-players" => 20,
|
||||
@ -276,6 +277,10 @@ class ServerAPI{
|
||||
}
|
||||
|
||||
public function init(){
|
||||
if(!(self::$serverRequest instanceof PocketMinecraftServer)){
|
||||
self::$serverRequest = $this->server;
|
||||
}
|
||||
|
||||
if($this->getProperty("send-usage") !== false){
|
||||
$this->server->schedule(6000, array($this, "sendUsage"), array(), true); //Send the info after 5 minutes have passed
|
||||
$this->sendUsage();
|
||||
|
@ -58,6 +58,7 @@ class Player{
|
||||
public $windowCnt = 2;
|
||||
public $windows = array();
|
||||
public $blocked = true;
|
||||
public $achievements = array();
|
||||
public $chunksLoaded = array();
|
||||
private $chunksOrder = array();
|
||||
private $lastMeasure = 0;
|
||||
@ -216,6 +217,7 @@ class Player{
|
||||
|
||||
public function save(){
|
||||
if($this->entity instanceof Entity){
|
||||
$this->data->set("achievements", $this->achievements);
|
||||
$this->data->set("position", array(
|
||||
"level" => $this->entity->level->getName(),
|
||||
"x" => $this->entity->x,
|
||||
@ -534,6 +536,14 @@ class Player{
|
||||
if(($this->gamemode & 0x01) === 0x00){
|
||||
$this->addItem($data["entity"]->type, $data["entity"]->meta, $data["entity"]->stack, false);
|
||||
}
|
||||
switch($data["entity"]->type){
|
||||
case WOOD:
|
||||
AchievementAPI::grantAchievement($this, "mineWood");
|
||||
break;
|
||||
case DIAMOND:
|
||||
AchievementAPI::grantAchievement($this, "diamond");
|
||||
break;
|
||||
}
|
||||
}elseif($data["entity"]->level === $this->level){
|
||||
$this->dataPacket(MC_TAKE_ITEM_ENTITY, $data);
|
||||
}
|
||||
@ -740,6 +750,40 @@ class Player{
|
||||
}else{
|
||||
$this->setSlot($slot, BlockAPI::getItem($item->getID(), $item->getMetadata(), $s->count + $item->count), false);
|
||||
}
|
||||
|
||||
switch($item->getID()){
|
||||
case WORKBENCH:
|
||||
AchievementAPI::grantAchievement($this, "buildWorkBench");
|
||||
break;
|
||||
case WOODEN_PICKAXE:
|
||||
AchievementAPI::grantAchievement($this, "buildPickaxe");
|
||||
break;
|
||||
case FURNACE:
|
||||
AchievementAPI::grantAchievement($this, "buildFurnace");
|
||||
break;
|
||||
case WOODEN_HOE:
|
||||
AchievementAPI::grantAchievement($this, "buildHoe");
|
||||
break;
|
||||
case BREAD:
|
||||
AchievementAPI::grantAchievement($this, "makeBread");
|
||||
break;
|
||||
case CAKE:
|
||||
AchievementAPI::grantAchievement($this, "bakeCake");
|
||||
break;
|
||||
case STONE_PICKAXE:
|
||||
case GOLD_PICKAXE:
|
||||
case IRON_PICKAXE:
|
||||
case DIAMOND_PICKAXE:
|
||||
AchievementAPI::grantAchievement($this, "buildBetterPickaxe");
|
||||
break;
|
||||
case WOODEN_SWORD:
|
||||
AchievementAPI::grantAchievement($this, "buildSword");
|
||||
break;
|
||||
case DIAMOND:
|
||||
AchievementAPI::grantAchievement($this, "diamond");
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
@ -852,8 +896,9 @@ class Player{
|
||||
"x" => $pos->x,
|
||||
"y" => $pos->y,
|
||||
"z" => $pos->z,
|
||||
"yaw" => $yaw,
|
||||
"bodyYaw" => $yaw,
|
||||
"pitch" => $pitch,
|
||||
"yaw" => $yaw,
|
||||
));
|
||||
}
|
||||
|
||||
@ -1199,6 +1244,7 @@ class Player{
|
||||
}
|
||||
$this->data->set("inventory", $inv);
|
||||
}
|
||||
$this->achievements = $this->data->get("achievements");
|
||||
$this->data->set("caseusername", $this->username);
|
||||
$this->inventory = array();
|
||||
foreach($this->data->get("inventory") as $slot => $item){
|
||||
@ -1216,9 +1262,8 @@ class Player{
|
||||
$this->data->set("lastIP", $this->ip);
|
||||
$this->data->set("lastID", $this->clientID);
|
||||
|
||||
if($this->data instanceof Config){
|
||||
$this->server->api->player->saveOffline($this->data);
|
||||
}
|
||||
$this->server->api->player->saveOffline($this->data);
|
||||
|
||||
$this->dataPacket(MC_LOGIN_STATUS, array(
|
||||
"status" => 0,
|
||||
));
|
||||
@ -1310,6 +1355,20 @@ class Player{
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MC_ROTATE_HEAD:
|
||||
if($this->spawned === false){
|
||||
break;
|
||||
}
|
||||
if(($this->entity instanceof Entity)){
|
||||
if($this->blocked === true or $this->server->api->handle("player.move", $this->entity) === false){
|
||||
if($this->lastCorrect instanceof Vector3){
|
||||
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
||||
}
|
||||
}else{
|
||||
$this->entity->setPosition($this->entity, $data["yaw"], $data["pitch"]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MC_MOVE_PLAYER:
|
||||
if($this->spawned === false){
|
||||
break;
|
||||
@ -1340,7 +1399,6 @@ class Player{
|
||||
if($this->spawned === false){
|
||||
break;
|
||||
}
|
||||
|
||||
$data["eid"] = $this->eid;
|
||||
$data["player"] = $this;
|
||||
|
||||
@ -1707,6 +1765,7 @@ class Player{
|
||||
RAW_CHICKEN => 2,
|
||||
MELON_SLICE => 2,
|
||||
GOLDEN_APPLE => 10,
|
||||
PUMPKIN_PIE => 8,
|
||||
//COOKIE => 2,
|
||||
//COOKED_FISH => 5,
|
||||
//RAW_FISH => 2,
|
||||
@ -1925,6 +1984,15 @@ class Player{
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
if($tile->class === TILE_FURNACE and $data["slot"] == 2){
|
||||
switch($slot->getID()){
|
||||
case IRON_INGOT:
|
||||
AchievementAPI::grantAchievement($this, "acquireIron");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($item->getID() !== AIR and $slot->getID() == $item->getID()){
|
||||
if($slot->count < $item->count){
|
||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count - $slot->count, false) === false){
|
||||
|
@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
COMPILER_VERSION="0.13"
|
||||
COMPILER_VERSION="0.14"
|
||||
|
||||
PHP_VERSION="5.5.3"
|
||||
PHP_VERSION="5.5.6"
|
||||
ZEND_VM="GOTO"
|
||||
|
||||
LIBEDIT_VERSION="0.3"
|
||||
ZLIB_VERSION="1.2.8"
|
||||
PTHREADS_VERSION="0.0.44"
|
||||
CURL_VERSION="curl-7_32_0"
|
||||
PTHREADS_VERSION="0.0.45"
|
||||
CURL_VERSION="curl-7_33_0"
|
||||
|
||||
echo "[PocketMine] PHP installer and compiler for Linux & Mac"
|
||||
DIR="$(pwd)"
|
||||
|
@ -59,9 +59,9 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH);
|
||||
ini_set("memory_limit", "128M"); //Default
|
||||
define("LOG", true);
|
||||
define("START_TIME", microtime(true));
|
||||
define("MAJOR_VERSION", "Alpha_1.3.10dev");
|
||||
define("CURRENT_MINECRAFT_VERSION", "0.7.6 alpha");
|
||||
define("CURRENT_API_VERSION", 10);
|
||||
define("MAJOR_VERSION", "Alpha_1.3.11dev");
|
||||
define("CURRENT_MINECRAFT_VERSION", "v0.8.0 alpha build 2");
|
||||
define("CURRENT_API_VERSION", 11);
|
||||
define("CURRENT_PHP_VERSION", "5.5");
|
||||
$gitsha1 = false;
|
||||
if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information!
|
||||
|
@ -45,7 +45,7 @@ define("WOOD", 17);
|
||||
define("TRUNK", 17);
|
||||
define("LEAVES", 18);
|
||||
define("LEAVE", 18);
|
||||
|
||||
define("SPONGE", 19);
|
||||
define("GLASS", 20);
|
||||
define("LAPIS_ORE", 21);
|
||||
define("LAPIS_BLOCK", 22);
|
||||
@ -120,12 +120,15 @@ define("REEDS", 83);
|
||||
define("SUGARCANE_BLOCK", 83);
|
||||
|
||||
define("FENCE", 85);
|
||||
|
||||
define("PUMPKIN", 86);
|
||||
define("NETHERRACK", 87);
|
||||
define("SOUL_SAND", 88);
|
||||
define("GLOWSTONE", 89);
|
||||
define("GLOWSTONE_BLOCK", 89);
|
||||
|
||||
|
||||
define("LIT_PUMPKIN", 91);
|
||||
define("JACK_O_LANTERN", 91);
|
||||
define("CAKE_BLOCK", 92);
|
||||
|
||||
define("TRAPDOOR", 96);
|
||||
@ -133,10 +136,12 @@ define("TRAPDOOR", 96);
|
||||
define("STONE_BRICKS", 98);
|
||||
define("STONE_BRICK", 98);
|
||||
|
||||
define("IRON_BAR", 101);
|
||||
define("IRON_BARS", 101);
|
||||
define("GLASS_PANE", 102);
|
||||
define("GLASS_PANEL", 102);
|
||||
define("MELON_BLOCK", 103);
|
||||
|
||||
define("PUMPKIN_STEM", 104);
|
||||
define("MELON_STEM", 105);
|
||||
|
||||
define("FENCE_GATE", 107);
|
||||
@ -150,9 +155,24 @@ define("NETHER_BRICKS_STAIRS", 114);
|
||||
|
||||
define("SANDSTONE_STAIRS", 128);
|
||||
|
||||
define("SPRUCE_WOOD_STAIRS", 134);
|
||||
define("SPRUCE_WOODEN_STAIRS", 134);
|
||||
define("BIRCH_WOOD_STAIRS", 135);
|
||||
define("BIRCH_WOODEN_STAIRS", 135);
|
||||
define("JUNGLE_WOOD_STAIRS", 136);
|
||||
define("JUNGLE_WOODEN_STAIRS", 136);
|
||||
|
||||
define("COBBLE_WALL", 139);
|
||||
define("STONE_WALL", 139);
|
||||
define("COBBLESTONE_WALL", 139);
|
||||
|
||||
define("QUARTZ_BLOCK", 155);
|
||||
define("QUARTZ_STAIRS", 156);
|
||||
|
||||
define("HAY_BALE", 170);
|
||||
|
||||
define("COAL_BLOCK", 173);
|
||||
|
||||
define("STONECUTTER", 245);
|
||||
define("GLOWING_OBSIDIAN", 246);
|
||||
define("NETHER_REACTOR", 247);
|
||||
|
@ -100,7 +100,7 @@ define("BUCKET", 325);
|
||||
|
||||
|
||||
define("IRON_DOOR", 330);
|
||||
|
||||
define("REDSTONE_DUST", 331);
|
||||
define("SNOWBALL", 332);
|
||||
|
||||
define("LEATHER", 334);
|
||||
@ -116,6 +116,7 @@ define("SLIMEBALL", 341);
|
||||
define("EGG", 344);
|
||||
define("COMPASS", 345);
|
||||
|
||||
define("CLOCK", 347);
|
||||
define("GLOWSTONE_DUST", 348);
|
||||
//define("RAW_FISH", 349);
|
||||
//define("COOKED_FISH", 350);
|
||||
@ -132,7 +133,7 @@ define("BED", 355);
|
||||
define("SHEARS", 359);
|
||||
define("MELON", 360);
|
||||
define("MELON_SLICE", 360);
|
||||
|
||||
define("PUMPKIN_SEEDS", 361);
|
||||
define("MELON_SEEDS", 362);
|
||||
define("RAW_BEEF", 363);
|
||||
define("STEAK", 364);
|
||||
@ -143,6 +144,8 @@ define("COOKED_CHICKEN", 366);
|
||||
|
||||
define("SPAWN_EGG", 383);
|
||||
|
||||
define("PUMPKIN_PIE", 400);
|
||||
|
||||
define("NETHER_BRICK", 405);
|
||||
define("QUARTZ", 406);
|
||||
define("NETHER_QUARTZ", 406);
|
||||
|
@ -26,7 +26,7 @@ require_once(FILE_PATH."/src/functions.php");
|
||||
/***REM_END***/
|
||||
define(DATA_PATH, realpath(arg("data-path", FILE_PATH))."/");
|
||||
|
||||
if(arg("enable-ansi", strpos(strtoupper(php_uname("s")), "WIN") === 0 ? false:true) === true){
|
||||
if(arg("enable-ansi", strpos(strtoupper(php_uname("s")), "WIN") === 0 ? false:true) === true and arg("disable-ansi", false) !== true){
|
||||
define("ENABLE_ANSI", true);
|
||||
}else{
|
||||
define("ENABLE_ANSI", false);
|
||||
|
@ -40,6 +40,7 @@ abstract class Block extends Position{
|
||||
COAL_ORE => "CoalOreBlock",
|
||||
WOOD => "WoodBlock",
|
||||
LEAVES => "LeavesBlock",
|
||||
SPONGE => "SpongeBlock",
|
||||
GLASS => "GlassBlock",
|
||||
LAPIS_ORE => "LapisOreBlock",
|
||||
LAPIS_BLOCK => "LapisBlock",
|
||||
@ -94,20 +95,22 @@ abstract class Block extends Position{
|
||||
SUGARCANE_BLOCK => "SugarcaneBlock",
|
||||
|
||||
FENCE => "FenceBlock",
|
||||
|
||||
PUMPKIN => "PumpkinBlock",
|
||||
NETHERRACK => "NetherrackBlock",
|
||||
SOUL_SAND => "SoulSandBlock",
|
||||
GLOWSTONE_BLOCK => "GlowstoneBlock",
|
||||
|
||||
LIT_PUMPKIN => "LitPumpkinBlock",
|
||||
CAKE_BLOCK => "CakeBlock",
|
||||
|
||||
TRAPDOOR => "TrapdoorBlock",
|
||||
|
||||
STONE_BRICKS => "StoneBricksBlock",
|
||||
|
||||
IRON_BARS => "IronBarsBlock",
|
||||
GLASS_PANE => "GlassPaneBlock",
|
||||
MELON_BLOCK => "MelonBlock",
|
||||
|
||||
PUMPKIN_STEM => "PumpkinStemBlock",
|
||||
MELON_STEM => "MelonStemBlock",
|
||||
|
||||
FENCE_GATE => "FenceGateBlock",
|
||||
@ -119,9 +122,18 @@ abstract class Block extends Position{
|
||||
NETHER_BRICKS_STAIRS => "NetherBricksStairsBlock",
|
||||
|
||||
SANDSTONE_STAIRS => "SandstoneStairsBlock",
|
||||
|
||||
SPRUCE_WOOD_STAIRS => "SpruceWoodStairsBlock",
|
||||
BIRCH_WOOD_STAIRS => "BirchWoodStairsBlock",
|
||||
JUNGLE_WOOD_STAIRS => "JungleWoodStairsBlock",
|
||||
STONE_WALL => "StoneWallBlock",
|
||||
|
||||
QUARTZ_BLOCK => "QuartzBlock",
|
||||
QUARTZ_STAIRS => "QuartzStairsBlock",
|
||||
|
||||
HAY_BALE => "HayBaleBlock",
|
||||
|
||||
COAL_BLOCK => "CoalBlock",
|
||||
|
||||
STONECUTTER => "StonecutterBlock",
|
||||
GLOWING_OBSIDIAN => "GlowingObsidianBlock",
|
||||
|
@ -23,6 +23,7 @@ class Item{
|
||||
public static $class = array(
|
||||
SUGARCANE => "SugarcaneItem",
|
||||
WHEAT_SEEDS => "WheatSeedsItem",
|
||||
PUMPKIN_SEEDS => "PumpkinSeedsItem",
|
||||
MELON_SEEDS => "MelonSeedsItem",
|
||||
SIGN => "SignItem",
|
||||
WOODEN_DOOR => "WoodenDoorItem",
|
||||
|
@ -31,17 +31,13 @@ class LavaBlock extends LiquidBlock{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function getSourceCount()
|
||||
{
|
||||
public function getSourceCount(){
|
||||
$count = 0;
|
||||
for($side = 2; $side <= 5; ++$side)
|
||||
{
|
||||
if( $this->getSide($side) instanceof LavaBlock )
|
||||
{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
if($this->getSide($side) instanceof LavaBlock ){
|
||||
$b = $this->getSide($side);
|
||||
$level = $b->meta & 0x07;
|
||||
if($level == 0x00)
|
||||
{
|
||||
if($level == 0x00){
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
@ -49,37 +45,27 @@ class LavaBlock extends LiquidBlock{
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function checkWater()
|
||||
{
|
||||
for($side = 1; $side <= 5; ++$side)
|
||||
{
|
||||
public function checkWater(){
|
||||
for($side = 1; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b instanceof WaterBlock)
|
||||
{
|
||||
if($b instanceof WaterBlock){
|
||||
$level = $this->meta & 0x07;
|
||||
if($level == 0x00)
|
||||
{
|
||||
if($level == 0x00){
|
||||
$this->level->setBlock($this, new ObsidianBlock(), false, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
$this->level->setBlock($this, new CobblestoneBlock(), false, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getFrom()
|
||||
{
|
||||
for($side = 0; $side <= 5; ++$side)
|
||||
{
|
||||
public function getFrom(){
|
||||
for($side = 0; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b instanceof LavaBlock)
|
||||
{
|
||||
if($b instanceof LavaBlock){
|
||||
$tlevel = $b->meta & 0x07;
|
||||
$level = $this->meta & 0x07;
|
||||
if( ($tlevel + 2) == $level || ($side == 0x01 && $level == 0x01 ) || ($tlevel == 6 && $level == 7 ))
|
||||
{
|
||||
if( ($tlevel + 2) == $level || ($side == 0x01 && $level == 0x01 ) || ($tlevel == 6 && $level == 7 )){
|
||||
return $b;
|
||||
}
|
||||
}
|
||||
@ -95,66 +81,51 @@ class LavaBlock extends LiquidBlock{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( $this->checkWater() ) { return; }
|
||||
if( $this->checkWater()){
|
||||
return;
|
||||
}
|
||||
|
||||
$falling = $this->meta >> 3;
|
||||
$down = $this->getSide(0);
|
||||
|
||||
$from = $this->getFrom();
|
||||
//출처가 있거나 이 자체가 출처이면
|
||||
if($from !== null || $level == 0x00)
|
||||
{
|
||||
if($level !== 0x07)
|
||||
{
|
||||
if($down instanceof AirBlock || $down instanceof LavaBlock)
|
||||
{
|
||||
if($from !== null || $level == 0x00){
|
||||
if($level !== 0x07){
|
||||
if($down instanceof AirBlock || $down instanceof LavaBlock){
|
||||
$this->level->setBlock($down, new LavaBlock(0x01), false, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
for($side = 2; $side <= 5; ++$side)
|
||||
{
|
||||
}else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b instanceof LavaBlock)
|
||||
{
|
||||
if($b instanceof LavaBlock){
|
||||
|
||||
}
|
||||
else if($b->isFlowable === true)
|
||||
{
|
||||
}else if($b->isFlowable === true){
|
||||
$this->level->setBlock($b, new LavaBlock( min($level + 2,7) ), false, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
//Extend Remove for Left Lavas
|
||||
for($side = 2; $side <= 5; ++$side)
|
||||
{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$sb = $this->getSide($side);
|
||||
if($sb instanceof LavaBlock)
|
||||
{
|
||||
if($sb instanceof LavaBlock){
|
||||
$tlevel = $sb->meta & 0x07;
|
||||
if($tlevel != 0x00)
|
||||
{
|
||||
if($tlevel != 0x00){
|
||||
$this->level->setBlock($sb, new AirBlock(), false, false, true);
|
||||
}
|
||||
}
|
||||
$b = $this->getSide(0)->getSide($side);
|
||||
if($b instanceof LavaBlock)
|
||||
{
|
||||
if($b instanceof LavaBlock){
|
||||
$tlevel = $b->meta & 0x07;
|
||||
if($tlevel != 0x00)
|
||||
{
|
||||
if($tlevel != 0x00){
|
||||
$this->level->setBlock($b, new AirBlock(), false, false, true);
|
||||
}
|
||||
}
|
||||
//ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
//출처가 제거된 경우 이 블록 제거
|
||||
|
||||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
}
|
||||
return false;
|
||||
|
@ -31,17 +31,13 @@ class WaterBlock extends LiquidBlock{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function getSourceCount()
|
||||
{
|
||||
public function getSourceCount(){
|
||||
$count = 0;
|
||||
for($side = 2; $side <= 5; ++$side)
|
||||
{
|
||||
if( $this->getSide($side) instanceof WaterBlock )
|
||||
{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
if( $this->getSide($side) instanceof WaterBlock ){
|
||||
$b = $this->getSide($side);
|
||||
$level = $b->meta & 0x07;
|
||||
if($level == 0x00)
|
||||
{
|
||||
if($level == 0x00){
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
@ -49,21 +45,17 @@ class WaterBlock extends LiquidBlock{
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function checkLava()
|
||||
{
|
||||
for($side = 0; $side <= 5; ++$side)
|
||||
{
|
||||
if($side == 1) { continue; }
|
||||
public function checkLava(){
|
||||
for($side = 0; $side <= 5; ++$side){
|
||||
if($side == 1){
|
||||
continue;
|
||||
}
|
||||
$b = $this->getSide($side);
|
||||
if($b instanceof LavaBlock)
|
||||
{
|
||||
if($b instanceof LavaBlock){
|
||||
$level = $b->meta & 0x07;
|
||||
if($level == 0x00)
|
||||
{
|
||||
if($level == 0x00){
|
||||
$this->level->setBlock($b, new ObsidianBlock(), false, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
$this->level->setBlock($b, new CobblestoneBlock(), false, false, true);
|
||||
}
|
||||
return true;
|
||||
@ -72,17 +64,13 @@ class WaterBlock extends LiquidBlock{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFrom()
|
||||
{
|
||||
for($side = 0; $side <= 5; ++$side)
|
||||
{
|
||||
public function getFrom(){
|
||||
for($side = 0; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b instanceof WaterBlock)
|
||||
{
|
||||
if($b instanceof WaterBlock){
|
||||
$tlevel = $b->meta & 0x07;
|
||||
$level = $this->meta & 0x07;
|
||||
if( ($tlevel + 1) == $level || ($side == 0x01 && $level == 0x01 ) )
|
||||
{
|
||||
if( ($tlevel + 1) == $level || ($side == 0x01 && $level == 0x01 )){
|
||||
return $b;
|
||||
}
|
||||
}
|
||||
@ -105,56 +93,39 @@ class WaterBlock extends LiquidBlock{
|
||||
|
||||
$from = $this->getFrom();
|
||||
//Has Source or Its Source
|
||||
if($from !== null || $level == 0x00)
|
||||
{
|
||||
if($level !== 0x07)
|
||||
{
|
||||
if($down instanceof AirBlock || $down instanceof WaterBlock)
|
||||
{
|
||||
if($from !== null || $level == 0x00){
|
||||
if($level !== 0x07){
|
||||
if($down instanceof AirBlock || $down instanceof WaterBlock){
|
||||
$this->level->setBlock($down, new WaterBlock(0x01), false, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
for($side = 2; $side <= 5; ++$side)
|
||||
{
|
||||
}else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b instanceof WaterBlock)
|
||||
{
|
||||
if( $this->getSourceCount() >= 2 && $level != 0x00)
|
||||
{
|
||||
if($b instanceof WaterBlock){
|
||||
if( $this->getSourceCount() >= 2 && $level != 0x00){
|
||||
$this->level->setBlock($this, new WaterBlock(0), false, false, true);
|
||||
}
|
||||
}
|
||||
else if($b->isFlowable === true)
|
||||
{
|
||||
}elseif($b->isFlowable === true){
|
||||
$this->level->setBlock($b, new WaterBlock($level + 1), false, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
//Extend Remove for Left Waters
|
||||
for($side = 2; $side <= 5; ++$side)
|
||||
{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$sb = $this->getSide($side);
|
||||
if($sb instanceof WaterBlock)
|
||||
{
|
||||
if($sb instanceof WaterBlock){
|
||||
$tlevel = $sb->meta & 0x07;
|
||||
if($tlevel != 0x00)
|
||||
{
|
||||
if($tlevel != 0x00){
|
||||
$this->level->setBlock($sb, new AirBlock(), false, false, true);
|
||||
}
|
||||
}
|
||||
$b = $this->getSide(0)->getSide($side);
|
||||
if($b instanceof WaterBlock)
|
||||
{
|
||||
if($b instanceof WaterBlock){
|
||||
$tlevel = $b->meta & 0x07;
|
||||
if($tlevel != 0x00)
|
||||
{
|
||||
if($tlevel != 0x00){
|
||||
$this->level->setBlock($b, new AirBlock(), false, false, true);
|
||||
}
|
||||
}
|
||||
|
27
src/material/block/nonfull/IronBars.php
Normal file
27
src/material/block/nonfull/IronBars.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class IronBarsBlock extends TransparentBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(IRON_BARS, 0, "Iron Bars");
|
||||
}
|
||||
|
||||
}
|
33
src/material/block/nonfull/StoneWall.php
Normal file
33
src/material/block/nonfull/StoneWall.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class StoneWallBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
$meta &= 0x01;
|
||||
parent::__construct(STONE_WALL, $meta, "Cobblestone Wall");
|
||||
if($meta === 1){
|
||||
$this->name = "Mossy Cobblestone Wall";
|
||||
}
|
||||
$this->isFullBlock = false;
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
}
|
32
src/material/block/nonfull/stairs/BirchWoodStairs.php
Normal file
32
src/material/block/nonfull/stairs/BirchWoodStairs.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class BirchWoodStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs");
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
}
|
32
src/material/block/nonfull/stairs/JungleWoodStairs.php
Normal file
32
src/material/block/nonfull/stairs/JungleWoodStairs.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class JungleWoodStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs");
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
}
|
32
src/material/block/nonfull/stairs/SpruceWoodStairs.php
Normal file
32
src/material/block/nonfull/stairs/SpruceWoodStairs.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class SpruceWoodStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs");
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@ class GlowingRedstoneOreBlock extends SolidBlock{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
//array(331, 4, mt_rand(4, 5)),
|
||||
array(REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
);
|
||||
}else{
|
||||
return array();
|
||||
|
@ -37,7 +37,7 @@ class RedstoneOreBlock extends SolidBlock{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 2){
|
||||
return array(
|
||||
//array(331, 4, mt_rand(4, 5)),
|
||||
array(REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
);
|
||||
}else{
|
||||
return array();
|
||||
|
87
src/material/block/plant/PumpkinStem.php
Normal file
87
src/material/block/plant/PumpkinStem.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class PumpkinStemBlock extends FlowableBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(PUMPKIN_STEM, $meta, "Pumpkin Stem");
|
||||
$this->isActivable = true;
|
||||
$this->hardness = 0;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(PUMPKIN_SEEDS, 0, mt_rand(0, 2)));
|
||||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
}elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b->getID() === PUMPKIN){
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
$side = $this->getSide(mt_rand(2,5));
|
||||
$d = $side->getSide(0);
|
||||
if($side->getID() === AIR and ($d->getID() === FARMLAND or $d->getID() === GRASS or $d->getID() === DIRT)){
|
||||
$this->level->setBlock($side, new PumpkinBlock(), true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
}
|
||||
}
|
57
src/material/block/solid/Coal.php
Normal file
57
src/material/block/solid/Coal.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class CoalBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(COAL_BLOCK, 0, "Coal Block");
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
switch($item->isPickaxe()){
|
||||
case 5:
|
||||
return 0.95;
|
||||
case 4:
|
||||
return 1.25;
|
||||
case 3:
|
||||
return 1.9;
|
||||
case 2:
|
||||
return 0.65;
|
||||
case 1:
|
||||
return 3.75;
|
||||
default:
|
||||
return 25;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(COAL_BLOCK, 0, 1),
|
||||
);
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
28
src/material/block/solid/HayBale.php
Normal file
28
src/material/block/solid/HayBale.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class HayBaleBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(HAY_BALE, "Hay Bale");
|
||||
$this->hardness = 10;
|
||||
}
|
||||
|
||||
}
|
28
src/material/block/solid/LitPumpkin.php
Normal file
28
src/material/block/solid/LitPumpkin.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class LitPumpkinBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(LIT_PUMPKIN, "Jack o'Lantern");
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
}
|
@ -22,6 +22,13 @@
|
||||
class PlanksBlock extends SolidBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(PLANKS, $meta, "Wooden Planks");
|
||||
$names = array(
|
||||
WoodBlock::OAK => "Oak Wooden Planks",
|
||||
WoodBlock::SPRUCE => "Spruce Wooden Planks",
|
||||
WoodBlock::BIRCH => "Birch Wooden Planks",
|
||||
WoodBlock::JUNGLE => "Jungle Wooden Planks",
|
||||
);
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
|
28
src/material/block/solid/Pumpkin.php
Normal file
28
src/material/block/solid/Pumpkin.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class PumpkinBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(PUMPKIN, "Pumpkin");
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
}
|
28
src/material/block/solid/Sponge.php
Normal file
28
src/material/block/solid/Sponge.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class SpongeBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(SPONGE, "Sponge");
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
}
|
@ -23,17 +23,38 @@ class WoodBlock extends SolidBlock{
|
||||
const OAK = 0;
|
||||
const SPRUCE = 1;
|
||||
const BIRCH = 2;
|
||||
const JUNGLE = 3;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(WOOD, $meta, "Wood");
|
||||
$names = array(
|
||||
WoodBlock::OAK => "Oak Wood",
|
||||
WoodBlock::SPRUCE => "Spruce Wood",
|
||||
WoodBlock::BIRCH => "Birch Wood",
|
||||
3 => "",
|
||||
WoodBlock::JUNGLE => "Jungle Wood",
|
||||
);
|
||||
$this->meta &= 0x03;
|
||||
$this->name = $names[$this->meta];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 10;
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
2 => 0b1000,
|
||||
3 => 0b1000,
|
||||
4 => 0b0100,
|
||||
5 => 0b0100,
|
||||
);
|
||||
|
||||
$this->meta = ($this->meta & 0x03) | $faces[$face];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x03, 1),
|
||||
);
|
||||
}
|
||||
}
|
27
src/material/item/generic/PumpkinSeeds.php
Normal file
27
src/material/item/generic/PumpkinSeeds.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class PumpkinSeedsItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
$this->block = BlockAPI::get(PUMPKIN_STEM);
|
||||
parent::__construct(PUMPKIN_SEEDS, 0, $count, "Pumpkin Seeds");
|
||||
}
|
||||
}
|
@ -367,21 +367,34 @@ class CustomPacketHandler{
|
||||
$this->raw .= Utils::writeFloat($this->data["pitch"]);
|
||||
}
|
||||
break;
|
||||
case MC_ROTATE_HEAD:
|
||||
if($this->c === false){
|
||||
$this->data["eid"] = Utils::readInt($this->get(4));
|
||||
$this->data["yaw"] = Utils::readFloat($this->get(4));
|
||||
$this->data["pitch"] = Utils::readFloat($this->get(4));
|
||||
}else{
|
||||
$this->raw .= Utils::writeInt($this->data["eid"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["yaw"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["pitch"]);
|
||||
}
|
||||
break;
|
||||
case MC_MOVE_PLAYER:
|
||||
if($this->c === false){
|
||||
$this->data["eid"] = Utils::readInt($this->get(4));
|
||||
$this->data["x"] = Utils::readFloat($this->get(4));
|
||||
$this->data["y"] = Utils::readFloat($this->get(4));
|
||||
$this->data["z"] = Utils::readFloat($this->get(4));
|
||||
$this->data["yaw"] = Utils::readFloat($this->get(4));
|
||||
$this->data["bodyYaw"] = Utils::readFloat($this->get(4));
|
||||
$this->data["pitch"] = Utils::readFloat($this->get(4));
|
||||
$this->data["yaw"] = Utils::readFloat($this->get(4));
|
||||
}else{
|
||||
$this->raw .= Utils::writeInt($this->data["eid"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["x"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["y"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["z"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["yaw"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["bodyYaw"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["pitch"]);
|
||||
$this->raw .= Utils::writeFloat($this->data["yaw"]);
|
||||
}
|
||||
break;
|
||||
case MC_PLACE_BLOCK:
|
||||
|
@ -23,7 +23,7 @@
|
||||
define("DEFLATEPACKET_LEVEL", 1);
|
||||
|
||||
define("CURRENT_STRUCTURE", 5);
|
||||
define("CURRENT_PROTOCOL", 12);
|
||||
define("CURRENT_PROTOCOL", 13);
|
||||
|
||||
define("RAKNET_MAGIC", "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78");
|
||||
|
||||
@ -41,6 +41,7 @@ define("MC_DISCONNECT", 0x15);
|
||||
|
||||
define("MC_BANNED", 0x17);
|
||||
|
||||
|
||||
define("MC_LOGIN", 0x82);
|
||||
define("MC_LOGIN_STATUS", 0x83);
|
||||
define("MC_READY", 0x84);
|
||||
@ -58,130 +59,47 @@ define("MC_TAKE_ITEM_ENTITY", 0x8f);
|
||||
define("MC_MOVE_ENTITY", 0x90);
|
||||
|
||||
define("MC_MOVE_ENTITY_POSROT", 0x93);
|
||||
define("MC_MOVE_PLAYER", 0x94);
|
||||
define("MC_PLACE_BLOCK", 0x95);
|
||||
define("MC_REMOVE_BLOCK", 0x96);
|
||||
define("MC_UPDATE_BLOCK", 0x97);
|
||||
define("MC_ADD_PAINTING", 0x98);
|
||||
define("MC_EXPLOSION", 0x99);
|
||||
define("MC_LEVEL_EVENT", 0x9a);
|
||||
define("MC_TILE_EVENT", 0x9b);
|
||||
define("MC_ENTITY_EVENT", 0x9c);
|
||||
define("MC_REQUEST_CHUNK", 0x9d);
|
||||
define("MC_CHUNK_DATA", 0x9e);
|
||||
define("MC_PLAYER_EQUIPMENT", 0x9f);
|
||||
define("MC_PLAYER_ARMOR_EQUIPMENT", 0xa0);
|
||||
define("MC_INTERACT", 0xa1);
|
||||
define("MC_USE_ITEM", 0xa2);
|
||||
define("MC_PLAYER_ACTION", 0xa3);
|
||||
define("MC_ROTATE_HEAD", 0x94);
|
||||
define("MC_MOVE_PLAYER", 0x95);
|
||||
define("MC_PLACE_BLOCK", 0x96);
|
||||
define("MC_REMOVE_BLOCK", 0x97);
|
||||
define("MC_UPDATE_BLOCK", 0x98);
|
||||
define("MC_ADD_PAINTING", 0x99);
|
||||
define("MC_EXPLOSION", 0x9a);
|
||||
define("MC_LEVEL_EVENT", 0x9b);
|
||||
define("MC_TILE_EVENT", 0x9c);
|
||||
define("MC_ENTITY_EVENT", 0x9d);
|
||||
define("MC_REQUEST_CHUNK", 0x9e);
|
||||
define("MC_CHUNK_DATA", 0x9f);
|
||||
define("MC_PLAYER_EQUIPMENT", 0xa0);
|
||||
define("MC_PLAYER_ARMOR_EQUIPMENT", 0xa1);
|
||||
define("MC_INTERACT", 0xa2);
|
||||
define("MC_USE_ITEM", 0xa3);
|
||||
define("MC_PLAYER_ACTION", 0xa4);
|
||||
|
||||
define("MC_HURT_ARMOR", 0xa5);
|
||||
define("MC_SET_ENTITY_DATA", 0xa6);
|
||||
define("MC_SET_ENTITY_MOTION", 0xa7);
|
||||
//define("MC_SET_RIDING_PACKET", 0xa8);
|
||||
define("MC_SET_HEALTH", 0xa9);
|
||||
define("MC_SET_SPAWN_POSITION", 0xaa);
|
||||
define("MC_ANIMATE", 0xab);
|
||||
define("MC_RESPAWN", 0xac);
|
||||
define("MC_SEND_INVENTORY", 0xad);
|
||||
define("MC_DROP_ITEM", 0xae);
|
||||
define("MC_CONTAINER_OPEN", 0xaf);
|
||||
define("MC_CONTAINER_CLOSE", 0xb0);
|
||||
define("MC_CONTAINER_SET_SLOT", 0xb1);
|
||||
define("MC_CONTAINER_SET_DATA", 0xb2);
|
||||
define("MC_CONTAINER_SET_CONTENT", 0xb3);
|
||||
//define("MC_CONTAINER_ACK", 0xb4);
|
||||
define("MC_CLIENT_MESSAGE", 0xb5);
|
||||
define("MC_ADVENTURE_SETTINGS", 0xb6);
|
||||
define("MC_ENTITY_DATA", 0xb7);
|
||||
define("MC_HURT_ARMOR", 0xa6);
|
||||
define("MC_SET_ENTITY_DATA", 0xa7);
|
||||
define("MC_SET_ENTITY_MOTION", 0xa8);
|
||||
//define("MC_SET_ENTITY_LINK", 0xa9);
|
||||
define("MC_SET_HEALTH", 0xaa);
|
||||
define("MC_SET_SPAWN_POSITION", 0xab);
|
||||
define("MC_ANIMATE", 0xac);
|
||||
define("MC_RESPAWN", 0xad);
|
||||
define("MC_SEND_INVENTORY", 0xae);
|
||||
define("MC_DROP_ITEM", 0xaf);
|
||||
define("MC_CONTAINER_OPEN", 0xb0);
|
||||
define("MC_CONTAINER_CLOSE", 0xb1);
|
||||
define("MC_CONTAINER_SET_SLOT", 0xb2);
|
||||
define("MC_CONTAINER_SET_DATA", 0xb3);
|
||||
define("MC_CONTAINER_SET_CONTENT", 0xb4);
|
||||
//define("MC_CONTAINER_ACK", 0xb5);
|
||||
define("MC_CLIENT_MESSAGE", 0xb6);
|
||||
define("MC_ADVENTURE_SETTINGS", 0xb7);
|
||||
define("MC_ENTITY_DATA", 0xb8);
|
||||
//define("MC_PLAYER_INPUT", 0xb9);
|
||||
|
||||
|
||||
class Protocol{
|
||||
public static $dataName = array(
|
||||
MC_PING => "Ping",
|
||||
|
||||
MC_CLIENT_CONNECT => "Client Connect",
|
||||
MC_SERVER_HANDSHAKE => "Server Handshake",
|
||||
|
||||
MC_CLIENT_HANDSHAKE => "Client Handshake",
|
||||
|
||||
//MC_SERVER_FULL => "Server Full",
|
||||
MC_DISCONNECT => "Disconnect",
|
||||
|
||||
0x18 => "Unknown",
|
||||
|
||||
MC_LOGIN => "Login",
|
||||
MC_LOGIN_STATUS => "Login Status",
|
||||
MC_READY => "Ready",
|
||||
MC_CHAT => "Chat",
|
||||
MC_SET_TIME => "Set Time",
|
||||
MC_START_GAME => "Start Game",
|
||||
|
||||
MC_ADD_MOB => "Add Mob",
|
||||
MC_ADD_PLAYER => "Add Player",
|
||||
|
||||
MC_ADD_ENTITY => "Add Entity",
|
||||
MC_REMOVE_ENTITY => "Remove Entity",
|
||||
MC_ADD_ITEM_ENTITY => "Add Item",
|
||||
MC_TAKE_ITEM_ENTITY => "Take Item",
|
||||
|
||||
MC_MOVE_ENTITY => "Move Entity",
|
||||
|
||||
MC_MOVE_ENTITY_POSROT => "Move Entity PosRot",
|
||||
MC_MOVE_PLAYER => "Move Player",
|
||||
MC_PLACE_BLOCK => "Place Block",
|
||||
MC_REMOVE_BLOCK => "Remove Block",
|
||||
MC_UPDATE_BLOCK => "Update Block",
|
||||
MC_ADD_PAINTING => "Add Painting",
|
||||
MC_EXPLOSION => "Explosion",
|
||||
|
||||
MC_LEVEL_EVENT => "Level Event",
|
||||
|
||||
MC_ENTITY_EVENT => "Entity Event",
|
||||
MC_REQUEST_CHUNK => "Chunk Request",
|
||||
MC_CHUNK_DATA => "Chunk Data",
|
||||
|
||||
MC_PLAYER_EQUIPMENT => "Player Equipment",
|
||||
MC_PLAYER_ARMOR_EQUIPMENT => "Player Armor",
|
||||
MC_INTERACT => "Interact",
|
||||
MC_USE_ITEM => "Use Item",
|
||||
MC_PLAYER_ACTION => "Player Action",
|
||||
MC_SET_ENTITY_DATA => "Entity Data",
|
||||
MC_SET_ENTITY_MOTION => "Entity Motion",
|
||||
MC_HURT_ARMOR => "Hurt Armor",
|
||||
MC_SET_HEALTH => "Set Health",
|
||||
MC_SET_SPAWN_POSITION => "Set Spawn Position",
|
||||
MC_ANIMATE => "Animate",
|
||||
MC_RESPAWN => "Respawn",
|
||||
MC_SEND_INVENTORY => "Send Inventory",
|
||||
MC_DROP_ITEM => "Drop Item",
|
||||
MC_CONTAINER_OPEN => "Open Container",
|
||||
MC_CONTAINER_CLOSE => "Close Container",
|
||||
MC_CONTAINER_SET_SLOT => "Set Container Slot",
|
||||
|
||||
MC_CLIENT_MESSAGE => "Client Message",
|
||||
MC_ADVENTURE_SETTINGS => "Adventure Settings",
|
||||
MC_ENTITY_DATA => "Entity Data",
|
||||
);
|
||||
|
||||
public static $packetName = array(
|
||||
0x01 => "ID_CONNECTED_PING_OPEN_CONNECTIONS", //RakNet
|
||||
0x02 => "ID_UNCONNECTED_PING_OPEN_CONNECTIONS", //RakNet
|
||||
0x05 => "ID_OPEN_CONNECTION_REQUEST_1", //RakNet
|
||||
0x06 => "ID_OPEN_CONNECTION_REPLY_1", //RakNet
|
||||
0x07 => "ID_OPEN_CONNECTION_REQUEST_2", //RakNet
|
||||
0x08 => "ID_OPEN_CONNECTION_REPLY_2", //RakNet
|
||||
0x1a => "ID_INCOMPATIBLE_PROTOCOL_VERSION", //RakNet
|
||||
0x1c => "ID_UNCONNECTED_PONG", //RakNet
|
||||
0x1d => "ID_ADVERTISE_SYSTEM", //RakNet
|
||||
0x80 => "Custom Packet", //Minecraft Implementation
|
||||
0x84 => "Custom Packet", //Minecraft Implementation
|
||||
0x88 => "Custom Packet", //Minecraft Implementation
|
||||
0x8c => "Custom Packet", //Minecraft Implementation
|
||||
0xa0 => "NACK", //Minecraft Implementation
|
||||
0xc0 => "ACK", //Minecraft Implementation
|
||||
);
|
||||
|
||||
class Protocol{
|
||||
public static $raknet = array(
|
||||
0x01 => array(
|
||||
"long", //Ping ID
|
||||
|
@ -132,7 +132,7 @@ class RCONInstance extends Thread{
|
||||
|
||||
public function run(){
|
||||
while($this->stop !== true){
|
||||
usleep(1);
|
||||
usleep(2000);
|
||||
$r = array($socket = $this->socket);
|
||||
$w = null;
|
||||
$e = null;
|
||||
|
@ -25,10 +25,14 @@ class CraftingRecipes{
|
||||
"CLAY:?x4=>CLAY_BLOCK:0x1",
|
||||
"WOODEN_PLANKS:?x4=>WORKBENCH:0x1",
|
||||
"GLOWSTONE_DUST:?x4=>GLOWSTONE_BLOCK:0x1",
|
||||
"PUMPKIN:?x1,TORCH:?x1=>LIT_PUMPKIN:0x1",
|
||||
"SNOWBALL:?x4=>SNOW_BLOCK:0x1",
|
||||
"WOODEN_PLANKS:?x2=>STICK:0x4",
|
||||
"COBBLESTONE:?x4=>STONECUTTER:0x1",
|
||||
"WOOD:?x1=>WOODEN_PLANKS:0x4",
|
||||
"WOOD:0x1=>WOODEN_PLANKS:0x4",
|
||||
"WOOD:1x1=>WOODEN_PLANKS:1x4",
|
||||
"WOOD:2x1=>WOODEN_PLANKS:2x4",
|
||||
"WOOD:3x1=>WOODEN_PLANKS:3x4",
|
||||
"WOOL:0x1,DYE:0x1=>WOOL:15x1",
|
||||
"WOOL:0x1,DYE:1x1=>WOOL:14x1",
|
||||
"WOOL:0x1,DYE:2x1=>WOOL:13x1",
|
||||
@ -52,10 +56,14 @@ class CraftingRecipes{
|
||||
"COAL:0x1,STICK:?x1=>TORCH:0x4",
|
||||
"COAL:1x1,STICK:?x1=>TORCH:0x4",
|
||||
|
||||
//Food & protection
|
||||
//Food & protection
|
||||
"MELON_SLICE:?x1=>MELON_SEEDS:0x1",
|
||||
"PUMPKIN:?x1=>PUMPKIN_SEEDS:0x4",
|
||||
"PUMPKIN:?x1,EGG:?x1,SUGAR:?x1=>PUMPKIN_PIE:0x1",
|
||||
"BROWN_MUSHROOM:?x1,RED_MUSHROOM:?x1,BOWL:?x1=>MUSHROOM_STEW:0x1",
|
||||
"SUGARCANE:?x1=>SUGAR:0x1",
|
||||
"MELON_SLICE:?x1=>MELON_SEEDS:0x1",
|
||||
"HAY_BALE:?x1=>WHEATH:0x9",
|
||||
|
||||
//Items
|
||||
"DIAMOND_BLOCK:?x1=>DIAMOND:0x9",
|
||||
@ -90,13 +98,21 @@ class CraftingRecipes{
|
||||
"DIAMOND:?x3,IRON_INGOT:?x6=>NETHER_REACTOR:0x1",
|
||||
"WOODEN_PLANKS:?x6=>TRAPDOOR:0x2",
|
||||
"WOODEN_PLANKS:?x6=>WOODEN_DOOR:0x1",
|
||||
"WOODEN_PLANKS:?x6=>WOODEN_STAIRS:0x4",
|
||||
"WOODEN_PLANKS:?x3=>SLAB:2x6",
|
||||
"WOODEN_PLANKS:0x6=>WOODEN_STAIRS:0x4",
|
||||
"WOODEN_PLANKS:0x3=>SLAB:2x6",
|
||||
"WOODEN_PLANKS:1x6=>SPRUCE_WOOD_STAIRS:0x4",
|
||||
//"WOODEN_PLANKS:1x3=>SPRUCE_WOOD_SLAB:2x6",
|
||||
"WOODEN_PLANKS:2x6=>BIRCH_WOOD_STAIRS:0x4",
|
||||
//"WOODEN_PLANKS:2x3=>BIRCH_WOOD_SLAB:2x6",
|
||||
"WOODEN_PLANKS:3x6=>JUNGLE_WOOD_STAIRS:0x4",
|
||||
//"WOODEN_PLANKS:3x3=>JUNGLE_WOOD_SLAB:2x6",
|
||||
|
||||
//Tools
|
||||
"STICK:?x1,FEATHER:?x1,FLINT:?x1=>ARROW:0x4",
|
||||
"STICK:?x3,STRING:?x3=>BOW:0x1",
|
||||
"IRON_INGOT:?x3=>BUCKET:0x1",
|
||||
"GOLD_INGOT:?x4,REDSTONE_DUST:?x1=>CLOCK:0x1",
|
||||
"IRON_INGOT:?x4,REDSTONE_DUST:?x1=>COMPASS:0x1",
|
||||
"DIAMOND:?x3,STICK:?x2=>DIAMOND_AXE:0x1",
|
||||
"DIAMOND:?x2,STICK:?x2=>DIAMOND_HOE:0x1",
|
||||
"DIAMOND:?x3,STICK:?x2=>DIAMOND_PICKAXE:0x1",
|
||||
@ -125,7 +141,7 @@ class CraftingRecipes{
|
||||
"WOODEN_PLANKS:?x2,STICK:?x1=>WOODEN_SWORD:0x1",
|
||||
|
||||
//Food & protection
|
||||
"WHEAT:?x3=>BREAD:0x1",
|
||||
"WHEATH:?x3=>BREAD:0x1",
|
||||
"WHEATH:?x3,BUCKET:1x3,EGG:?x1,SUGAR:?x2=>CAKE:0x1",
|
||||
"DIAMOND:?x4=>DIAMOND_BOOTS:0x1",
|
||||
"DIAMOND:?x8=>DIAMOND_CHESTPLATE:0x1",
|
||||
@ -152,12 +168,16 @@ class CraftingRecipes{
|
||||
"DIAMOND:?x9=>DIAMOND_BLOCK:0x1",
|
||||
"GOLD_INGOT:?x9=>GOLD_BLOCK:0x1",
|
||||
"IRON_INGOT:?x9=>IRON_BLOCK:0x1",
|
||||
"WHEATH:?x9=>HAY_BALE:0x1",
|
||||
"PAPER:?x3=>BOOK:0x1",
|
||||
"WOODEN_PLANKS:?x6,BOOK:?x3=>BOOKSHELF:0x1",
|
||||
"DYE:4x9=>LAPIS_BLOCK:0x1",
|
||||
"WOOL:?x1,STICK:?x8=>PAINTING:0x1",
|
||||
"SUGARCANE:?x3=>PAPER:0x1",
|
||||
"WOODEN_PLANKS:?x6,STICK:?x1=>SIGN:0x1",
|
||||
"IRON_INGOT:?x6=>IRON_BARS:0x16",
|
||||
"COAL:0x9=>COAL_BLOCK:0x1",
|
||||
"COAL_BLOCK:?x1=>COAL:0x9",
|
||||
);
|
||||
|
||||
private static $stone = array(
|
||||
@ -167,6 +187,8 @@ class CraftingRecipes{
|
||||
"BRICKS_BLOCK:?x3=>SLAB:4x6",
|
||||
"SLAB:6x2=>QUARTZ_BLOCK:1x1",
|
||||
"COBBLESTONE:?x3=>SLAB:3x6",
|
||||
"COBBLESTONE:0x6=>STONE_WALL:0x6",
|
||||
"MOSSY_STONE:0x6=>STONE_WALL:1x6",
|
||||
"NETHER_BRICK:?x4=>NETHER_BRICKS:0x1",
|
||||
"NETHER_BRICKS:?x6=>NETHER_BRICKS_STAIRS:0x4",
|
||||
"QUARTZ_BLOCK:0x2=>QUARTZ_BLOCK:2x2",
|
||||
|
@ -23,6 +23,7 @@
|
||||
class FuelData{
|
||||
public static $duration = array(
|
||||
COAL => 80,
|
||||
COAL_BLOCK => 800,
|
||||
TRUNK => 15,
|
||||
WOODEN_PLANKS => 15,
|
||||
SAPLING => 5,
|
||||
@ -35,6 +36,9 @@ class FuelData{
|
||||
FENCE => 15,
|
||||
FENCE_GATE => 15,
|
||||
WOODEN_STAIRS => 15,
|
||||
SPRUCE_WOOD_STAIRS => 15,
|
||||
BIRCH_WOOD_STAIRS => 15,
|
||||
JUNGLE_WOOD_STAIRS => 15,
|
||||
TRAPDOOR => 15,
|
||||
WORKBENCH => 15,
|
||||
BOOKSHELF => 15,
|
||||
|
@ -150,11 +150,27 @@ class Config{
|
||||
}
|
||||
}
|
||||
|
||||
public function get($k){
|
||||
public function &__get($k){
|
||||
return $this->get($k);
|
||||
}
|
||||
|
||||
public function __set($k, $v){
|
||||
return $this->set($k, $v);
|
||||
}
|
||||
|
||||
public function __isset($k){
|
||||
return $this->exists($k);
|
||||
}
|
||||
|
||||
public function __unset($k){
|
||||
return $this->remove($k);
|
||||
}
|
||||
|
||||
public function &get($k){
|
||||
if($this->correct === false or !isset($this->config[$k])){
|
||||
return false;
|
||||
}
|
||||
return ($this->config[$k]);
|
||||
return $this->config[$k];
|
||||
}
|
||||
|
||||
public function set($k, $v = true){
|
||||
|
@ -167,9 +167,7 @@ class Entity extends Position{
|
||||
$inv[] = array($slot->getID(), $slot->getMetadata(), $slot->count);
|
||||
}
|
||||
}
|
||||
for($re = 0; $re < 3; $re++)
|
||||
{
|
||||
//TODO: Test this
|
||||
for($re = 0; $re < 3; $re++){
|
||||
$slot = $this->player->getArmor($re);
|
||||
$this->player->setArmor($re, BlockAPI::getItem(AIR, 0, 0));
|
||||
if($slot->getID() !== AIR and $slot->count > 0){
|
||||
@ -804,7 +802,7 @@ class Entity extends Position{
|
||||
}
|
||||
|
||||
public function setPosition(Vector3 $pos, $yaw = false, $pitch = false){
|
||||
if($pos instanceof Position){
|
||||
if($pos instanceof Position and $this->level !== $pos->level){
|
||||
$this->level = $pos->level;
|
||||
$this->server->preparedSQL->entity->setLevel->reset();
|
||||
$this->server->preparedSQL->entity->setLevel->clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user