diff --git a/src/Player.php b/src/Player.php index abee9b01..2af4c5c1 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1232,7 +1232,7 @@ class Player{ $headSent = false; $svdYSpeed = $e->speedY; if($e->modifySpeedY){ - $e->speedY = $e->modifedSpeedY; + $e->speedY = $e->modifedSpeedY; } if($e->speedX != 0 || $e->speedY != 0 || $e->speedZ != 0 || $e->speedY != $e->lastSpeedY || $e->speedX != $e->lastSpeedX || $e->speedZ != $e->lastSpeedZ){ if(!($e->speedY < 0 && $e->onGround) || $e->speedX != 0 || $e->speedZ != 0 || $e->speedY != $e->lastSpeedY || $e->speedX != $e->lastSpeedX || $e->speedZ != $e->lastSpeedZ){ @@ -1248,8 +1248,8 @@ class Player{ } } if($e->modifySpeedY){ - $e->speedY = $svdYSpeed; - $e->modifySpeedY = false; + $e->speedY = $svdYSpeed; + $e->modifySpeedY = false; } if($e->x != $e->lastX || $e->y != $e->lastY || $e->z != $e->lastZ || $e->yaw != $e->lastYaw || $e->pitch != $e->lastPitch){ diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 7c56d2d9..f35ad749 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -639,8 +639,8 @@ class Entity extends Position $dz = $cz; $this->boundingBox->setBB($aabb1); }else{ - $this->modifySpeedY = true; - $this->modifedSpeedY = 0.5; + $this->modifySpeedY = true; + $this->modifedSpeedY = 0.5; } } diff --git a/src/material/block/TransparentBlock.php b/src/material/block/TransparentBlock.php index beda68ce..16b8ffc3 100644 --- a/src/material/block/TransparentBlock.php +++ b/src/material/block/TransparentBlock.php @@ -17,4 +17,8 @@ class TransparentBlock extends GenericBlock{ $this->isSolid = true; $this->boundingBox->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1); } + + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + return []; + } } \ No newline at end of file diff --git a/src/material/block/attachable/TrapdoorBlock.php b/src/material/block/attachable/TrapdoorBlock.php index 8124bb08..aa78eec1 100644 --- a/src/material/block/attachable/TrapdoorBlock.php +++ b/src/material/block/attachable/TrapdoorBlock.php @@ -11,7 +11,7 @@ class TrapdoorBlock extends TransparentBlock{ } $this->hardness = 15; } - + //TODO collision box public function canAttachTo(Block $target){ $id = $target->getID(); return $id === SLAB || $id === GLOWSTONE || $id === SLAB || $id === WOOD_SLAB || (!$target->isTransparent || $target instanceof StairBlock); diff --git a/src/material/block/misc/BedBlock.php b/src/material/block/misc/BedBlock.php index 00627812..00cb61d4 100644 --- a/src/material/block/misc/BedBlock.php +++ b/src/material/block/misc/BedBlock.php @@ -20,7 +20,7 @@ class BedBlock extends TransparentBlock{ $this->isFullBlock = false; $this->hardness = 1; } - + //TODO collision box public static function findStandUpPosition(Level $level, $x, $y, $z){ $blockMeta = $level->level->getBlockDamage($x, $y, $z); $direction = $blockMeta & 0x3; diff --git a/src/material/block/nonfull/CakeBlock.php b/src/material/block/nonfull/CakeBlock.php index 485e943b..ef625027 100644 --- a/src/material/block/nonfull/CakeBlock.php +++ b/src/material/block/nonfull/CakeBlock.php @@ -9,6 +9,11 @@ class CakeBlock extends TransparentBlock{ $this->hardness = 2.5; } + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + $data = $level->level->getBlockDamage($x, $y, $z); + return [new AxisAlignedBB($x + (2*$data + 1) * 0.0625, $y, $z + 0.0625, $x + 0.9375, $y + 0.5, $z + 0.9375)]; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() !== AIR){ diff --git a/src/material/block/nonfull/StoneWallBlock.php b/src/material/block/nonfull/StoneWallBlock.php index 1629f2d4..24d7c62b 100644 --- a/src/material/block/nonfull/StoneWallBlock.php +++ b/src/material/block/nonfull/StoneWallBlock.php @@ -1,6 +1,7 @@ isFullBlock = false; diff --git a/src/material/block/plant/CactusBlock.php b/src/material/block/plant/CactusBlock.php index 1249f288..a4380251 100644 --- a/src/material/block/plant/CactusBlock.php +++ b/src/material/block/plant/CactusBlock.php @@ -10,6 +10,9 @@ class CactusBlock extends TransparentBlock{ public static function onEntityCollidedWithBlock(Level $level, $x, $y, $z, Entity $entity){ $entity->harm(1, "cactus"); } + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + return [new AxisAlignedBB($x + 0.0625, $y, $z + 0.0625, $x - 0.0625, $y - 0.0625, $z - 0.0625)]; + } public static function onRandomTick(Level $level, $x, $y, $z){ //$b = $level->level->getBlock($x, $y - 1, $z); diff --git a/src/material/block/solid/GlassBlock.php b/src/material/block/solid/GlassBlock.php index 202a6aa0..41985a34 100644 --- a/src/material/block/solid/GlassBlock.php +++ b/src/material/block/solid/GlassBlock.php @@ -9,4 +9,8 @@ class GlassBlock extends TransparentBlock{ public function getDrops(Item $item, Player $player){ return array(); } + + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + return [new AxisAlignedBB($x, $y, $z, $x + 1, $y + 1, $z + 1)]; + } } \ No newline at end of file diff --git a/src/material/block/solid/MelonBlock.php b/src/material/block/solid/MelonBlock.php index b9e34fc1..2f4ccd8d 100644 --- a/src/material/block/solid/MelonBlock.php +++ b/src/material/block/solid/MelonBlock.php @@ -10,4 +10,8 @@ class MelonBlock extends TransparentBlock{ array(MELON_SLICE, 0, mt_rand(3, 7)), ); } + + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + return [new AxisAlignedBB($x, $y, $z, $x + 1, $y + 1, $z + 1)]; + } } \ No newline at end of file