Пример #1
0
 public override void Set(Objective obj, string field)
 {
     if (this.objective != obj && this.target != field)
     {
         FunctionWriter.Write($"scoreboard players operation {this.target} {this.objective} = {field} {obj}");
     }
 }
Пример #2
0
 public new EnumScore <T> this[string field]
 {
     get
     {
         return(new EnumScore <T>(this, field));
     }
     set
     {
         if (value.Value != null)
         {
             FunctionWriter.Write($"scoreboard players set {field} {this} {IndexOf(value)}");
         }
         else if (!value.Target.Equals(field) || !value.Objective.Equals(this))
         {
             FunctionWriter.Write($"scoreboard players operation {field} {this} = {value.Target} {value.Objective}");
         }
     }
 }
Пример #3
0
 public void List()
 {
     FunctionWriter.Write($"tag {owner} list");
 }
Пример #4
0
 public static Value operator +(Value v, int i)
 {
     FunctionWriter.Write($"xp add {v.holder.owner} {i} {v.pl}");
     return(v);
 }
Пример #5
0
 public static void ResetAll(string name)
 {
     FunctionWriter.Write("scoreboard players reset " + name);
 }
Пример #6
0
 public void Create(string criterion, TextComponent displayName)
 {
     FunctionWriter.Write($"scoreboard objectives add {this} {criterion} {displayName}");
 }
Пример #7
0
 public void Enable(string name)
 {
     FunctionWriter.Write($"scoreboard players enable {name} {this}");
 }
Пример #8
0
 public override void MergeData(NBT nbt)
 {
     FunctionWriter.Write($"data merge block {this} {nbt}");
 }
 public void Revoke()
 {
     FunctionWriter.Write($"advancement revoke {owner} {method} {id}");
 }
Пример #10
0
 public override void Set(Objective obj, string field)
 {
     FunctionWriter.Write($"scoreboard players set {field} {obj} {n}");
 }
Пример #11
0
        internal static void InternalWriteSourceCode(
            CodeTextWriter twSource,
            TranslateContext translateContext,
            PreparedInformations prepared,
            DebugInformationOptions debugInformationOption,
            bool includeAssemblyHeader)
        {
            IExtractContextHost extractContext = translateContext;

            if (includeAssemblyHeader)
            {
                foreach (var fileName in extractContext.EnumerateRequiredPrivateIncludeFileNames())
                {
                    twSource.WriteLine("#include \"{0}\"", fileName);
                }

                twSource.WriteLine("#include \"{0}.h\"", extractContext.Assembly.Name);
                twSource.SplitLine();
            }

            WriteConstStrings(twSource, translateContext);
            WriteDeclaredValues(twSource, translateContext);

            twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
            twSource.WriteLine("// [9-2] File scope prototypes:");
            twSource.SplitLine();

            // All types exclude publics and internals (for file scope prototypes)
            PrototypeWriter.InternalConvertToPrototypes(
                twSource,
                prepared.Types,
                type => !type.IsCLanguagePublicScope,
                field => !(field.IsPublic || field.IsFamily || field.IsFamilyOrAssembly),
                method => (method.IsPublic || method.IsFamily || method.IsFamilyOrAssembly) &&
                prepared.Functions.ContainsKey(method));

            twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
            twSource.WriteLine("// [9-3] Declare static fields:");
            twSource.SplitLine();

            foreach (var type in prepared.Types.
                     Where(type => !type.IsEnum))
            {
                // All static fields
                foreach (var field in type.Fields.
                         Where(field => field.IsStatic))
                {
                    twSource.WriteLine(
                        "{0};",
                        field.GetCLanguageStaticPrototype(true));
                }
                twSource.SplitLine();
            }

            foreach (var type in prepared.Types)
            {
                twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
                twSource.WriteLine("// [9-4] Type: {0}", type.FriendlyName);
                twSource.SplitLine();

                // All methods and constructor exclude type initializer
                foreach (var method in type.DeclaredMethods)
                {
                    FunctionWriter.InternalConvertFromMethod(
                        twSource,
                        extractContext,
                        prepared,
                        method,
                        debugInformationOption);
                }

                if (type.IsClass || type.IsValueType)
                {
                    TypeHelperWriter.InternalConvertTypeHelper(
                        twSource,
                        type);
                }
                else if (type.IsInterface)
                {
                    TypeHelperWriter.InternalConvertTypeHelperForInterface(
                        twSource,
                        type);
                }
            }

            twSource.SplitLine();
        }
Пример #12
0
 public void Remove()
 {
     FunctionWriter.Write($"scoreboard objectives remove {this}");
 }
Пример #13
0
 public void Create()
 {
     FunctionWriter.Write($"scoreboard objectives add {this} dummy");
 }
Пример #14
0
 public void Remove()
 {
     FunctionWriter.Write($"bossbar remove {this}");
 }
Пример #15
0
 public void Create(TextComponent displayName)
 {
     FunctionWriter.Write($"bossbar add {this} {displayName}");
 }
Пример #16
0
 public void GrantAll()
 {
     FunctionWriter.Write($"advancement grant {owner} everything");
 }
Пример #17
0
 public void Grant()
 {
     FunctionWriter.Write($"advancement grant {owner} {method} {id}");
 }
Пример #18
0
 public void Add(string entities)
 {
     FunctionWriter.Write($"team join {this} {entities}");
 }
Пример #19
0
 public void Grant(string criterion)
 {
     FunctionWriter.Write($"advancement grant {owner} only {id} {criterion}");
 }
Пример #20
0
 public void Create(TextComponent displayName)
 {
     FunctionWriter.Write("team add " + this + " " + displayName);
 }
Пример #21
0
 public override void RemoveData(string path)
 {
     FunctionWriter.Write($"data remove block {this} {path}");
 }
Пример #22
0
 public void Create()
 {
     FunctionWriter.Write("team add " + this);
 }
Пример #23
0
 public void Create(string criterion)
 {
     FunctionWriter.Write($"scoreboard objectives add {this} {criterion}");
 }
Пример #24
0
 public void Remove()
 {
     FunctionWriter.Write("team remove " + this);
 }
Пример #25
0
 public void Remove()
 {
     FunctionWriter.Write("scoreboard objectives remove " + this);
 }
Пример #26
0
 public void Clear()
 {
     FunctionWriter.Write("team empty " + this);
 }
Пример #27
0
 public void Query()
 {
     FunctionWriter.Write($"xp query {holder.owner} {pl}");
 }
Пример #28
0
 public void Revoke(string criterion)
 {
     FunctionWriter.Write($"advancement revoke {owner} only {id} {criterion}");
 }
Пример #29
0
 public static Value operator --(Value v)
 {
     FunctionWriter.Write($"xp add {v.holder.owner} -1 {v.pl}");
     return(v);
 }
Пример #30
0
 public void RevokeAll()
 {
     FunctionWriter.Write($"advancement revoke {owner} everything");
 }