public override void OnBlockRemoved() { base.OnBlockRemoved(); renderer?.Dispose(); renderer = null; }
public override void Initialize(ICoreAPI api) { base.Initialize(api); this.ownBlock = Api.World.BlockAccessor.GetBlock(Pos) as BlockCompass; if (api.Side == EnumAppSide.Client) { renderer = new CompassNeedleRenderer(api as ICoreClientAPI, Pos, GenMesh("needle")); renderer.AngleRad = AngleRad; (api as ICoreClientAPI).Event.RegisterRenderer(renderer, EnumRenderStage.Opaque, "compass"); } }
public override void Initialize(ICoreAPI api) { base.Initialize(api); if (api.Side == EnumAppSide.Client) { renderer = new CompassNeedleRenderer(api as ICoreClientAPI, Pos, GenMesh("needle")); renderer.AngleRad = AngleRad; (api as ICoreClientAPI).Event.RegisterRenderer(renderer, EnumRenderStage.Opaque, "compass"); if (compassBaseMesh == null) { compassBaseMesh = GenMesh("base"); } } }