diff --git a/ClassicalSharp/Entities/Components/HacksComponent.cs b/ClassicalSharp/Entities/Components/HacksComponent.cs index b61baf392..7c182c1d7 100644 --- a/ClassicalSharp/Entities/Components/HacksComponent.cs +++ b/ClassicalSharp/Entities/Components/HacksComponent.cs @@ -118,7 +118,6 @@ namespace ClassicalSharp.Entities { /// Sets the user type of this user. This is used to control permissions for grass, /// bedrock, water and lava blocks on servers that don't support CPE block permissions. public void SetUserType( byte value ) { - value = 0x64; UserType = value; Inventory inv = game.Inventory; inv.CanPlace[Block.Bedrock] = value == 0x64; diff --git a/ClassicalSharp/TexturePack/Animations.cs b/ClassicalSharp/TexturePack/Animations.cs index 54921fbd1..ff18a9be0 100644 --- a/ClassicalSharp/TexturePack/Animations.cs +++ b/ClassicalSharp/TexturePack/Animations.cs @@ -62,19 +62,19 @@ namespace ClassicalSharp.TexturePack { /// Runs through all animations and if necessary updates the terrain atlas. public unsafe void Tick( double delta ) { - if( animations.Count == 0 ) return; + if( useLavaAnim ) DrawAnimation( null, 30, 16 ); + + if( animations.Count == 0 ) return; if( animsBuffer == null ) { game.Chat.Add( "&cCurrent texture pack specifies it uses animations," ); game.Chat.Add( "&cbut is missing animations.png" ); animations.Clear(); return; } - if( !validated ) ValidateAnimations(); - + if( !validated ) ValidateAnimations(); foreach( AnimationData anim in animations ) ApplyAnimation( anim ); - if( useLavaAnim ) DrawAnimation( null, 30, 16 ); } /// Reads a text file that contains a number of lines, with each line describing:
@@ -148,7 +148,7 @@ namespace ClassicalSharp.TexturePack { animPart.SetData( size, size, size * 4, (IntPtr)temp, false ); if( data == null ) - lavaAnim.Tick( animPart ); + lavaAnim.Tick( (int*)temp ); else FastBitmap.MovePortion( data.FrameX + data.State * size, data.FrameY, 0, 0, animsBuffer, animPart, size ); diff --git a/ClassicalSharp/TexturePack/LavaAnimation.cs b/ClassicalSharp/TexturePack/LavaAnimation.cs index 3f6571fe7..3c64fc55f 100644 --- a/ClassicalSharp/TexturePack/LavaAnimation.cs +++ b/ClassicalSharp/TexturePack/LavaAnimation.cs @@ -13,7 +13,7 @@ namespace ClassicalSharp { float[] soupHeat = new float[size * size]; JavaRandom rnd = null; - public void Tick( FastBitmap output ) { + public unsafe void Tick( int* output ) { if( rnd == null ) rnd = new JavaRandom( new Random().Next() ); Step(); @@ -49,19 +49,16 @@ namespace ClassicalSharp { } } - void Output( FastBitmap output ) { + void Output( int* ptr ) { int index = 0; - for( int y = 0; y < size; y++ ) { - int* row = output.GetRowPtr( y ); - for( int x = 0; x < size; x++ ) { - float col = 2 * soupHeat[index]; - Utils.Clamp( ref col, 0, 1 ); - float r = col * 100 + 155; - float g = col * col * 255; - float b = col * col * col * col * 128; - row[x] = 255 << 24 | (byte)r << 16 | (byte)g << 8 | (byte)b; - index++; - } + for( int i = 0; i < soupHeat.Length; i++) { + float col = 2 * soupHeat[i]; + Utils.Clamp( ref col, 0, 1 ); + float r = col * 100 + 155; + float g = col * col * 255; + float b = col * col * col * col * 128; + *ptr = 255 << 24 | (byte)r << 16 | (byte)g << 8 | (byte)b; + ptr++; } }