mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
project uses tabs instead of spaces(as in CONTRIBUTING.md)
This commit is contained in:
parent
f00318b6ed
commit
62571f26cd
115 changed files with 2291 additions and 2364 deletions
|
|
@ -16,28 +16,28 @@ class Creeper extends Monster{
|
|||
|
||||
|
||||
public function setIgnited($v = null){
|
||||
$this->setState($v === null ? !$this->getState() : $v);
|
||||
$this->setState($v === null ? !$this->getState() : $v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isIgnited(){
|
||||
return (boolean)$this->getState();
|
||||
return (boolean)$this->getState();
|
||||
}
|
||||
|
||||
public function interactWith(Entity $e, $action){
|
||||
if($e->isPlayer() && $action === InteractPacket::ACTION_HOLD){
|
||||
$slot = $e->player->getHeldItem();
|
||||
if($slot->getID() === FLINT_AND_STEEL && !$this->isIgnited()){
|
||||
if($slot->useOn($e) and $slot->getMetadata() >= $slot->getMaxDurability()){
|
||||
$e->player->removeItem($slot->getID(), $slot->getMetadata(), $slot->count, true);
|
||||
}
|
||||
$this->ignite();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return parent::interactWith($e, $action);
|
||||
if($e->isPlayer() && $action === InteractPacket::ACTION_HOLD){
|
||||
$slot = $e->player->getHeldItem();
|
||||
if($slot->getID() === FLINT_AND_STEEL && !$this->isIgnited()){
|
||||
if($slot->useOn($e) and $slot->getMetadata() >= $slot->getMaxDurability()){
|
||||
$e->player->removeItem($slot->getID(), $slot->getMetadata(), $slot->count, true);
|
||||
}
|
||||
$this->ignite();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return parent::interactWith($e, $action);
|
||||
}
|
||||
|
||||
public function ignite(){
|
||||
|
|
@ -55,16 +55,16 @@ class Creeper extends Monster{
|
|||
parent::update();
|
||||
}
|
||||
|
||||
public function explode()
|
||||
{
|
||||
if($this->closed){
|
||||
return false;
|
||||
}
|
||||
$this->setIgnited(0);
|
||||
$explosion = new Explosion($this, 3);
|
||||
$explosion->explode();
|
||||
$this->close();
|
||||
}
|
||||
public function explode()
|
||||
{
|
||||
if($this->closed){
|
||||
return false;
|
||||
}
|
||||
$this->setIgnited(0);
|
||||
$explosion = new Explosion($this, 3);
|
||||
$explosion->explode();
|
||||
$this->close();
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -11,28 +11,28 @@ class Skeleton extends Monster{
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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();
|
||||
$this->updateBurning();
|
||||
parent::update();
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
|
|
|
|||
|
|
@ -11,28 +11,28 @@ class Zombie extends Monster{
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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();
|
||||
$this->updateBurning();
|
||||
parent::update();
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue