mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
fence should collide with entities, gravel fix
This commit is contained in:
parent
b115c19093
commit
7768ad03a9
4 changed files with 37 additions and 6 deletions
|
|
@ -3,6 +3,7 @@
|
|||
class MobController
|
||||
{
|
||||
public static $ADVANCED = false;
|
||||
public static $landed = false;
|
||||
public static $DANGEROUS_BLOCKS = [
|
||||
LAVA => true,
|
||||
STILL_LAVA => true,
|
||||
|
|
@ -93,11 +94,10 @@ class MobController
|
|||
}
|
||||
|
||||
public function movementTick(){
|
||||
if($this->isJumping() && $this->jumpTimeout <= 0){
|
||||
if($this->isJumping() && $this->jumpTimeout <= 0 && $this->entity->onGround){
|
||||
$this->jumpTimeout = 10;
|
||||
$this->entity->speedY = 0.42;
|
||||
$this->entity->speedY = 0.40;
|
||||
}
|
||||
|
||||
if($this->jumpTimeout > 0) --$this->jumpTimeout;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,37 @@ class FenceBlock extends TransparentBlock{
|
|||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
//TODO public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity)
|
||||
public static function canConnectTo(Level $level, $x, $y, $z){
|
||||
$id = $level->level->getBlockID($x, $y, $z);
|
||||
|
||||
if($id != FENCE && $id != FENCE_GATE){
|
||||
return StaticBlock::getIsSolid($id) && $id != PUMPKIN; //TODO check var6 != null && var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock() ? var6.blockMaterial != Material.pumpkin : false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
|
||||
$v8 = self::canConnectTo($level, $x, $y, $z - 1);
|
||||
$v9 = self::canConnectTo($level, $x, $y, $z + 1);
|
||||
$v10 = self::canConnectTo($level, $x - 1, $y, $z);
|
||||
$v11 = self::canConnectTo($level, $x + 1, $y, $z);
|
||||
$v12 = 0.375;
|
||||
$v13 = 0.625;
|
||||
$v14 = $v8 ? 0 : 0.375;
|
||||
$v15 = $v9 ? 1 : 0.625;
|
||||
$arr = [];
|
||||
if($v8 || $v9){
|
||||
$arr[] = new AxisAlignedBB($x + $v12, $y + 0, $z + $v14, $x + $v13, $y + 1.5, $z + $v15);
|
||||
}
|
||||
$v14 = 0.375;
|
||||
$v15 = 0.625;
|
||||
if($v10) $v12 = 0;
|
||||
if($v11) $v13 = 1;
|
||||
|
||||
if($v10 || $v11 || !$v8 && !$v9){
|
||||
$arr[] = new AxisAlignedBB($x + $v12, $y + 0, $z + $v14, $x + $v13, $y + 1.5, $z + $v15);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ class IronBarsBlock extends TransparentBlock{
|
|||
}
|
||||
|
||||
public static function canConnectTo($blockID) : bool{
|
||||
return StaticBlock::getIsSolid($blockID) || $blockID == GLASS_PANE || $blockID == GLASS; //glass_pane & glass, in 1.5.2 iron fence is just BlockPane which is glass pane
|
||||
return StaticBlock::getIsSolid($blockID) || $blockID == IRON_BARS || $blockID == GLASS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ class GravelBlock extends FallableBlock{
|
|||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return [
|
||||
[mt_rand(1,10) ? FLINT : GRAVEL, 0, 1],
|
||||
[mt_rand(1,10) == 1 ? FLINT : GRAVEL, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue