mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
zombies and skeletons will burn now:
This commit is contained in:
parent
6dae45045b
commit
cf13bd4c43
6 changed files with 54 additions and 27 deletions
|
|
@ -24,7 +24,7 @@ class PocketMinecraftServer{
|
||||||
|
|
||||||
private function load(){
|
private function load(){
|
||||||
global $dolog;
|
global $dolog;
|
||||||
|
|
||||||
$this->version = new VersionString();
|
$this->version = new VersionString();
|
||||||
/*if(defined("DEBUG") and DEBUG >= 0){
|
/*if(defined("DEBUG") and DEBUG >= 0){
|
||||||
@cli_set_process_title("NostalgiaCore ".MAJOR_VERSION);
|
@cli_set_process_title("NostalgiaCore ".MAJOR_VERSION);
|
||||||
|
|
|
||||||
|
|
@ -1285,12 +1285,8 @@ class Entity extends Position
|
||||||
if($harm === true){
|
if($harm === true){
|
||||||
$pk = new EntityEventPacket;
|
$pk = new EntityEventPacket;
|
||||||
$pk->eid = $this->eid;
|
$pk->eid = $this->eid;
|
||||||
$pk->event = 2;
|
$pk->event = EntityEventPacket::ENTITY_DAMAGE;
|
||||||
//$this->server->api->player->broadcastPacket($this->level->players, $pk);
|
$this->server->api->player->broadcastPacket($this->level->players, $pk);
|
||||||
$this->server->api->dhandle("entity.event", array(
|
|
||||||
"entity" => $this,
|
|
||||||
"event" => 2
|
|
||||||
)); // Ouch! sound
|
|
||||||
}
|
}
|
||||||
if($this->player instanceof Player){
|
if($this->player instanceof Player){
|
||||||
$pk = new SetHealthPacket();
|
$pk = new SetHealthPacket();
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ class Chicken extends Animal{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(){
|
public function update(){
|
||||||
|
parent::update();
|
||||||
if($this->timeUntilEgg-- <= 0){
|
if($this->timeUntilEgg-- <= 0){
|
||||||
$this->dropAnEgg();
|
$this->dropAnEgg();
|
||||||
$this->timeUntilEgg = mt_rand(0,6000) + 6000;
|
$this->timeUntilEgg = mt_rand(0,6000) + 6000;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,31 @@ class Skeleton extends Monster{
|
||||||
$this->update();
|
$this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateBurning(){
|
||||||
|
if($this->fire > 0 or $this->server->api->time->getPhase($this->level->getTime()) != "day"){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for($y = $this->y; $y < 129; $y++){
|
||||||
|
$block = $this->level->getBlockWithoutVector($this->x, $y, $this->z);
|
||||||
|
if($block->isSolid){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($block->getID() === AIR){
|
||||||
|
$this->fire = 160; //Value from 0.8.1
|
||||||
|
$this->updateMetadata();
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(){
|
||||||
|
$this->updateBurning();
|
||||||
|
parent::update();
|
||||||
|
}
|
||||||
|
|
||||||
public function getDrops(){
|
public function getDrops(){
|
||||||
return [
|
return [
|
||||||
[ARROW, 0, mt_rand(0,2)],
|
[ARROW, 0, mt_rand(0,2)],
|
||||||
|
|
|
||||||
|
|
@ -8,28 +8,31 @@ class Zombie extends Monster{
|
||||||
$this->setSize(0.6, 1.85);
|
$this->setSize(0.6, 1.85);
|
||||||
$this->setSpeed(0.23);
|
$this->setSpeed(0.23);
|
||||||
$this->update();
|
$this->update();
|
||||||
//$this->server->schedule(20, [$this, "burnable"], null, true); //todo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function burnable(){
|
public function updateBurning(){
|
||||||
if($this->fire > 0 or $this->server->api->time->getPhase($this->level->getTime()) == "day"){
|
if($this->fire > 0 or $this->server->api->time->getPhase($this->level->getTime()) != "day"){
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
$y = $this->y;
|
|
||||||
for(; $y < 129; $y++){
|
for($y = $this->y; $y < 129; $y++){
|
||||||
$block = $this->level->getBlock(new Vector3($this->x, $y, $this->z));
|
$block = $this->level->getBlockWithoutVector($this->x, $y, $this->z);
|
||||||
if($block->isSolid){ //?
|
if($block->isSolid){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$block = $this->level->getBlock(new Vector3($this->x, $y, $this->z))->getID();
|
if($block->getID() === AIR){
|
||||||
if($block === AIR){
|
$this->fire = 160; //Value from 0.8.1
|
||||||
$this->fire = 200;
|
$this->updateMetadata();
|
||||||
$this->updateMetadata();
|
return true;
|
||||||
return true;
|
}else{
|
||||||
}else{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function update(){
|
||||||
|
$this->updateBurning();
|
||||||
|
parent::update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDrops(){
|
public function getDrops(){
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ class EntityEventPacket extends RakNetDataPacket{
|
||||||
public $eid;
|
public $eid;
|
||||||
public $event;
|
public $event;
|
||||||
|
|
||||||
|
const ENTITY_DAMAGE = 2;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
return ProtocolInfo::ENTITY_EVENT_PACKET;
|
return ProtocolInfo::ENTITY_EVENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue