mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix custom liquids for BlockDefinitions.
This commit is contained in:
parent
b195699620
commit
901f3e359f
@ -107,6 +107,7 @@ namespace ClassicalSharp {
|
||||
}
|
||||
}
|
||||
|
||||
bool useLiquidGravity = false; // used by BlockDefinitions.
|
||||
void UpdateVelocityYState() {
|
||||
if( flying || noClip ) {
|
||||
Velocity.Y = 0; // eliminate the effect of gravity
|
||||
@ -124,6 +125,8 @@ namespace ClassicalSharp {
|
||||
if( jumping ) {
|
||||
if( TouchesAnyWater() || TouchesAnyLava() ) {
|
||||
Velocity.Y += speeding ? 0.08f : 0.04f;
|
||||
} else if( useLiquidGravity ) {
|
||||
Velocity.Y += speeding ? 0.08f : 0.04f;
|
||||
} else if( TouchesAnyRope() ) {
|
||||
Velocity.Y += speeding ? 0.15f : 0.10f;
|
||||
} else if( onGround ) {
|
||||
@ -141,7 +144,8 @@ namespace ClassicalSharp {
|
||||
|
||||
void PhysicsTick( float xMoving, float zMoving ) {
|
||||
float multiply = flying ? ( speeding ? 90 : 15 ) : ( speeding ? 10 : 1 );
|
||||
multiply *= LowestSpeedModifier();
|
||||
float modifier = LowestSpeedModifier();
|
||||
multiply *= modifier;
|
||||
|
||||
if( TouchesAnyWater() && !flying && !noClip ) {
|
||||
Move( xMoving, zMoving, 0.02f * multiply, waterDrag, liquidGrav, 1 );
|
||||
@ -151,8 +155,9 @@ namespace ClassicalSharp {
|
||||
Move( xMoving, zMoving, 0.02f * 1.7f, ropeDrag, ropeGrav, 1 );
|
||||
} else {
|
||||
float factor = !flying && onGround ? 0.1f : 0.02f;
|
||||
float yMul = Math.Max( 1, multiply / 5f );
|
||||
Move( xMoving, zMoving, factor * multiply, normalDrag, normalGrav, yMul );
|
||||
float yMul = modifier * Math.Max( 1, multiply / 5f );
|
||||
float gravity = useLiquidGravity ? liquidGrav : normalGrav;
|
||||
Move( xMoving, zMoving, factor * multiply, normalDrag, gravity, yMul );
|
||||
|
||||
if( BlockUnderFeet == Block.Ice ) {
|
||||
Utils.Clamp( ref Velocity.X, -0.25f, 0.25f );
|
||||
@ -282,6 +287,7 @@ namespace ClassicalSharp {
|
||||
Vector3I bbMin = Vector3I.Floor( bounds.Min );
|
||||
Vector3I bbMax = Vector3I.Floor( bounds.Max );
|
||||
float modifier = float.PositiveInfinity;
|
||||
useLiquidGravity = false;
|
||||
|
||||
for( int x = bbMin.X; x <= bbMax.X; x++ ) {
|
||||
for( int y = bbMin.Y; y <= bbMax.Y; y++ ) {
|
||||
@ -289,7 +295,10 @@ namespace ClassicalSharp {
|
||||
if( !map.IsValidPos( x, y, z ) ) continue;
|
||||
byte block = map.GetBlock( x, y, z );
|
||||
if( block == 0 ) continue;
|
||||
|
||||
modifier = Math.Min( modifier, info.SpeedMultiplier[block] );
|
||||
if( info.CollideType[block] == BlockCollideType.SwimThrough )
|
||||
useLiquidGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,14 +73,11 @@ namespace Launcher {
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
var response = GetHtml( publicServersUri, minecraftNetUri );
|
||||
List<ServerListEntry> servers = new List<ServerListEntry>();
|
||||
int index = -1;
|
||||
bool foundStart = false;
|
||||
int mode = 0;
|
||||
|
||||
string hash = null;
|
||||
string name = null;
|
||||
string players = null;
|
||||
string maxPlayers = null;
|
||||
string uptime = null;
|
||||
string hash = null, name = null, players = null;
|
||||
string maxPlayers = null, uptime = null;
|
||||
|
||||
foreach( string line in response ) {
|
||||
if( line.StartsWith( " <a href", ordinal ) ) {
|
||||
@ -92,10 +89,10 @@ namespace Launcher {
|
||||
int nameEnd = line.IndexOf( '<', nameStart );
|
||||
name = line.Substring( nameStart, nameEnd - nameStart );
|
||||
name = WebUtility.HtmlDecode( name );
|
||||
index++;
|
||||
foundStart = true;
|
||||
mode = 0;
|
||||
}
|
||||
if( index < 0 ) continue;
|
||||
if( !foundStart ) continue;
|
||||
|
||||
// NOTE: >16 checks that the line actually has a value.
|
||||
// this check is necessary, as the page does have lines with just " <td>"
|
||||
|
Loading…
x
Reference in New Issue
Block a user