Initial work for EnvMapAppearance v3 (EnvMapAspect).

This commit is contained in:
UnknownShadow200 2016-05-12 19:03:21 +10:00
parent 4cafa26354
commit e4fe73b03a
4 changed files with 56 additions and 27 deletions

View File

@ -62,5 +62,7 @@ namespace MCGalaxy {
public const byte CpeDefineBlockExt = 37;
public const byte CpeBulkBlockUpdate = 38;
public const byte CpeSetTextColor = 39;
public const byte CpeSetMapEnvUrl = 40;
public const byte CpeSetMapEnvProperty = 41;
}
}

View File

@ -672,7 +672,8 @@ namespace MCGalaxy {
SendRaw(buffer);
}
public void SendMakeSelection( byte id, string label, short smallx, short smally, short smallz, short bigx, short bigy, short bigz, short r, short g, short b, short opacity ) {
public void SendMakeSelection( byte id, string label, short smallx, short smally, short smallz,
short bigx, short bigy, short bigz, short r, short g, short b, short opacity ) {
byte[] buffer = new byte[86];
buffer[0] = Opcode.CpeMakeSelection;
buffer[1] = id;
@ -738,8 +739,8 @@ namespace MCGalaxy {
SendRaw(Opcode.CpeEnvWeatherType, (byte)weather);
}
void SendHackControl( byte allowflying, byte allownoclip, byte allowspeeding, byte allowrespawning,
byte allowthirdperson, short maxjumpheight ) {
void SendHackControl(byte allowflying, byte allownoclip, byte allowspeeding, byte allowrespawning,
byte allowthirdperson, short maxjumpheight) {
byte[] buffer = new byte[8];
buffer[0] = Opcode.CpeHackControl;
buffer[1] = allowflying;
@ -750,6 +751,21 @@ namespace MCGalaxy {
NetUtils.WriteI16(maxjumpheight, buffer, 6);
SendRaw(buffer);
}
public void SendSetEnvMapUrl(string url) {
byte[] buffer = new byte[65];
buffer[0] = Opcode.CpeSetMapEnvUrl;
NetUtils.WriteAscii(url, buffer, 1);
SendRaw(buffer);
}
public void SendSetEnvMapProperty(EnvProp prop, int value) {
byte[] buffer = new byte[6];
buffer[0] = Opcode.CpeSetMapEnvProperty;
buffer[1] = (byte)prop;
NetUtils.WriteI32(value, buffer, 2);
SendRaw(buffer);
}
internal void CloseSocket() {
// Try to close the socket.

View File

@ -42,6 +42,7 @@ namespace MCGalaxy
public int BlockDefinitionsExt = 0;
public int TextColors = 0;
public int BulkBlockUpdate = 0;
public int EnvMapAspect = 0;
public bool hasCustomBlocks, hasBlockDefs,
hasTextColors, hasChangeModel, hasExtList;
@ -102,34 +103,36 @@ namespace MCGalaxy
} break;
case CpeExt.BulkBlockUpdate:
BulkBlockUpdate = version; break;
case CpeExt.EnvMapAspect:
EnvMapAspect = version; break;
}
}
public bool HasCpeExt(string Extension, int version = 1) {
if (!hasCpe) return false;
switch (Extension)
{
case CpeExt.ClickDistance: return ClickDistance == version;
case CpeExt.CustomBlocks: return CustomBlocks == version;
case CpeExt.HeldBlock: return HeldBlock == version;
case CpeExt.TextHotkey: return TextHotKey == version;
case CpeExt.ExtPlayerList: return ExtPlayerList == version;
case CpeExt.EnvColors: return EnvColors == version;
case CpeExt.SelectionCuboid: return SelectionCuboid == version;
case CpeExt.BlockPermissions: return BlockPermissions == version;
case CpeExt.ChangeModel: return ChangeModel == version;
case CpeExt.EnvMapAppearance: return EnvMapAppearance == version;
case CpeExt.EnvWeatherType: return EnvWeatherType == version;
case CpeExt.HackControl: return HackControl == version;
case CpeExt.EmoteFix: return EmoteFix == version;
case CpeExt.MessageTypes: return MessageTypes == version;
case CpeExt.LongerMessages: return LongerMessages == version;
case CpeExt.FullCP437: return FullCP437 == version;
case CpeExt.BlockDefinitions: return BlockDefinitions == version;
case CpeExt.BlockDefinitionsExt: return BlockDefinitionsExt == version;
case CpeExt.TextColors: return TextColors == version;
case CpeExt.BulkBlockUpdate: return BulkBlockUpdate == version;
default: return false;
switch (Extension) {
case CpeExt.ClickDistance: return ClickDistance == version;
case CpeExt.CustomBlocks: return CustomBlocks == version;
case CpeExt.HeldBlock: return HeldBlock == version;
case CpeExt.TextHotkey: return TextHotKey == version;
case CpeExt.ExtPlayerList: return ExtPlayerList == version;
case CpeExt.EnvColors: return EnvColors == version;
case CpeExt.SelectionCuboid: return SelectionCuboid == version;
case CpeExt.BlockPermissions: return BlockPermissions == version;
case CpeExt.ChangeModel: return ChangeModel == version;
case CpeExt.EnvMapAppearance: return EnvMapAppearance == version;
case CpeExt.EnvWeatherType: return EnvWeatherType == version;
case CpeExt.HackControl: return HackControl == version;
case CpeExt.EmoteFix: return EmoteFix == version;
case CpeExt.MessageTypes: return MessageTypes == version;
case CpeExt.LongerMessages: return LongerMessages == version;
case CpeExt.FullCP437: return FullCP437 == version;
case CpeExt.BlockDefinitions: return BlockDefinitions == version;
case CpeExt.BlockDefinitionsExt: return BlockDefinitionsExt == version;
case CpeExt.TextColors: return TextColors == version;
case CpeExt.BulkBlockUpdate: return BulkBlockUpdate == version;
case CpeExt.EnvMapAspect: return EnvMapAspect == version;
default: return false;
}
}
@ -232,6 +235,7 @@ namespace MCGalaxy
public const string BlockDefinitionsExt = "BlockDefinitionsExt";
public const string TextColors = "TextColors";
public const string BulkBlockUpdate = "BulkBlockUpdate";
public const string EnvMapAspect = "EnvMapAspect";
}
public enum CpeMessageType : byte {
@ -239,4 +243,10 @@ namespace MCGalaxy
BottomRight1 = 11, BottomRight2 = 12, BottomRight3 = 13,
Announcement = 100,
}
public enum EnvProp : byte {
SidesBlock = 0, EdgeBlock = 1, EdgeLevel = 2,
CloudsLevel = 3, MaxFog = 4, CloudsSpeed = 5,
WeatherSpeed = 6, WeatherFade = 7,
}
}

View File

@ -409,7 +409,7 @@ namespace MCGalaxy {
}
void SendCpeExtensions() {
SendExtInfo(20);
SendExtInfo(21);
SendExtEntry(CpeExt.ClickDistance, 1);
SendExtEntry(CpeExt.CustomBlocks, 1);
SendExtEntry(CpeExt.HeldBlock, 1);
@ -436,6 +436,7 @@ namespace MCGalaxy {
SendExtEntry(CpeExt.MessageTypes, 1);
SendExtEntry(CpeExt.ExtPlayerList, 2);
SendExtEntry(CpeExt.EnvMapAspect, 1);
}
bool CheckWhitelist() {