Confirmedusers
13,514
edits
Mirotworez (talk | contribs) (Created page with "<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.Code...") |
Mirotworez (talk | contribs) (Created page with "<syntaxhighlight lang="c#"> public override void Initialize(ICoreAPI api) { base.Initialize(api); } </syntaxhighlight>") |
||
Line 110: | Line 110: | ||
== Регистрация объекта блока == | == Регистрация объекта блока == | ||
Регистрация класса блочной сущности довольно проста (скорее похожа на регистрацию блочного класса). Вам нужен класс мода и переопределить <code>Start(ICoreAPI)</code>: | |||
<syntaxhighlight lang="c#"> | <syntaxhighlight lang="c#"> | ||
public class Ticking : ModSystem | public class Ticking : ModSystem | ||
{ | { | ||
public override void Start(ICoreAPI api) | |||
public override void Start(ICoreAPI api) | |||
{ | { | ||
base.Start(api); | base.Start(api); | ||
api.RegisterBlockEntityClass("tickingcounter", typeof(TickingBlockEntity)); | api.RegisterBlockEntityClass("tickingcounter", typeof(TickingBlockEntity)); | ||
} | } | ||
} | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> |