Exemplo n.º 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}");
     }
 }
Exemplo n.º 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}");
         }
     }
 }
Exemplo n.º 3
0
 public void List()
 {
     FunctionWriter.Write($"tag {owner} list");
 }
Exemplo n.º 4
0
 public static Value operator +(Value v, int i)
 {
     FunctionWriter.Write($"xp add {v.holder.owner} {i} {v.pl}");
     return(v);
 }
Exemplo n.º 5
0
 public static void ResetAll(string name)
 {
     FunctionWriter.Write("scoreboard players reset " + name);
 }
Exemplo n.º 6
0
 public void Create(string criterion, TextComponent displayName)
 {
     FunctionWriter.Write($"scoreboard objectives add {this} {criterion} {displayName}");
 }
Exemplo n.º 7
0
 public void Enable(string name)
 {
     FunctionWriter.Write($"scoreboard players enable {name} {this}");
 }
Exemplo n.º 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}");
 }
Exemplo n.º 10
0
 public override void Set(Objective obj, string field)
 {
     FunctionWriter.Write($"scoreboard players set {field} {obj} {n}");
 }
Exemplo 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();
        }
Exemplo n.º 12
0
 public void Remove()
 {
     FunctionWriter.Write($"scoreboard objectives remove {this}");
 }
Exemplo n.º 13
0
 public void Create()
 {
     FunctionWriter.Write($"scoreboard objectives add {this} dummy");
 }
Exemplo n.º 14
0
 public void Remove()
 {
     FunctionWriter.Write($"bossbar remove {this}");
 }
Exemplo n.º 15
0
 public void Create(TextComponent displayName)
 {
     FunctionWriter.Write($"bossbar add {this} {displayName}");
 }
Exemplo n.º 16
0
 public void GrantAll()
 {
     FunctionWriter.Write($"advancement grant {owner} everything");
 }
Exemplo n.º 17
0
 public void Grant()
 {
     FunctionWriter.Write($"advancement grant {owner} {method} {id}");
 }
Exemplo n.º 18
0
 public void Add(string entities)
 {
     FunctionWriter.Write($"team join {this} {entities}");
 }
Exemplo n.º 19
0
 public void Grant(string criterion)
 {
     FunctionWriter.Write($"advancement grant {owner} only {id} {criterion}");
 }
Exemplo n.º 20
0
 public void Create(TextComponent displayName)
 {
     FunctionWriter.Write("team add " + this + " " + displayName);
 }
Exemplo n.º 21
0
 public override void RemoveData(string path)
 {
     FunctionWriter.Write($"data remove block {this} {path}");
 }
Exemplo n.º 22
0
 public void Create()
 {
     FunctionWriter.Write("team add " + this);
 }
Exemplo n.º 23
0
 public void Create(string criterion)
 {
     FunctionWriter.Write($"scoreboard objectives add {this} {criterion}");
 }
Exemplo n.º 24
0
 public void Remove()
 {
     FunctionWriter.Write("team remove " + this);
 }
Exemplo n.º 25
0
 public void Remove()
 {
     FunctionWriter.Write("scoreboard objectives remove " + this);
 }
Exemplo n.º 26
0
 public void Clear()
 {
     FunctionWriter.Write("team empty " + this);
 }
Exemplo n.º 27
0
 public void Query()
 {
     FunctionWriter.Write($"xp query {holder.owner} {pl}");
 }
Exemplo n.º 28
0
 public void Revoke(string criterion)
 {
     FunctionWriter.Write($"advancement revoke {owner} only {id} {criterion}");
 }
Exemplo n.º 29
0
 public static Value operator --(Value v)
 {
     FunctionWriter.Write($"xp add {v.holder.owner} -1 {v.pl}");
     return(v);
 }
Exemplo n.º 30
0
 public void RevokeAll()
 {
     FunctionWriter.Write($"advancement revoke {owner} everything");
 }