Improved Entity extinguish operations and packet spam

This commit is contained in:
Shoghi Cervantes 2014-10-13 23:44:11 +02:00
parent 883f93cc8c
commit 823dc933b8
3 changed files with 6 additions and 4 deletions

View File

@ -33,8 +33,10 @@ class Water extends Liquid{
public function onEntityCollide(Entity $entity){ public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0; $entity->fallDistance = 0;
if($entity->fireTicks > 0){
$entity->extinguish(); $entity->extinguish();
} }
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true, false); $ret = $this->getLevel()->setBlock($this, $this, true, false);

View File

@ -151,8 +151,6 @@ abstract class Living extends Entity implements Damageable{
$this->attack($ev->getFinalDamage(), $ev); $this->attack($ev->getFinalDamage(), $ev);
} }
} }
$this->extinguish();
}else{ }else{
$this->airTicks = 300; $this->airTicks = 300;
} }

View File

@ -500,7 +500,7 @@ class Level implements ChunkManager, Metadatable{
$this->tickChunks(); $this->tickChunks();
$this->timings->doTickTiles->stopTiming(); $this->timings->doTickTiles->stopTiming();
if(($currentTick % 20) === 0){ if(($currentTick % 200) === 0){
$this->blockCache = []; $this->blockCache = [];
} }
@ -1409,6 +1409,7 @@ class Level implements ChunkManager, Metadatable{
* @param int $id 0-255 * @param int $id 0-255
*/ */
public function setBlockIdAt($x, $y, $z, $id){ public function setBlockIdAt($x, $y, $z, $id){
unset($this->blockCache["$x:$y:$z"]);
$this->getChunk($x >> 4, $z >> 4, true)->setBlockId($x & 0x0f, $y & 0x7f, $z & 0x0f, $id & 0xff); $this->getChunk($x >> 4, $z >> 4, true)->setBlockId($x & 0x0f, $y & 0x7f, $z & 0x0f, $id & 0xff);
} }
@ -1434,6 +1435,7 @@ class Level implements ChunkManager, Metadatable{
* @param int $data 0-15 * @param int $data 0-15
*/ */
public function setBlockDataAt($x, $y, $z, $data){ public function setBlockDataAt($x, $y, $z, $data){
unset($this->blockCache["$x:$y:$z"]);
$this->getChunk($x >> 4, $z >> 4, true)->setBlockData($x & 0x0f, $y & 0x7f, $z & 0x0f, $data & 0x0f); $this->getChunk($x >> 4, $z >> 4, true)->setBlockData($x & 0x0f, $y & 0x7f, $z & 0x0f, $data & 0x0f);
} }