public static WriteInt16 ( |
||
bw | ||
v | short | |
Résultat | void |
public void SendSetBlock(Vector3 position, BlockSetMode mode, int type, int materialslot) { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); bw.Write((byte)MinecraftClientPacketId.SetBlock); if (ENABLE_FORTRESS) { throw new Exception(); } else { NetworkHelper.WriteInt16(bw, (short)(position.X));//-4 NetworkHelper.WriteInt16(bw, (short)(position.Z)); NetworkHelper.WriteInt16(bw, (short)position.Y); } bw.Write((byte)(mode == BlockSetMode.Create ? 1 : 0)); bw.Write((byte)type); SendPacket(ms.ToArray()); //tosend.Add(ms.ToArray()); //Console.WriteLine(this.position.LocalPlayerPosition); //Console.WriteLine("p" + position); //Console.WriteLine("player:" + lastsentposition + ", build:" + position // + ", block:" + type + ", mode:" + Enum.GetName(typeof(BlockSetMode), mode)); }
public void SendPosition(Vector3 position, Vector3 orientation) { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); bw.Write((byte)MinecraftClientPacketId.PositionandOrientation); bw.Write((byte)255);//player id, self if (ENABLE_FORTRESS) { NetworkHelper.WriteInt32(bw, (int)((position.X) * 32));//gfd1 NetworkHelper.WriteInt32(bw, (int)((position.Y + CharacterPhysics.characterheight) * 32)); NetworkHelper.WriteInt32(bw, (int)(position.Z * 32)); } else { NetworkHelper.WriteInt16(bw, (short)((position.X) * 32));//gfd1 NetworkHelper.WriteInt16(bw, (short)((position.Y + CharacterPhysics.characterheight) * 32)); NetworkHelper.WriteInt16(bw, (short)(position.Z * 32)); } bw.Write(NetworkHelper.HeadingByte(orientation)); bw.Write(NetworkHelper.PitchByte(orientation)); SendPacket(ms.ToArray()); lastsentposition = position; }