示例#1
0
        internal void OnInteract(IPlayer byPlayer)
        {
            if (byPlayer.WorldData.CurrentGameMode != EnumGameMode.Creative)
            {
                return;
            }

            if (api.Side == EnumAppSide.Server)
            {
                ICoreServerAPI sapi = api as ICoreServerAPI;
                sapi.Network.SendBlockEntityPacket(byPlayer as IServerPlayer, pos.X, pos.Y, pos.Z, 1000, SerializerUtil.Serialize(data));
                return;
            }

            dlg             = new GuiDialogSpawner(pos, api as ICoreClientAPI);
            dlg.spawnerData = data;
            dlg.TryOpen();
        }
示例#2
0
        internal void OnInteract(IPlayer byPlayer)
        {
            if (byPlayer.WorldData.CurrentGameMode != EnumGameMode.Creative)
            {
                return;
            }

            if (Api.Side == EnumAppSide.Server)
            {
                ICoreServerAPI sapi = Api as ICoreServerAPI;
                sapi.Network.SendBlockEntityPacket(byPlayer as IServerPlayer, Pos.X, Pos.Y, Pos.Z, 1000, SerializerUtil.Serialize(Data));
                return;
            }

            dlg             = new GuiDialogSpawner(Pos, Api as ICoreClientAPI);
            dlg.spawnerData = Data;
            dlg.TryOpen();
            dlg.OnClosed += () => { dlg?.Dispose(); dlg = null; };
        }