public override void Initialize(ICoreAPI api) { base.Initialize(api); if (contents != null) { contents.ResolveBlockOrItem(api.World); } if (energyStorage == null) { energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "storage", 10000), MyMiniLib.GetAttributeInt(Block, "input", 1000), 0); } if (api is ICoreClientAPI) { ICoreClientAPI capi = (ICoreClientAPI)api; capi.Event.RegisterRenderer(renderer = new TFForgeContentsRenderer(Pos, capi), EnumRenderStage.Opaque, "tfforge"); renderer.SetContents(contents, burning, true); RegisterGameTickListener(OnClientTick, 500); } consume = MyMiniLib.GetAttributeInt(Block, "consume", 500); wsys = api.ModLoader.GetModSystem <WeatherSystemBase>(); if (api.Side.IsServer()) { RegisterGameTickListener(OnCommonTick, 250); } }
public override void OnBlockRemoved() { base.OnBlockRemoved(); if (renderer != null) { renderer.Dispose(); renderer = null; } if (ambientSound != null) { ambientSound.Dispose(); } }