mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Fix water/lava parkour being more difficult than classicube. Big thanks to venom983 to lots of assistance with testing.
This commit is contained in:
parent
2f3d0908ae
commit
3e6e270044
@ -97,11 +97,12 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
/// <summary> Constant offset used to avoid floating point roundoff errors. </summary>
|
/// <summary> Constant offset used to avoid floating point roundoff errors. </summary>
|
||||||
public const float Adjustment = 0.001f;
|
public const float Adjustment = 0.001f;
|
||||||
|
static readonly Vector3 liqExpand = new Vector3( 0.25f/16f, 0/16f, 0.25f/16f );
|
||||||
|
|
||||||
/// <summary> Determines whether any of the blocks that intersect the
|
/// <summary> Determines whether any of the blocks that intersect the
|
||||||
/// bounding box of this entity are lava or still lava. </summary>
|
/// bounding box of this entity are lava or still lava. </summary>
|
||||||
protected bool TouchesAnyLava() {
|
protected bool TouchesAnyLava() {
|
||||||
BoundingBox bounds = CollisionBounds;
|
BoundingBox bounds = CollisionBounds.Expand( liqExpand );
|
||||||
// Even though we collide with lava 3 blocks above our feet, vanilla client thinks
|
// Even though we collide with lava 3 blocks above our feet, vanilla client thinks
|
||||||
// that we do not.. so we have to maintain compatibility here.
|
// that we do not.. so we have to maintain compatibility here.
|
||||||
bounds.Max.Y -= 4/16f;
|
bounds.Max.Y -= 4/16f;
|
||||||
@ -119,7 +120,7 @@ namespace ClassicalSharp {
|
|||||||
/// <summary> Determines whether any of the blocks that intersect the
|
/// <summary> Determines whether any of the blocks that intersect the
|
||||||
/// bounding box of this entity are water or still water. </summary>
|
/// bounding box of this entity are water or still water. </summary>
|
||||||
protected bool TouchesAnyWater() {
|
protected bool TouchesAnyWater() {
|
||||||
BoundingBox bounds = CollisionBounds;
|
BoundingBox bounds = CollisionBounds.Expand( liqExpand );
|
||||||
bounds.Max.Y -= 4/16f;
|
bounds.Max.Y -= 4/16f;
|
||||||
return TouchesAny( bounds,
|
return TouchesAny( bounds,
|
||||||
b => b == (byte)Block.Water || b == (byte)Block.StillWater );
|
b => b == (byte)Block.Water || b == (byte)Block.StillWater );
|
||||||
|
@ -63,7 +63,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
if( NamesMode != NameMode.AllNames )
|
if( NamesMode != NameMode.AllNames )
|
||||||
closestId = GetClosetPlayer( game.LocalPlayer );
|
closestId = GetClosetPlayer( game.LocalPlayer );
|
||||||
if( NamesMode == NameMode.HoveredOnly )
|
if( NamesMode == NameMode.HoveredOnly || !game.LocalPlayer.CanSeeAllNames )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( int i = 0; i < Players.Length; i++ ) {
|
for( int i = 0; i < Players.Length; i++ ) {
|
||||||
|
@ -36,6 +36,9 @@ namespace ClassicalSharp {
|
|||||||
/// <summary> Whether the player is allowed to use pushback block placing. </summary>
|
/// <summary> Whether the player is allowed to use pushback block placing. </summary>
|
||||||
public bool CanPushbackBlocks = true;
|
public bool CanPushbackBlocks = true;
|
||||||
|
|
||||||
|
/// <summary> Whether the player is allowed to see all entity name tags. </summary>
|
||||||
|
public bool CanSeeAllNames = true;
|
||||||
|
|
||||||
float jumpVel = 0.42f;
|
float jumpVel = 0.42f;
|
||||||
/// <summary> Returns the height that the client can currently jump up to.<br/>
|
/// <summary> Returns the height that the client can currently jump up to.<br/>
|
||||||
/// Note that when speeding is enabled the client is able to jump much further. </summary>
|
/// Note that when speeding is enabled the client is able to jump much further. </summary>
|
||||||
@ -175,7 +178,7 @@ namespace ClassicalSharp {
|
|||||||
} else if( pastJumpPoint ) {
|
} else if( pastJumpPoint ) {
|
||||||
// either A) jump bob in water B) climb up solid on side
|
// either A) jump bob in water B) climb up solid on side
|
||||||
if( canLiquidJump || (collideX || collideZ) )
|
if( canLiquidJump || (collideX || collideZ) )
|
||||||
Velocity.Y += touchLava ? 0.40f : 0.10f;
|
Velocity.Y += touchLava ? 0.20f : 0.10f;
|
||||||
canLiquidJump = false;
|
canLiquidJump = false;
|
||||||
}
|
}
|
||||||
} else if( useLiquidGravity ) {
|
} else if( useLiquidGravity ) {
|
||||||
@ -314,6 +317,7 @@ namespace ClassicalSharp {
|
|||||||
inv.CanPlace[(int)Block.StillWater] = value == 0x64;
|
inv.CanPlace[(int)Block.StillWater] = value == 0x64;
|
||||||
inv.CanPlace[(int)Block.Lava] = value == 0x64;
|
inv.CanPlace[(int)Block.Lava] = value == 0x64;
|
||||||
inv.CanPlace[(int)Block.StillLava] = value == 0x64;
|
inv.CanPlace[(int)Block.StillLava] = value == 0x64;
|
||||||
|
CanSeeAllNames = value == 0x64;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Vector3 lastPos, nextPos;
|
internal Vector3 lastPos, nextPos;
|
||||||
|
@ -24,6 +24,12 @@ namespace ClassicalSharp {
|
|||||||
return new BoundingBox( Min + amount, Max + amount );
|
return new BoundingBox( Min + amount, Max + amount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Returns a new bounding box, with the minimum and maximum coordinates
|
||||||
|
/// of the original bounding box expanded away from origin the given vector. </summary>
|
||||||
|
public BoundingBox Expand( Vector3 amount ) {
|
||||||
|
return new BoundingBox( Min - amount, Max + amount );
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Determines whether this bounding box intersects
|
/// <summary> Determines whether this bounding box intersects
|
||||||
/// the given bounding box on any axes. </summary>
|
/// the given bounding box on any axes. </summary>
|
||||||
public bool Intersects( BoundingBox other ) {
|
public bool Intersects( BoundingBox other ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user