mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Update NetworkProcessor with latest changes to BlockDefinitions.
This commit is contained in:
parent
bf314359cd
commit
bf6532af07
@ -40,10 +40,7 @@ namespace ClassicalSharp {
|
|||||||
CpeExtAddEntity2 = 33,
|
CpeExtAddEntity2 = 33,
|
||||||
CpePlayerClick = 34,
|
CpePlayerClick = 34,
|
||||||
CpeDefineBlock = 35,
|
CpeDefineBlock = 35,
|
||||||
CpeDefineLiquid = 36,
|
CpeRemoveBlockDefinition = 36,
|
||||||
CpeRemoveBlockDefinition = 37,
|
|
||||||
|
|
||||||
Max,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CpeMessage {
|
public enum CpeMessage {
|
||||||
|
@ -282,7 +282,7 @@ namespace ClassicalSharp {
|
|||||||
AddEntity( entityId, displayName, skinName, true );
|
AddEntity( entityId, displayName, skinName, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleCpeDefineBlockOrLiquid() {
|
void HandleCpeDefineBlock() {
|
||||||
byte block = reader.ReadUInt8();
|
byte block = reader.ReadUInt8();
|
||||||
BlockInfo info = game.BlockInfo;
|
BlockInfo info = game.BlockInfo;
|
||||||
info.ResetBlockInfo( block );
|
info.ResetBlockInfo( block );
|
||||||
@ -294,32 +294,30 @@ namespace ClassicalSharp {
|
|||||||
info.SetTop( reader.ReadUInt8(), (Block)block );
|
info.SetTop( reader.ReadUInt8(), (Block)block );
|
||||||
info.SetSide( reader.ReadUInt8(), (Block)block );
|
info.SetSide( reader.ReadUInt8(), (Block)block );
|
||||||
info.SetBottom( reader.ReadUInt8(), (Block)block );
|
info.SetBottom( reader.ReadUInt8(), (Block)block );
|
||||||
reader.ReadUInt8(); // opacity hint, but we ignore this.
|
|
||||||
info.BlocksLight[block] = reader.ReadUInt8() == 0;
|
info.BlocksLight[block] = reader.ReadUInt8() == 0;
|
||||||
reader.ReadUInt8(); // walk sound, but we ignore this.
|
reader.ReadUInt8(); // walk sound, but we ignore this.
|
||||||
info.EmitsLight[block] = reader.ReadUInt8() != 0;
|
info.EmitsLight[block] = reader.ReadUInt8() != 0;
|
||||||
|
|
||||||
if( lastOpcode == PacketId.CpeDefineBlock ) {
|
|
||||||
byte shape = reader.ReadUInt8();
|
byte shape = reader.ReadUInt8();
|
||||||
if( shape == 1 ) info.Height[block] = 1;
|
if( shape == 1 ) info.Height[block] = 1;
|
||||||
else if( shape == 2 ) info.Height[block] = 0.5f;
|
else if( shape == 2 ) info.Height[block] = 0.5f;
|
||||||
// TODO: upside down slab not properly supported
|
// TODO: upside down slab not properly supported
|
||||||
else if( shape == 3 ) info.Height[block] = 0.5f;
|
else if( shape == 3 ) info.Height[block] = 0.5f;
|
||||||
else if( shape == 4 ) info.IsSprite[block] = true;
|
else if( shape == 4 ) info.IsSprite[block] = true;
|
||||||
|
|
||||||
byte blockDraw = reader.ReadUInt8();
|
byte blockDraw = reader.ReadUInt8();
|
||||||
if( blockDraw == 0 ) info.IsOpaque[block] = true;
|
if( blockDraw == 0 ) info.IsOpaque[block] = true;
|
||||||
else if( blockDraw == 1 ) info.IsTransparent[block] = true;
|
else if( blockDraw == 1 ) info.IsTransparent[block] = true;
|
||||||
else if( blockDraw == 2 ) info.IsTranslucent[block] = true;
|
else if( blockDraw == 2 ) info.IsTransparent[block] = true; // TODO: hide neighbours
|
||||||
else if( blockDraw == 3 ) info.IsTranslucent[block] = true;
|
else if( blockDraw == 3 ) info.IsTranslucent[block] = true;
|
||||||
|
|
||||||
Console.WriteLine( block + " : " + shape + "," + blockDraw );
|
Console.WriteLine( block + " : " + shape + "," + blockDraw );
|
||||||
} else {
|
|
||||||
byte fogDensity = reader.ReadUInt8();
|
byte fogDensity = reader.ReadUInt8();
|
||||||
info.FogDensity[block] = fogDensity == 0 ? 0 : (fogDensity + 1) / 128f;
|
info.FogDensity[block] = fogDensity == 0 ? 0 : (fogDensity + 1) / 128f;
|
||||||
info.FogColour[block] = new FastColour(
|
info.FogColour[block] = new FastColour(
|
||||||
reader.ReadUInt8(), reader.ReadUInt8(), reader.ReadUInt8() );
|
reader.ReadUInt8(), reader.ReadUInt8(), reader.ReadUInt8() );
|
||||||
}
|
|
||||||
info.SetupCullingCache();
|
info.SetupCullingCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,6 @@ namespace ClassicalSharp {
|
|||||||
int maxHandledPacket;
|
int maxHandledPacket;
|
||||||
|
|
||||||
void SetupHandlers() {
|
void SetupHandlers() {
|
||||||
maxHandledPacket = (int)PacketId.Max;
|
|
||||||
handlers = new Action[] { HandleHandshake, HandlePing, HandleLevelInit,
|
handlers = new Action[] { HandleHandshake, HandlePing, HandleLevelInit,
|
||||||
HandleLevelDataChunk, HandleLevelFinalise, null, HandleSetBlock,
|
HandleLevelDataChunk, HandleLevelFinalise, null, HandleSetBlock,
|
||||||
HandleAddEntity, HandleEntityTeleport, HandleRelPosAndOrientationUpdate,
|
HandleAddEntity, HandleEntityTeleport, HandleRelPosAndOrientationUpdate,
|
||||||
@ -453,9 +452,9 @@ namespace ClassicalSharp {
|
|||||||
HandleCpeEnvColours, HandleCpeMakeSelection, HandleCpeRemoveSelection,
|
HandleCpeEnvColours, HandleCpeMakeSelection, HandleCpeRemoveSelection,
|
||||||
HandleCpeSetBlockPermission, HandleCpeChangeModel, HandleCpeEnvSetMapApperance,
|
HandleCpeSetBlockPermission, HandleCpeChangeModel, HandleCpeEnvSetMapApperance,
|
||||||
HandleCpeEnvWeatherType, HandleCpeHackControl, HandleCpeExtAddEntity2,
|
HandleCpeEnvWeatherType, HandleCpeHackControl, HandleCpeExtAddEntity2,
|
||||||
null, HandleCpeDefineBlockOrLiquid, HandleCpeDefineBlockOrLiquid,
|
null, HandleCpeDefineBlock, HandleCpeRemoveBlockDefinition,
|
||||||
HandleCpeRemoveBlockDefinition
|
|
||||||
};
|
};
|
||||||
|
maxHandledPacket = handlers.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,7 +56,6 @@ namespace ClassicalSharp {
|
|||||||
result.R = (byte)( value.R * t );
|
result.R = (byte)( value.R * t );
|
||||||
result.G = (byte)( value.G * t );
|
result.G = (byte)( value.G * t );
|
||||||
result.B = (byte)( value.B * t );
|
result.B = (byte)( value.B * t );
|
||||||
result.A = 50;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user