mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
fix of some gamebreaking bugs/things which didnt work(1.0.1_01
This commit is contained in:
parent
fd99971503
commit
ec46feabbd
7 changed files with 42 additions and 24 deletions
|
|
@ -269,8 +269,9 @@ class ConsoleAPI{
|
|||
if(defined("NO_THREADS")){
|
||||
return;
|
||||
}
|
||||
if($this->loop->line !== false){
|
||||
$line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($this->loop->line));
|
||||
$line = $this->loop->line;
|
||||
if($line !== false){
|
||||
$line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($line));
|
||||
$this->loop->line = false;
|
||||
$output = $this->run($line, "console");
|
||||
if($output != ""){
|
||||
|
|
@ -319,15 +320,18 @@ class ConsoleLoop extends Thread{
|
|||
$this->fp = fopen("php://stdin", "r");
|
||||
}
|
||||
|
||||
while($this->stop === false){
|
||||
$this->line = $this->readLine();
|
||||
$this->wait();
|
||||
while(!$this->stop){
|
||||
$this->synchronized(function($t){
|
||||
$t->line = $t->readLine();
|
||||
$t->wait();
|
||||
}, $this);
|
||||
$this->line = false;
|
||||
}
|
||||
|
||||
if(!extension_loaded("readline")){
|
||||
@fclose($fp);
|
||||
@fclose($this->fp);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ class PluginAPI extends stdClass{
|
|||
}
|
||||
|
||||
$className = $info["class"];
|
||||
$apiversion = array_map("intval", explode(",", (string) $info["apiversion"]));
|
||||
$apiversion = array_map("floatval", explode(",", (string) $info["apiversion"]));
|
||||
if(!in_array((string) CURRENT_API_VERSION, $apiversion)){
|
||||
console("[WARNING] Plugin \"".$info["name"]."\" may not be compatible with the API (".$info["apiversion"]." != ".CURRENT_API_VERSION.")! It can crash or corrupt the server!");
|
||||
}
|
||||
|
|
@ -261,4 +261,4 @@ class DummyPlugin implements Plugin{
|
|||
|
||||
public function __destruct(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ 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", "1.0.1 (Alpha_1.3.12)");
|
||||
define("MAJOR_VERSION", "1.0.1_01 (Alpha_1.3.12)");
|
||||
define("CODENAME", "懐かしさ (Nostalgia)"); //i'm not very creative - kotyaralih
|
||||
define("CURRENT_MINECRAFT_VERSION", "v0.8.1 alpha");
|
||||
define("CURRENT_API_VERSION", 12);
|
||||
|
|
@ -77,4 +77,4 @@ if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information!
|
|||
define("GIT_COMMIT", strtolower(trim(file_get_contents(FILE_PATH.".git/refs/heads/master"))));
|
||||
}else{ //Unknown :(
|
||||
define("GIT_COMMIT", str_repeat("00", 20));
|
||||
}
|
||||
}
|
||||
|
|
@ -30,8 +30,12 @@ class TrapdoorBlock extends TransparentBlock{
|
|||
}
|
||||
$this->hardness = 15;
|
||||
}
|
||||
public function canAttachTo(Block $target){
|
||||
$id = $target->getID();
|
||||
return $id === SLAB || $id === GLOWSTONE || $id === SLAB || $id === WOOD_SLAB || (!$target->isTransparent || $target instanceof StairBlock);
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){
|
||||
if(($this->canAttachTo($target)) and $face !== 0 and $face !== 1){
|
||||
$faces = array(
|
||||
2 => 0,
|
||||
3 => 1,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class NetherReactorBlock extends SolidBlock{
|
|||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
//if(($item->getID() === IRON_SWORD || $item->getID() === WOODEN_SWORD || $item->getID() === STONE_SWORD || $item->getID() === DIAMOND_SWORD || $item->getID() === GOLD_SWORD) /*&& $player->gamemode === 0*/){
|
||||
if($this->isCorrect($this->getX(),$this->getY(),$this->getZ()) && $this->getY() < 101){
|
||||
if(self::$enableReactor && ($player->gamemode & 0x1) === 0 && $this->isCorrect($this->getX(),$this->getY(),$this->getZ()) && $this->getY() < 101){
|
||||
NetherReactorStructure::buildReactor($this->level, $this->getX(),$this->getY(),$this->getZ());
|
||||
$this->meta = 1;
|
||||
$this->level->setBlock($this,$this);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class TNTBlock extends SolidBlock{
|
|||
"x" => $this->x + 0.5,
|
||||
"y" => $this->y + 0.5,
|
||||
"z" => $this->z + 0.5,
|
||||
"power" => 4,
|
||||
"power" => 3,
|
||||
"fuse" => 20 * 4, //4 seconds
|
||||
);
|
||||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
|
|
|
|||
|
|
@ -214,10 +214,26 @@ class Entity extends Position{
|
|||
}
|
||||
$this->updateLast();
|
||||
$this->updatePosition();
|
||||
if($this->y < 0 and $this->class !== ENTITY_PLAYER){
|
||||
if($this->isInVoid()){
|
||||
$this->outOfWorld();
|
||||
}
|
||||
}
|
||||
|
||||
public function isInVoid(){
|
||||
return $this->y < -1.6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle fall out of world
|
||||
*/
|
||||
public function outOfWorld(){
|
||||
if($this->player instanceof Player){
|
||||
$this->harm($this->health, "void", true);
|
||||
}else{
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
|
||||
public function dropAnEgg(){
|
||||
ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem(EGG,0,1));
|
||||
$this->server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg"));
|
||||
|
|
@ -384,11 +400,6 @@ class Entity extends Position{
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->class !== ENTITY_PLAYER and ($this->x <= 0 or $this->z <= 0 or $this->x >= 256 or $this->z >= 256 or $this->y >= 128 or $this->y <= 0)){
|
||||
$this->close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->dead === true){
|
||||
$this->fire = 0;
|
||||
|
|
@ -396,9 +407,8 @@ class Entity extends Position{
|
|||
return false;
|
||||
}
|
||||
|
||||
if($this->y < -16){
|
||||
$this->harm(8, "void", true);
|
||||
$hasUpdate = true;
|
||||
if($this->isInVoid()){
|
||||
$this->outOfWorld();
|
||||
}
|
||||
|
||||
if($this->fire > 0){
|
||||
|
|
@ -1213,4 +1223,4 @@ class Entity extends Position{
|
|||
return "Entity(x={$this->x},y={$this->y},z={$this->z},level=".$this->level->getName().",class={$this->class},type={$this->type})";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue