コード例 #1
0
 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));
 }
コード例 #2
0
ファイル: NetworkClient.cs プロジェクト: Jonty800/LauncherX
 public void SendSetBlock(Vector3 position, BlockSetMode mode, int type)
 {
     if (mode == BlockSetMode.Destroy)
     {
         type = Data.TileIdEmpty;
     }
     //block update not needed - client does speculative block update.
     //Map1.SetTileAndUpdate(position, (byte)type);
     Console.WriteLine("player:" + player.LocalPlayerPosition + ", build:" + position);
 }
コード例 #3
0
 private void SendSetBlockAndUpdateSpeculative(int activematerial, int x, int y, int z, BlockSetMode mode)
 {
     network.SendSetBlock(new Vector3(x, y, z), mode, activematerial);
     if (mode == BlockSetMode.Destroy)
     {
         activematerial = data.TileIdEmpty;
     }
     speculative[new Vector3i(x, y, z)] = new Speculative() { blocktype = activematerial, time = DateTime.Now };
     terrain.UpdateTile(x, y, z);
     shadows.OnLocalBuild(x, y, z);
 }
コード例 #4
0
 public void SendSetBlock(Vector3 vector3, BlockSetMode blockSetMode, int p)
 {
     network.SendSetBlock(vector3, blockSetMode, p);
 }
コード例 #5
0
 public void SendSetBlock(Vector3 position, BlockSetMode mode, int type)
 {
     PacketClientSetBlock p = new PacketClientSetBlock()
     {
         X = (int)position.X,
         Y = (int)position.Y,
         Z = (int)position.Z,
         Mode = (mode == BlockSetMode.Create ? (byte)1 : (byte)0),
         BlockType = type
     };
     SendPacket(Serialize(new PacketClient() { PacketId = ClientPacketId.SetBlock, SetBlock = p }));
 }
コード例 #6
0
 public void SendSetBlock(OpenTK.Vector3 position, BlockSetMode mode, int type)
 {
 }
コード例 #7
0
        private void SendSetBlockAndUpdateSpeculative(int material, int x, int y, int z, BlockSetMode mode)
        {
            SendSetBlock(new Vector3(x, y, z), mode, material, ActiveMaterial);

            Item item = d_Inventory.RightHand[ActiveMaterial];
            if (item != null && item.ItemClass == ItemClass.Block)
            {
                //int blockid = d_Inventory.RightHand[d_Viewport.ActiveMaterial].BlockId;
                int blockid = material;
                if (mode == BlockSetMode.Destroy)
                {
                    blockid = SpecialBlockId.Empty;
                }
                speculative[new Vector3i(x, y, z)] = new Speculative() { blocktype = d_Map.GetBlock(x, y, z), time = DateTime.UtcNow };
                SetBlock(x, y, z, blockid);
                RedrawBlock(x, y, z);
                OnLocalBuild(x, y, z);
            }
            else
            {
                //todo
            }
        }
コード例 #8
0
 public void SendSetBlock(Vector3 position, BlockSetMode mode, int type, int materialslot)
 {
     PacketClientSetBlock p = new PacketClientSetBlock()
     {
         X = (int)position.X,
         Y = (int)position.Y,
         Z = (int)position.Z,
         Mode = mode,
         BlockType = type,
         MaterialSlot = materialslot,
     };
     SendPacket(Serialize(new PacketClient() { PacketId = ClientPacketId.SetBlock, SetBlock = p }));
 }
コード例 #9
0
 public void SendSetBlock(Vector3 vector3, BlockSetMode blockSetMode, int p)
 {
     SendSetBlock(vector3, blockSetMode, p, ActiveMaterial);
 }