mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +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->updateMetadata();
|
||||
}
|
||||
if ($this->air <= 0 && ! $waterDone) {
|
||||
if (($this->air <= 0 && ! $waterDone) || $this->type === MOB_ENDERMAN) { //TODO check is correct
|
||||
$this->harm(2, "water");
|
||||
$hasUpdate = true;
|
||||
$waterDone = true;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
class Enderman extends Monster
|
||||
{
|
||||
const TYPE = MOB_ENDERMAN;
|
||||
|
||||
public $forceTeleport;
|
||||
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.6, 2.9);
|
||||
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");
|
||||
}
|
||||
|
||||
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);
|
||||
break;
|
||||
case NBT::TAG_Int:
|
||||
$tag = new Int($this->getString());
|
||||
$tag = new IntTag($this->getString());
|
||||
$tag->read($this);
|
||||
break;
|
||||
case NBT::TAG_Long:
|
||||
|
|
@ -129,7 +129,7 @@ class NBT_new{
|
|||
$tag->read($this);
|
||||
break;
|
||||
case NBT::TAG_Float:
|
||||
$tag = new Float($this->getString());
|
||||
$tag = new FloatTag($this->getString());
|
||||
$tag->read($this);
|
||||
break;
|
||||
case NBT::TAG_Double:
|
||||
|
|
@ -141,7 +141,7 @@ class NBT_new{
|
|||
$tag->read($this);
|
||||
break;
|
||||
case NBT::TAG_String:
|
||||
$tag = new String($this->getString());
|
||||
$tag = new StringTag($this->getString());
|
||||
$tag->read($this);
|
||||
break;
|
||||
case NBT::TAG_Enum:
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
|
|||
$this->{$i} = $tag;
|
||||
break;
|
||||
case NBT_new::TAG_Int:
|
||||
$tag = new Int(false);
|
||||
$tag = new IntTag(false);
|
||||
$tag->read($NBT_new);
|
||||
$this->{$i} = $tag;
|
||||
break;
|
||||
|
|
@ -120,7 +120,7 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
|
|||
$this->{$i} = $tag;
|
||||
break;
|
||||
case NBT_new::TAG_Float:
|
||||
$tag = new Float(false);
|
||||
$tag = new FloatTag(false);
|
||||
$tag->read($NBT_new);
|
||||
$this->{$i} = $tag;
|
||||
break;
|
||||
|
|
@ -135,7 +135,7 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
|
|||
$this->{$i} = $tag;
|
||||
break;
|
||||
case NBT_new::TAG_String:
|
||||
$tag = new String(false);
|
||||
$tag = new StringTag(false);
|
||||
$tag->read($NBT_new);
|
||||
$this->{$i} = $tag;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
class CraftingRecipes{
|
||||
|
||||
private static $small = [//Probably means craftable on crafting bench and in inventory. Name it better!
|
||||
//Building
|
||||
"CLAY:?x4=>CLAY_BLOCK:0x1",
|
||||
|
|
|
|||
|
|
@ -137,14 +137,14 @@ class Level{
|
|||
case "Sign":
|
||||
$text = $tile->getText();
|
||||
$nbt->setData(new Compound("", array(
|
||||
new String("Text1", $text[0]),
|
||||
new String("Text2", $text[1]),
|
||||
new String("Text3", $text[2]),
|
||||
new String("Text4", $text[3]),
|
||||
new String("id", "Sign"),
|
||||
new Int("x", (int) $tile->x),
|
||||
new Int("y", (int) $tile->y),
|
||||
new Int("z", (int) $tile->z)
|
||||
new StringTag("Text1", $text[0]),
|
||||
new StringTag("Text2", $text[1]),
|
||||
new StringTag("Text3", $text[2]),
|
||||
new StringTag("Text4", $text[3]),
|
||||
new StringTag("id", "Sign"),
|
||||
new IntTag("x", (int) $tile->x),
|
||||
new IntTag("y", (int) $tile->y),
|
||||
new IntTag("z", (int) $tile->z)
|
||||
)));
|
||||
$tileEntities .= $nbt->write();
|
||||
break;
|
||||
|
|
@ -153,10 +153,10 @@ class Level{
|
|||
break;
|
||||
case "Chest":
|
||||
$nbt->setData(new Compound("", array(
|
||||
new String("id", "Chest"),
|
||||
new Int("x", (int) $tile->x),
|
||||
new Int("y", (int) $tile->y),
|
||||
new Int("z", (int) $tile->z)
|
||||
new StringTag("id", "Chest"),
|
||||
new IntTag("x", (int) $tile->x),
|
||||
new IntTag("y", (int) $tile->y),
|
||||
new IntTag("z", (int) $tile->z)
|
||||
)));
|
||||
$tileEntities .= $nbt->write();
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue