mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
fixed inability to collect entity drop, fixed player not getting damage while standing on cactus, tweaked some other stuff
This commit is contained in:
parent
46efebaf67
commit
19a4008543
6 changed files with 11 additions and 10 deletions
|
|
@ -370,7 +370,7 @@ class Entity extends Position
|
|||
private function spawnDrops()
|
||||
{
|
||||
foreach($this->getDrops() as $drop){
|
||||
$this->server->api->entity->drop($this, BlockAPI::getItem($drop[0] & 0xFFFF, $drop[1] & 0xFFFF, $drop[2] & 0xFF), true);
|
||||
$this->server->api->entity->drop($this, BlockAPI::getItem($drop[0] & 0xFFFF, $drop[1] & 0xFFFF, $drop[2] & 0xFF));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -549,11 +549,11 @@ class Entity extends Position
|
|||
public function updateEntityMovement(){}
|
||||
|
||||
public function doBlocksCollision(){
|
||||
$minX = floor($this->boundingBox->minX + 0.001);
|
||||
$minY = floor($this->boundingBox->minY + 0.001);
|
||||
$maxY = floor($this->boundingBox->maxY - 0.001);
|
||||
$minX = floor($this->boundingBox->minX + 0.001);
|
||||
$minZ = floor($this->boundingBox->minZ + 0.001);
|
||||
$maxX = floor($this->boundingBox->maxX - 0.001);
|
||||
$maxY = floor($this->boundingBox->maxY - 0.001);
|
||||
$maxZ = floor($this->boundingBox->maxZ - 0.001);
|
||||
|
||||
for($x = $minX; $x <= $maxX; ++$x){
|
||||
|
|
@ -803,12 +803,13 @@ class Entity extends Position
|
|||
intersects:
|
||||
if($y <= floor($this->boundingBox->minY) && !$this->onGround){
|
||||
if($intersects > 0) $this->onGround = count($bounds) > 0;
|
||||
}else{
|
||||
}
|
||||
if($y >= floor($this->boundingBox->minY)){
|
||||
$block = $this->level->level->getBlock($x, $y, $z);
|
||||
$id = $block[0];
|
||||
$meta = $block[1];
|
||||
$handleFire = $handleFire || (($id == FIRE || $id == STILL_LAVA || $id == LAVA) && $x >= $fireMinX && $x < $fireMaxX && $y >= $fireMinY && $y < $fireMaxY && $z >= $fireMinZ && $z < $fireMaxZ);
|
||||
$handleCactus = $handleCactus || ($id == CACTUS && $x >= $fireMinX && $x <= $fireMaxX && $y >= $fireMinY && $y <= $fireMaxY && $z >= $fireMinZ && $z <= $fireMaxZ);
|
||||
$handleCactus = $handleCactus || ($id == CACTUS && $x >= $fireMinX && $x < $fireMaxX && $y >= $fireMinY && $y < $fireMaxY && $z >= $fireMinZ && $z < $fireMaxZ);
|
||||
|
||||
if($id === WATER || $id === STILL_WATER || $id === COBWEB){
|
||||
$this->fallDistance = 0;
|
||||
|
|
@ -819,6 +820,7 @@ class Entity extends Position
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($prevGroundState == $this->onGround && !$this->onGround && $this->player->isSleeping == false){ //isSleeping may be a vector
|
||||
++$this->notOnGroundTicks;
|
||||
}else if($this->onGround){
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class MobController
|
|||
|
||||
$v8 = $diffX*$diffX + $diffY*$diffY + $diffZ*$diffZ;
|
||||
|
||||
if($v8 >= 2.500000277905201E-7){ //TODO convert notation
|
||||
if($v8 >= 0.00000025){
|
||||
$v10 = (atan2($diffZ, $diffX) * 180 / M_PI) - 90;
|
||||
$this->entity->yaw = self::limitAngle($this->entity->yaw, $v10, 30);
|
||||
$this->entity->setAIMoveSpeed($this->speedMultiplier * $this->entity->getSpeed() * $this->entity->getSpeedModifer());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
//TODO mutexBits
|
||||
|
||||
abstract class TaskBase
|
||||
{
|
||||
public $isStarted = false, $selfCounter = 0;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class TaskLookAtPlayer extends TaskBase{
|
|||
}
|
||||
|
||||
public function onUpdate(EntityAI $ai){
|
||||
if(!($this->target instanceof Entity) || Utils::distance($ai->entity, $this->target) > 6 || $this->target->level->getName() != $ai->entity->level->getName()){ //TODO max distance for different mobs
|
||||
if(!($this->target instanceof Entity) || Utils::distance($ai->entity, $this->target) > $this->distance || $this->target->level->getName() != $ai->entity->level->getName()){
|
||||
$this->reset();
|
||||
$this->onEnd($ai);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class Level{
|
|||
|
||||
return true;
|
||||
}
|
||||
// TODO neccessary for projectiles
|
||||
|
||||
public function rayTraceBlocks(Vector3 $start, Vector3 $end){
|
||||
|
||||
$par3 = false; //TODO move to params?
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ class ClayFeature
|
|||
$d6 = (($i4 + 0.5) - $d3) / ($sin3 / 2);
|
||||
if(($d4*$d4)+($d5*$d5)+($d6*$d6)<1 && $level->level->getBlockID($i2, $i3, $i4) == SAND){
|
||||
$level->level->setBlockID($i2, $i3, $i4, $clayid);
|
||||
console("Placed clay at".$i2.":".$i4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue