Beispiel #1
0
        public override void Handle(PlayerPlaceBlockPacket packet)
        {
            Console.WriteLine("place");
            int destX = packet.X;
            int destY = packet.Y;
            int destZ = packet.Z;

            if (packet.Face == 0)
                destY--;
            else if (packet.Face == 1)
                destY++;
            else if (packet.Face == 2)
                destZ--;
            else if (packet.Face == 3)
                destZ++;
            else if (packet.Face == 4)
                destX--;
            else if (packet.Face == 5)
                destX++;

            var light = player.World.GetLight(LightType.Sky, destX, destY, destZ);
            var blockLight = player.World.GetLight(LightType.Block, destX, destY, destZ);
            pipe.SendPacket(new ChatPacket(String.Format("{0}, {1}, {2}: {3}, {4}", packet.X, packet.Y, packet.Z, light, blockLight)));

            // TODO: deal with using items (ids >= 256) here
            if (packet.Type != -1 && packet.Type < 256) {
                int typeId = packet.Type;

                server.World.SetBlockType(destX, destY, destZ, typeId);
                pipe.SendPacket(new UpdateBlockPacket(player.World, destX, destY, destZ));
            }
        }
Beispiel #2
0
 public virtual void Handle(PlayerPlaceBlockPacket packet)
 {
     Handle(packet as Packet);
 }