Fix water/lava parkour being more difficult than classicube. Big thanks to venom983 to lots of assistance with testing.

This commit is contained in:
UnknownShadow200 2015-12-14 16:02:03 +11:00
parent 2f3d0908ae
commit 3e6e270044
4 changed files with 15 additions and 4 deletions

View File

@ -97,11 +97,12 @@ namespace ClassicalSharp {
/// <summary> Constant offset used to avoid floating point roundoff errors. </summary>
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
/// bounding box of this entity are lava or still lava. </summary>
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
// that we do not.. so we have to maintain compatibility here.
bounds.Max.Y -= 4/16f;
@ -119,7 +120,7 @@ namespace ClassicalSharp {
/// <summary> Determines whether any of the blocks that intersect the
/// bounding box of this entity are water or still water. </summary>
protected bool TouchesAnyWater() {
BoundingBox bounds = CollisionBounds;
BoundingBox bounds = CollisionBounds.Expand( liqExpand );
bounds.Max.Y -= 4/16f;
return TouchesAny( bounds,
b => b == (byte)Block.Water || b == (byte)Block.StillWater );

View File

@ -63,7 +63,7 @@ namespace ClassicalSharp {
if( NamesMode != NameMode.AllNames )
closestId = GetClosetPlayer( game.LocalPlayer );
if( NamesMode == NameMode.HoveredOnly )
if( NamesMode == NameMode.HoveredOnly || !game.LocalPlayer.CanSeeAllNames )
return;
for( int i = 0; i < Players.Length; i++ ) {

View File

@ -36,6 +36,9 @@ namespace ClassicalSharp {
/// <summary> Whether the player is allowed to use pushback block placing. </summary>
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;
/// <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>
@ -175,7 +178,7 @@ namespace ClassicalSharp {
} else if( pastJumpPoint ) {
// either A) jump bob in water B) climb up solid on side
if( canLiquidJump || (collideX || collideZ) )
Velocity.Y += touchLava ? 0.40f : 0.10f;
Velocity.Y += touchLava ? 0.20f : 0.10f;
canLiquidJump = false;
}
} else if( useLiquidGravity ) {
@ -314,6 +317,7 @@ namespace ClassicalSharp {
inv.CanPlace[(int)Block.StillWater] = value == 0x64;
inv.CanPlace[(int)Block.Lava] = value == 0x64;
inv.CanPlace[(int)Block.StillLava] = value == 0x64;
CanSeeAllNames = value == 0x64;
}
internal Vector3 lastPos, nextPos;

View File

@ -23,6 +23,12 @@ namespace ClassicalSharp {
public BoundingBox Offset( Vector3 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
/// the given bounding box on any axes. </summary>