From 8684e3092a9906a2e3042ca87a10f3ef940c7b11 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Tue, 9 Jan 2024 05:51:06 +0300 Subject: [PATCH] fixed ice collisions --- src/entity/Entity.php | 5 +++-- src/material/block/solid/IceBlock.php | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index b7bef8b6..adbf0725 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -566,9 +566,10 @@ class Entity extends Position for($x = $x0; $x <= $x1; ++$x){ for($y = $y0; $y <= $y1; ++$y){ for($z = $z0; $z <= $z1; ++$z){ + $b = $this->level->level->getBlockID($x, $y, $z); - if(($b === WATER || $b === STILL_WATER)){ - $water = $y == ($y1 - 1); + if(($b == WATER || $b == STILL_WATER)){ + $water |= $y == ($y1 - 1); $this->fallDistance = 0; } if($b != 0){ diff --git a/src/material/block/solid/IceBlock.php b/src/material/block/solid/IceBlock.php index 43f878b0..40be3d16 100644 --- a/src/material/block/solid/IceBlock.php +++ b/src/material/block/solid/IceBlock.php @@ -6,6 +6,11 @@ class IceBlock extends TransparentBlock{ $this->hardness = 2.5; $this->slipperiness = 0.98; } + + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + return [new AxisAlignedBB($x, $y, $z, $x + 1, $y + 1, $z + 1)]; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $ret = $this->level->setBlock($this, $this, true, false, true); $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);