Translations:Modding:Block Entity/21/en

From Vintage Story Wiki
Revision as of 05:39, 10 October 2022 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<syntaxhighlight lang="c#">

       public void OnGameTick(float dt)
       {
           timer += dt;
           if(timer >= 3)
           {
               Block block = Api.World.BlockAccessor.GetBlock(Pos);
               if (block.Code.Path.EndsWith("-on"))
               {
                   block = Api.World.GetBlock(block.CodeWithParts("off"));
               }
               else
               {
                   block = Api.World.GetBlock(block.CodeWithParts("on"));
               }