mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -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,
|
||||
CpePlayerClick = 34,
|
||||
CpeDefineBlock = 35,
|
||||
CpeDefineLiquid = 36,
|
||||
CpeRemoveBlockDefinition = 37,
|
||||
|
||||
Max,
|
||||
CpeRemoveBlockDefinition = 36,
|
||||
}
|
||||
|
||||
public enum CpeMessage {
|
||||
|
@ -282,7 +282,7 @@ namespace ClassicalSharp {
|
||||
AddEntity( entityId, displayName, skinName, true );
|
||||
}
|
||||
|
||||
void HandleCpeDefineBlockOrLiquid() {
|
||||
void HandleCpeDefineBlock() {
|
||||
byte block = reader.ReadUInt8();
|
||||
BlockInfo info = game.BlockInfo;
|
||||
info.ResetBlockInfo( block );
|
||||
@ -294,12 +294,11 @@ namespace ClassicalSharp {
|
||||
info.SetTop( reader.ReadUInt8(), (Block)block );
|
||||
info.SetSide( reader.ReadUInt8(), (Block)block );
|
||||
info.SetBottom( reader.ReadUInt8(), (Block)block );
|
||||
reader.ReadUInt8(); // opacity hint, but we ignore this.
|
||||
info.BlocksLight[block] = reader.ReadUInt8() == 0;
|
||||
reader.ReadUInt8(); // walk sound, but we ignore this.
|
||||
info.EmitsLight[block] = reader.ReadUInt8() != 0;
|
||||
|
||||
if( lastOpcode == PacketId.CpeDefineBlock ) {
|
||||
|
||||
byte shape = reader.ReadUInt8();
|
||||
if( shape == 1 ) info.Height[block] = 1;
|
||||
else if( shape == 2 ) info.Height[block] = 0.5f;
|
||||
@ -310,16 +309,15 @@ namespace ClassicalSharp {
|
||||
byte blockDraw = reader.ReadUInt8();
|
||||
if( blockDraw == 0 ) info.IsOpaque[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;
|
||||
|
||||
Console.WriteLine( block + " : " + shape + "," + blockDraw );
|
||||
} else {
|
||||
|
||||
byte fogDensity = reader.ReadUInt8();
|
||||
info.FogDensity[block] = fogDensity == 0 ? 0 : (fogDensity + 1) / 128f;
|
||||
info.FogColour[block] = new FastColour(
|
||||
reader.ReadUInt8(), reader.ReadUInt8(), reader.ReadUInt8() );
|
||||
}
|
||||
info.SetupCullingCache();
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,6 @@ namespace ClassicalSharp {
|
||||
int maxHandledPacket;
|
||||
|
||||
void SetupHandlers() {
|
||||
maxHandledPacket = (int)PacketId.Max;
|
||||
handlers = new Action[] { HandleHandshake, HandlePing, HandleLevelInit,
|
||||
HandleLevelDataChunk, HandleLevelFinalise, null, HandleSetBlock,
|
||||
HandleAddEntity, HandleEntityTeleport, HandleRelPosAndOrientationUpdate,
|
||||
@ -453,9 +452,9 @@ namespace ClassicalSharp {
|
||||
HandleCpeEnvColours, HandleCpeMakeSelection, HandleCpeRemoveSelection,
|
||||
HandleCpeSetBlockPermission, HandleCpeChangeModel, HandleCpeEnvSetMapApperance,
|
||||
HandleCpeEnvWeatherType, HandleCpeHackControl, HandleCpeExtAddEntity2,
|
||||
null, HandleCpeDefineBlockOrLiquid, HandleCpeDefineBlockOrLiquid,
|
||||
HandleCpeRemoveBlockDefinition
|
||||
null, HandleCpeDefineBlock, HandleCpeRemoveBlockDefinition,
|
||||
};
|
||||
maxHandledPacket = handlers.Length;
|
||||
}
|
||||
}
|
||||
}
|
@ -56,7 +56,6 @@ namespace ClassicalSharp {
|
||||
result.R = (byte)( value.R * t );
|
||||
result.G = (byte)( value.G * t );
|
||||
result.B = (byte)( value.B * t );
|
||||
result.A = 50;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user