mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 13:09:44 +00:00
Merge branch 'kotyaralih:0.9.5' into 0.9.5
This commit is contained in:
commit
55e6b55f33
6 changed files with 41 additions and 20 deletions
|
|
@ -431,7 +431,7 @@ class Entity extends Position
|
||||||
$this->fire = 0;
|
$this->fire = 0;
|
||||||
$this->updateMetadata();
|
$this->updateMetadata();
|
||||||
}
|
}
|
||||||
if ($this->air <= 0 && ! $waterDone) {
|
if (($this->air <= 0 && ! $waterDone) || $this->type === MOB_ENDERMAN) { //TODO check is correct
|
||||||
$this->harm(2, "water");
|
$this->harm(2, "water");
|
||||||
$hasUpdate = true;
|
$hasUpdate = true;
|
||||||
$waterDone = true;
|
$waterDone = true;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
class Enderman extends Monster
|
class Enderman extends Monster
|
||||||
{
|
{
|
||||||
const TYPE = MOB_ENDERMAN;
|
const TYPE = MOB_ENDERMAN;
|
||||||
|
|
||||||
|
public $forceTeleport;
|
||||||
|
|
||||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||||
$this->setSize(0.6, 2.9);
|
$this->setSize(0.6, 2.9);
|
||||||
parent::__construct($level, $eid, $class, $type, $data);
|
parent::__construct($level, $eid, $class, $type, $data);
|
||||||
|
|
@ -11,6 +14,25 @@ class Enderman extends Monster
|
||||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 40, "generic");
|
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 40, "generic");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function harm($dmg, $cause = "generic", $force = false){
|
||||||
|
parent::harm($dmg, $cause, $force);
|
||||||
|
if($cause === "water"){
|
||||||
|
$this->randomTeleport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function randomTeleport(){
|
||||||
|
$x = $this->x + ($this->random->nextFloat() - 0.5) * 64;
|
||||||
|
$z = $this->z + ($this->random->nextFloat() - 0.5) * 64;
|
||||||
|
for($y = 0; $y < 128; ++$y){
|
||||||
|
$b = $this->level->getBlockWithoutVector($x, $y, $z);
|
||||||
|
if($b instanceof Block && !$b->isTransparent){ //TODO hitbox check
|
||||||
|
$this->x = $x;
|
||||||
|
$this->y = $y+0.5;
|
||||||
|
$this->z = $z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ class NBT_new{
|
||||||
$tag->read($this);
|
$tag->read($this);
|
||||||
break;
|
break;
|
||||||
case NBT::TAG_Int:
|
case NBT::TAG_Int:
|
||||||
$tag = new Int($this->getString());
|
$tag = new IntTag($this->getString());
|
||||||
$tag->read($this);
|
$tag->read($this);
|
||||||
break;
|
break;
|
||||||
case NBT::TAG_Long:
|
case NBT::TAG_Long:
|
||||||
|
|
@ -129,7 +129,7 @@ class NBT_new{
|
||||||
$tag->read($this);
|
$tag->read($this);
|
||||||
break;
|
break;
|
||||||
case NBT::TAG_Float:
|
case NBT::TAG_Float:
|
||||||
$tag = new Float($this->getString());
|
$tag = new FloatTag($this->getString());
|
||||||
$tag->read($this);
|
$tag->read($this);
|
||||||
break;
|
break;
|
||||||
case NBT::TAG_Double:
|
case NBT::TAG_Double:
|
||||||
|
|
@ -141,7 +141,7 @@ class NBT_new{
|
||||||
$tag->read($this);
|
$tag->read($this);
|
||||||
break;
|
break;
|
||||||
case NBT::TAG_String:
|
case NBT::TAG_String:
|
||||||
$tag = new String($this->getString());
|
$tag = new StringTag($this->getString());
|
||||||
$tag->read($this);
|
$tag->read($this);
|
||||||
break;
|
break;
|
||||||
case NBT::TAG_Enum:
|
case NBT::TAG_Enum:
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
|
||||||
$this->{$i} = $tag;
|
$this->{$i} = $tag;
|
||||||
break;
|
break;
|
||||||
case NBT_new::TAG_Int:
|
case NBT_new::TAG_Int:
|
||||||
$tag = new Int(false);
|
$tag = new IntTag(false);
|
||||||
$tag->read($NBT_new);
|
$tag->read($NBT_new);
|
||||||
$this->{$i} = $tag;
|
$this->{$i} = $tag;
|
||||||
break;
|
break;
|
||||||
|
|
@ -120,7 +120,7 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
|
||||||
$this->{$i} = $tag;
|
$this->{$i} = $tag;
|
||||||
break;
|
break;
|
||||||
case NBT_new::TAG_Float:
|
case NBT_new::TAG_Float:
|
||||||
$tag = new Float(false);
|
$tag = new FloatTag(false);
|
||||||
$tag->read($NBT_new);
|
$tag->read($NBT_new);
|
||||||
$this->{$i} = $tag;
|
$this->{$i} = $tag;
|
||||||
break;
|
break;
|
||||||
|
|
@ -135,7 +135,7 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
|
||||||
$this->{$i} = $tag;
|
$this->{$i} = $tag;
|
||||||
break;
|
break;
|
||||||
case NBT_new::TAG_String:
|
case NBT_new::TAG_String:
|
||||||
$tag = new String(false);
|
$tag = new StringTag(false);
|
||||||
$tag->read($NBT_new);
|
$tag->read($NBT_new);
|
||||||
$this->{$i} = $tag;
|
$this->{$i} = $tag;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class CraftingRecipes{
|
class CraftingRecipes{
|
||||||
|
|
||||||
private static $small = [//Probably means craftable on crafting bench and in inventory. Name it better!
|
private static $small = [//Probably means craftable on crafting bench and in inventory. Name it better!
|
||||||
//Building
|
//Building
|
||||||
"CLAY:?x4=>CLAY_BLOCK:0x1",
|
"CLAY:?x4=>CLAY_BLOCK:0x1",
|
||||||
|
|
|
||||||
|
|
@ -137,14 +137,14 @@ class Level{
|
||||||
case "Sign":
|
case "Sign":
|
||||||
$text = $tile->getText();
|
$text = $tile->getText();
|
||||||
$nbt->setData(new Compound("", array(
|
$nbt->setData(new Compound("", array(
|
||||||
new String("Text1", $text[0]),
|
new StringTag("Text1", $text[0]),
|
||||||
new String("Text2", $text[1]),
|
new StringTag("Text2", $text[1]),
|
||||||
new String("Text3", $text[2]),
|
new StringTag("Text3", $text[2]),
|
||||||
new String("Text4", $text[3]),
|
new StringTag("Text4", $text[3]),
|
||||||
new String("id", "Sign"),
|
new StringTag("id", "Sign"),
|
||||||
new Int("x", (int) $tile->x),
|
new IntTag("x", (int) $tile->x),
|
||||||
new Int("y", (int) $tile->y),
|
new IntTag("y", (int) $tile->y),
|
||||||
new Int("z", (int) $tile->z)
|
new IntTag("z", (int) $tile->z)
|
||||||
)));
|
)));
|
||||||
$tileEntities .= $nbt->write();
|
$tileEntities .= $nbt->write();
|
||||||
break;
|
break;
|
||||||
|
|
@ -153,10 +153,10 @@ class Level{
|
||||||
break;
|
break;
|
||||||
case "Chest":
|
case "Chest":
|
||||||
$nbt->setData(new Compound("", array(
|
$nbt->setData(new Compound("", array(
|
||||||
new String("id", "Chest"),
|
new StringTag("id", "Chest"),
|
||||||
new Int("x", (int) $tile->x),
|
new IntTag("x", (int) $tile->x),
|
||||||
new Int("y", (int) $tile->y),
|
new IntTag("y", (int) $tile->y),
|
||||||
new Int("z", (int) $tile->z)
|
new IntTag("z", (int) $tile->z)
|
||||||
)));
|
)));
|
||||||
$tileEntities .= $nbt->write();
|
$tileEntities .= $nbt->write();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue