Add an opcodes class with names of packets, instead of just using the numerical constants.

This commit is contained in:
UnknownShadow200 2015-12-07 14:12:37 +11:00
parent a190713648
commit 03887f1f79
8 changed files with 131 additions and 59 deletions

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Commands
{ {
byte[] buffer = new byte[65]; byte[] buffer = new byte[65];
Player.StringFormat(" ", 64).CopyTo(buffer, 1); Player.StringFormat(" ", 64).CopyTo(buffer, 1);
p.SendRaw(13, buffer); p.SendRaw(Opcode.Message, buffer);
buffer = null; buffer = null;
} }
public override void Help(Player p) public override void Help(Player p)

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Commands
{ {
byte[] buffer = new byte[65]; byte[] buffer = new byte[65];
Player.StringFormat(" ", 64).CopyTo(buffer, 1); Player.StringFormat(" ", 64).CopyTo(buffer, 1);
p.SendRaw(13, buffer); p.SendRaw(Opcode.Message, buffer);
buffer = null; buffer = null;
} }
public override void Help(Player p) public override void Help(Player p)

View File

@ -66,7 +66,7 @@ namespace MCGalaxy.Commands
p.level = level; p.level = level;
p.SendMotd(); p.SendMotd();
p.SendRaw(2); p.SendRaw(Opcode.LevelInitialise);
byte[] buffer = new byte[level.blocks.Length + 4]; byte[] buffer = new byte[level.blocks.Length + 4];
BitConverter.GetBytes(IPAddress.HostToNetworkOrder(level.blocks.Length)).CopyTo(buffer, 0); BitConverter.GetBytes(IPAddress.HostToNetworkOrder(level.blocks.Length)).CopyTo(buffer, 0);
//ushort xx; ushort yy; ushort zz; //ushort xx; ushort yy; ushort zz;
@ -86,13 +86,13 @@ namespace MCGalaxy.Commands
Buffer.BlockCopy(buffer, length, tempbuffer, 0, buffer.Length - length); Buffer.BlockCopy(buffer, length, tempbuffer, 0, buffer.Length - length);
buffer = tempbuffer; buffer = tempbuffer;
send[1026] = (byte)(i * 100 / number); send[1026] = (byte)(i * 100 / number);
p.SendRaw(3, send); p.SendRaw(Opcode.LevelDataChunk, send);
Thread.Sleep(10); Thread.Sleep(10);
} buffer = new byte[6]; } buffer = new byte[6];
Player.HTNO((short)level.Width).CopyTo(buffer, 0); Player.HTNO((short)level.Width).CopyTo(buffer, 0);
Player.HTNO((short)level.Height).CopyTo(buffer, 2); Player.HTNO((short)level.Height).CopyTo(buffer, 2);
Player.HTNO((short)level.Length).CopyTo(buffer, 4); Player.HTNO((short)level.Length).CopyTo(buffer, 4);
p.SendRaw(4, buffer); p.SendRaw(Opcode.LevelFinalise, buffer);
ushort x = (ushort)((0.5 + level.spawnx) * 32); ushort x = (ushort)((0.5 + level.spawnx) * 32);
ushort y = (ushort)((1 + level.spawny) * 32); ushort y = (ushort)((1 + level.spawny) * 32);

View File

@ -68,17 +68,17 @@ namespace MCGalaxy.Levels.Textures
if (text == "") if (text == "")
{ {
Player.StringFormat(detail, 64).CopyTo(buffer, 1); Player.StringFormat(detail, 64).CopyTo(buffer, 1);
p.SendRaw(13, buffer); p.SendRaw(Opcode.Message, buffer);
} }
else if (!text.StartsWith("^")) else if (!text.StartsWith("^"))
{ {
Player.StringFormat("^detail.user=" + text, 64).CopyTo(buffer, 1); Player.StringFormat("^detail.user=" + text, 64).CopyTo(buffer, 1);
p.SendRaw(13, buffer); p.SendRaw(Opcode.Message, buffer);
} }
else else
{ {
Player.StringFormat(text, 64).CopyTo(buffer, 1); Player.StringFormat(text, 64).CopyTo(buffer, 1);
p.SendRaw(13, buffer); p.SendRaw(Opcode.Message, buffer);
} }
} }
buffer = null; buffer = null;

View File

@ -432,6 +432,7 @@
<Compile Include="Levels\Physics\TrainPhysics.cs" /> <Compile Include="Levels\Physics\TrainPhysics.cs" />
<Compile Include="Levels\Physics\TntPhysics.cs" /> <Compile Include="Levels\Physics\TntPhysics.cs" />
<Compile Include="Levels\Physics\ZombiePhysics.cs" /> <Compile Include="Levels\Physics\ZombiePhysics.cs" />
<Compile Include="Network\Opcode.cs" />
<Compile Include="Network\Player.Networking.cs" /> <Compile Include="Network\Player.Networking.cs" />
<Compile Include="Player\Alias.cs" /> <Compile Include="Player\Alias.cs" />
<Compile Include="API\API.cs" /> <Compile Include="API\API.cs" />

63
Network/Opcode.cs Normal file
View File

@ -0,0 +1,63 @@
/*
Copyright 2015 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy {
public static class Opcode {
public const byte Handshake = 0;
public const byte Ping = 1;
public const byte LevelInitialise = 2;
public const byte LevelDataChunk = 3;
public const byte LevelFinalise = 4;
public const byte SetBlockClient = 5;
public const byte SetBlock = 6;
public const byte AddEntity = 7;
public const byte EntityTeleport = 8;
public const byte RelPosAndOrientationUpdate = 9;
public const byte RelPosUpdate = 10;
public const byte OrientationUpdate = 11;
public const byte RemoveEntity = 12;
public const byte Message = 13;
public const byte Kick = 14;
public const byte SetPermission = 15;
public const byte CpeExtInfo = 16;
public const byte CpeExtEntry = 17;
public const byte CpeSetClickDistance = 18;
public const byte CpeCustomBlockSupportLevel = 19;
public const byte CpeHoldThis = 20;
public const byte CpeSetTextHotkey = 21;
public const byte CpeExtAddPlayerName = 22;
public const byte CpeExtAddEntity = 23;
public const byte CpeExtRemovePlayerName = 24;
public const byte CpeEnvColours = 25;
public const byte CpeMakeSelection = 26;
public const byte CpeRemoveSelection = 27;
public const byte CpeSetBlockPermission = 28;
public const byte CpeChangeModel = 29;
public const byte CpeEnvSetMapApperance = 30;
public const byte CpeEnvWeatherType = 31;
public const byte CpeHackControl = 32;
public const byte CpeExtAddEntity2 = 33;
public const byte CpePlayerClick = 34;
public const byte CpeDefineBlock = 35;
public const byte CpeRemoveBlockDefinition = 36;
}
}

View File

@ -107,7 +107,7 @@ namespace MCGalaxy {
{ {
byte[] buffer = new byte[65]; byte[] buffer = new byte[65];
Player.StringFormat("^detail.user.here=" + p.color + p.name, 64).CopyTo(buffer, 1); Player.StringFormat("^detail.user.here=" + p.color + p.name, 64).CopyTo(buffer, 1);
SendRaw(13, buffer); SendRaw(Opcode.Message, buffer);
buffer = null; buffer = null;
} }
}); });
@ -329,7 +329,7 @@ namespace MCGalaxy {
StringFormat437(newLine, 64).CopyTo(buffer, 1); StringFormat437(newLine, 64).CopyTo(buffer, 1);
else else
StringFormat(newLine, 64).CopyTo(buffer, 1); StringFormat(newLine, 64).CopyTo(buffer, 1);
SendRaw(13, buffer); SendRaw(Opcode.Message, buffer);
} }
} }
catch ( Exception e ) { catch ( Exception e ) {
@ -359,8 +359,7 @@ namespace MCGalaxy {
if ( OnSendMOTD != null ) { if ( OnSendMOTD != null ) {
OnSendMOTD(this, buffer); OnSendMOTD(this, buffer);
} }
SendRaw(0, buffer); SendRaw(Opcode.Handshake, buffer);
} }
public void SendUserMOTD() { public void SendUserMOTD() {
@ -380,7 +379,7 @@ namespace MCGalaxy {
buffer[129] = 100; buffer[129] = 100;
else else
buffer[129] = 0; buffer[129] = 0;
SendRaw(0, buffer); SendRaw(Opcode.Handshake, buffer);
} }
public void SendMap() { public void SendMap() {
@ -402,7 +401,7 @@ namespace MCGalaxy {
buffer[4 + i] = (byte)Block.Convert(Block.ConvertCPE(level.blocks[i])); buffer[4 + i] = (byte)Block.Convert(Block.ConvertCPE(level.blocks[i]));
} }
} }
SendRaw(2); SendRaw(Opcode.LevelInitialise);
buffer = buffer.GZip(); buffer = buffer.GZip();
int number = (int)Math.Ceiling(( (double)buffer.Length ) / 1024); int number = (int)Math.Ceiling(( (double)buffer.Length ) / 1024);
@ -416,7 +415,7 @@ namespace MCGalaxy {
buffer = tempbuffer; buffer = tempbuffer;
send[1026] = (byte)( i * 100 / number ); send[1026] = (byte)( i * 100 / number );
//send[1026] = (byte)(100 - (i * 100 / number)); // Backwards progress lololol... //send[1026] = (byte)(100 - (i * 100 / number)); // Backwards progress lololol...
SendRaw(3, send); SendRaw(Opcode.LevelDataChunk, send);
if ( ip == "127.0.0.1" ) { } if ( ip == "127.0.0.1" ) { }
else if ( Server.updateTimer.Interval > 1000 ) Thread.Sleep(100); else if ( Server.updateTimer.Interval > 1000 ) Thread.Sleep(100);
else Thread.Sleep(10); else Thread.Sleep(10);
@ -424,7 +423,7 @@ namespace MCGalaxy {
HTNO((short)level.Width).CopyTo(buffer, 0); HTNO((short)level.Width).CopyTo(buffer, 0);
HTNO((short)level.Height).CopyTo(buffer, 2); HTNO((short)level.Height).CopyTo(buffer, 2);
HTNO((short)level.Length).CopyTo(buffer, 4); HTNO((short)level.Length).CopyTo(buffer, 4);
SendRaw(4, buffer); SendRaw(Opcode.LevelFinalise, buffer);
Loading = false; Loading = false;
if (HasExtension("EnvWeatherType")) if (HasExtension("EnvWeatherType"))
{ {
@ -504,11 +503,12 @@ namespace MCGalaxy {
HTNO(y).CopyTo(buffer, 67); HTNO(y).CopyTo(buffer, 67);
HTNO(z).CopyTo(buffer, 69); HTNO(z).CopyTo(buffer, 69);
buffer[71] = rotx; buffer[72] = roty; buffer[71] = rotx; buffer[72] = roty;
SendRaw(7, buffer); SendRaw(Opcode.AddEntity, buffer);
if (HasExtension("ChangeModel")) if (HasExtension("ChangeModel"))
{ {
Player.players.ForEach(p => Player.players.ForEach(
p =>
{ {
if (p.level == this.level) if (p.level == this.level)
if (p == this) unchecked { SendChangeModel((byte)-1, model); } if (p == this) unchecked { SendChangeModel((byte)-1, model); }
@ -534,22 +534,23 @@ namespace MCGalaxy {
pos[0] = x; pos[1] = y; pos[2] = z; pos[0] = x; pos[1] = y; pos[2] = z;
rot[0] = rotx; rot[1] = roty; rot[0] = rotx; rot[1] = roty;
/* byte[] buffer = new byte[9];
pos = new ushort[3] { x, y, z }; buffer[0] = id;
rot = new byte[2] { rotx, roty };*/
byte[] buffer = new byte[9]; buffer[0] = id;
HTNO(x).CopyTo(buffer, 1); HTNO(x).CopyTo(buffer, 1);
HTNO(y).CopyTo(buffer, 3); HTNO(y).CopyTo(buffer, 3);
HTNO(z).CopyTo(buffer, 5); HTNO(z).CopyTo(buffer, 5);
buffer[7] = rotx; buffer[8] = roty; buffer[7] = rotx;
SendRaw(8, buffer); buffer[8] = roty;
SendRaw(Opcode.EntityTeleport, buffer);
} }
// Update user type for weather or not they are opped // Update user type for weather or not they are opped
public void SendUserType(bool op) { public void SendUserType(bool op) {
SendRaw(15, op ? (byte)100 : (byte)0); SendRaw(Opcode.SetPermission, op ? (byte)100 : (byte)0);
} }
//TODO: Figure a way to SendPos without changing rotation //TODO: Figure a way to SendPos without changing rotation
public void SendDie(byte id) { SendRaw(0x0C, new byte[1] { id }); } public void SendDie(byte id) {
SendRaw(Opcode.RemoveEntity, new byte[1] { id });
}
public void SendBlockchange(ushort x, ushort y, ushort z, byte type) { public void SendBlockchange(ushort x, ushort y, ushort z, byte type) {
if (x < 0 || y < 0 || z < 0) return; if (x < 0 || y < 0 || z < 0) return;
if (x >= level.Width || y >= level.Height || z >= level.Length) return; if (x >= level.Width || y >= level.Height || z >= level.Length) return;
@ -580,15 +581,19 @@ rot = new byte[2] { rotx, roty };*/
buffer[6] = (byte)Block.Convert(Block.ConvertCPE(type)); buffer[6] = (byte)Block.Convert(Block.ConvertCPE(type));
} }
} }
SendRaw(6, buffer); SendRaw(Opcode.SetBlock , buffer);
}
void SendKick(string message) {
SendRaw(Opcode.Kick, StringFormat(message, 64));
}
void SendPing() {
SendRaw(Opcode.Ping);
} }
void SendKick(string message) { SendRaw(14, StringFormat(message, 64)); }
void SendPing() { /*pingDelay = 0; pingDelayTimer.Start();*/ SendRaw(1); }
void SendExtInfo( byte count ) { void SendExtInfo( byte count ) {
byte[] buffer = new byte[66]; byte[] buffer = new byte[66];
StringFormat( "MCGalaxy " + Server.Version, 64 ).CopyTo( buffer, 0 ); StringFormat( "MCGalaxy " + Server.Version, 64 ).CopyTo( buffer, 0 );
HTNO( count ).CopyTo( buffer, 64 ); HTNO( count ).CopyTo( buffer, 64 );
SendRaw( 16, buffer ); SendRaw( Opcode.CpeExtInfo, buffer );
} }
void SendExtEntry( string name, int version ) { void SendExtEntry( string name, int version ) {
byte[] version_ = BitConverter.GetBytes(version); byte[] version_ = BitConverter.GetBytes(version);
@ -597,23 +602,23 @@ rot = new byte[2] { rotx, roty };*/
byte[] buffer = new byte[68]; byte[] buffer = new byte[68];
StringFormat(name, 64).CopyTo(buffer, 0); StringFormat(name, 64).CopyTo(buffer, 0);
version_.CopyTo(buffer, 64); version_.CopyTo(buffer, 64);
SendRaw( 17, buffer ); SendRaw( Opcode.CpeExtEntry, buffer );
} }
void SendClickDistance( short distance ) { void SendClickDistance( short distance ) {
byte[] buffer = new byte[2]; byte[] buffer = new byte[2];
HTNO( distance ).CopyTo( buffer, 0 ); HTNO( distance ).CopyTo( buffer, 0 );
SendRaw( 18, buffer ); SendRaw( Opcode.CpeSetClickDistance, buffer );
} }
void SendCustomBlockSupportLevel(byte level) { void SendCustomBlockSupportLevel(byte level) {
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
buffer[0] = level; buffer[0] = level;
SendRaw( 19, buffer ); SendRaw( Opcode.CpeCustomBlockSupportLevel, buffer );
} }
void SendHoldThis( byte type, byte locked ) { // if locked is on 1, then the player can't change their selected block. void SendHoldThis( byte type, byte locked ) { // if locked is on 1, then the player can't change their selected block.
byte[] buffer = new byte[2]; byte[] buffer = new byte[2];
buffer[0] = type; buffer[0] = type;
buffer[1] = locked; buffer[1] = locked;
SendRaw( 20, buffer ); SendRaw( Opcode.CpeHoldThis, buffer );
} }
void SendTextHotKey( string label, string command, int keycode, byte mods ) { void SendTextHotKey( string label, string command, int keycode, byte mods ) {
byte[] buffer = new byte[133]; byte[] buffer = new byte[133];
@ -621,7 +626,7 @@ rot = new byte[2] { rotx, roty };*/
StringFormat( command, 64 ).CopyTo( buffer, 64 ); StringFormat( command, 64 ).CopyTo( buffer, 64 );
BitConverter.GetBytes( keycode ).CopyTo( buffer, 128 ); BitConverter.GetBytes( keycode ).CopyTo( buffer, 128 );
buffer[132] = mods; buffer[132] = mods;
SendRaw( 21, buffer ); SendRaw( Opcode.CpeSetTextHotkey, buffer );
} }
public void SendExtAddPlayerName(short id, string name, Group grp, string displayname = "") public void SendExtAddPlayerName(short id, string name, Group grp, string displayname = "")
{ {
@ -632,7 +637,7 @@ rot = new byte[2] { rotx, roty };*/
StringFormat(displayname, 64).CopyTo(buffer, 66); StringFormat(displayname, 64).CopyTo(buffer, 66);
StringFormat(grp.color + grp.name.ToUpper() + "s:", 64).CopyTo(buffer, 130); StringFormat(grp.color + grp.name.ToUpper() + "s:", 64).CopyTo(buffer, 130);
buffer[194] = (byte)grp.Permission.GetHashCode(); buffer[194] = (byte)grp.Permission.GetHashCode();
SendRaw(22, buffer); SendRaw(Opcode.CpeExtAddPlayerName, buffer);
} }
public void SendExtAddEntity(byte id, string name, string displayname = "") public void SendExtAddEntity(byte id, string name, string displayname = "")
@ -642,12 +647,12 @@ rot = new byte[2] { rotx, roty };*/
StringFormat(name, 64).CopyTo(buffer, 1); StringFormat(name, 64).CopyTo(buffer, 1);
if (displayname == "") { displayname = name; } if (displayname == "") { displayname = name; }
StringFormat(displayname, 64).CopyTo(buffer, 65); StringFormat(displayname, 64).CopyTo(buffer, 65);
SendRaw(23, buffer); SendRaw( Opcode.CpeExtAddEntity, buffer);
} }
public void SendDeletePlayerName( byte id ) { public void SendDeletePlayerName( byte id ) {
byte[] buffer = new byte[2]; byte[] buffer = new byte[2];
HTNO( (short)id ).CopyTo( buffer, 0 ); HTNO( (short)id ).CopyTo( buffer, 0 );
SendRaw( 24, buffer ); SendRaw( Opcode.CpeExtRemovePlayerName, buffer );
} }
public void SendEnvColors( byte type, short r, short g, short b ) { public void SendEnvColors( byte type, short r, short g, short b ) {
byte[] buffer = new byte[7]; byte[] buffer = new byte[7];
@ -655,7 +660,7 @@ rot = new byte[2] { rotx, roty };*/
HTNO( r ).CopyTo( buffer, 1 ); HTNO( r ).CopyTo( buffer, 1 );
HTNO( g ).CopyTo( buffer, 3 ); HTNO( g ).CopyTo( buffer, 3 );
HTNO( b ).CopyTo( buffer, 5 ); HTNO( b ).CopyTo( buffer, 5 );
SendRaw( 25, buffer ); SendRaw( Opcode.CpeEnvColours, 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[85]; byte[] buffer = new byte[85];
@ -671,25 +676,25 @@ rot = new byte[2] { rotx, roty };*/
HTNO( g ).CopyTo( buffer, 79); HTNO( g ).CopyTo( buffer, 79);
HTNO( b ).CopyTo( buffer, 81 ); HTNO( b ).CopyTo( buffer, 81 );
HTNO( opacity ).CopyTo( buffer, 83 ); HTNO( opacity ).CopyTo( buffer, 83 );
SendRaw( 26, buffer ); SendRaw( Opcode.CpeMakeSelection, buffer );
} }
public void SendDeleteSelection( byte id ) { public void SendDeleteSelection( byte id ) {
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
buffer[0] = id; buffer[0] = id;
SendRaw( 27, buffer ); SendRaw( Opcode.CpeRemoveSelection, buffer );
} }
void SendSetBlockPermission( byte type, byte canplace, byte candelete ) { void SendSetBlockPermission( byte type, byte canplace, byte candelete ) {
byte[] buffer = new byte[3]; byte[] buffer = new byte[3];
buffer[0] = type; buffer[0] = type;
buffer[1] = canplace; buffer[1] = canplace;
buffer[2] = candelete; buffer[2] = candelete;
SendRaw( 28, buffer ); SendRaw( Opcode.CpeSetBlockPermission, buffer );
} }
public void SendChangeModel( byte id, string model ) { public void SendChangeModel( byte id, string model ) {
byte[] buffer = new byte[65]; byte[] buffer = new byte[65];
buffer[0] = id; buffer[0] = id;
StringFormat( model, 64 ).CopyTo( buffer, 1 ); StringFormat( model, 64 ).CopyTo( buffer, 1 );
SendRaw( 29, buffer ); SendRaw( Opcode.CpeChangeModel, buffer );
} }
public void SendSetMapAppearance( string url, byte sideblock, byte edgeblock, short sidelevel ) { public void SendSetMapAppearance( string url, byte sideblock, byte edgeblock, short sidelevel ) {
byte[] buffer = new byte[68]; byte[] buffer = new byte[68];
@ -697,13 +702,15 @@ rot = new byte[2] { rotx, roty };*/
buffer[64] = sideblock; buffer[64] = sideblock;
buffer[65] = edgeblock; buffer[65] = edgeblock;
HTNO( sidelevel ).CopyTo( buffer, 66 ); HTNO( sidelevel ).CopyTo( buffer, 66 );
SendRaw( 30, buffer ); SendRaw( Opcode.CpeEnvSetMapApperance, buffer );
} }
public void SendSetMapWeather( byte weather ) { // 0 - sunny; 1 - raining; 2 - snowing public void SendSetMapWeather( byte weather ) { // 0 - sunny; 1 - raining; 2 - snowing
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
buffer[0] = weather; buffer[0] = weather;
SendRaw( 31, buffer ); SendRaw( Opcode.CpeEnvWeatherType, buffer );
} }
void SendHackControl( byte allowflying, byte allownoclip, byte allowspeeding, byte allowrespawning, byte allowthirdperson, byte allowchangingweather, short maxjumpheight ) { void SendHackControl( byte allowflying, byte allownoclip, byte allowspeeding, byte allowrespawning, byte allowthirdperson, byte allowchangingweather, short maxjumpheight ) {
byte[] buffer = new byte[7]; byte[] buffer = new byte[7];
buffer[0] = allowflying; buffer[0] = allowflying;
@ -713,8 +720,9 @@ rot = new byte[2] { rotx, roty };*/
buffer[4] = allowthirdperson; buffer[4] = allowthirdperson;
buffer[5] = allowchangingweather; buffer[5] = allowchangingweather;
HTNO( maxjumpheight ).CopyTo( buffer, 6 ); HTNO( maxjumpheight ).CopyTo( buffer, 6 );
SendRaw( 32, buffer ); SendRaw( Opcode.CpeHackControl, buffer );
} }
public void SendBlockDefinitions(BlockDefinitions bd) public void SendBlockDefinitions(BlockDefinitions bd)
{ {
byte[] buffer = new byte[79]; byte[] buffer = new byte[79];
@ -734,7 +742,7 @@ rot = new byte[2] { rotx, roty };*/
buffer[76] = bd.FogR; buffer[76] = bd.FogR;
buffer[77] = bd.FogG; buffer[77] = bd.FogG;
buffer[78] = bd.FogB; buffer[78] = bd.FogB;
SendRaw(35, buffer); SendRaw(Opcode.CpeDefineBlock, buffer);
} }
void UpdatePosition() { void UpdatePosition() {

View File

@ -1140,7 +1140,7 @@ namespace MCGalaxy {
{ {
byte[] buffer = new byte[65]; byte[] buffer = new byte[65];
Player.StringFormat("^detail.user.join=" + color + name + c.white, 64).CopyTo(buffer, 1); Player.StringFormat("^detail.user.join=" + color + name + c.white, 64).CopyTo(buffer, 1);
p1.SendRaw(13, buffer); p1.SendRaw(Opcode.Message, buffer);
buffer = null; buffer = null;
} }
else else
@ -3121,7 +3121,7 @@ return;
{ {
byte[] buffer = new byte[65]; byte[] buffer = new byte[65];
Player.StringFormat("^detail.user.part=" + color + name + c.white, 64).CopyTo(buffer, 1); Player.StringFormat("^detail.user.part=" + color + name + c.white, 64).CopyTo(buffer, 1);
p1.SendRaw(13, buffer); p1.SendRaw(Opcode.Message, buffer);
buffer = null; buffer = null;
} }
else else