public override void Initialize(ICoreAPI api) { base.Initialize(api); ownBlock = api.World.BlockAccessor.GetBlock(pos); inventory.LateInitialize("quern-1", api); RegisterGameTickListener(Every100ms, 100); RegisterGameTickListener(Every500ms, 500); if (api is ICoreClientAPI) { renderer = new PestleRenderer(api as ICoreClientAPI, pos, GenMesh("top")); (api as ICoreClientAPI).Event.RegisterRenderer(renderer, EnumRenderStage.Opaque); if (quernBaseMesh == null) { quernBaseMesh = GenMesh("base"); } if (quernTopMesh == null) { quernTopMesh = GenMesh("top"); } } }
public override void OnBlockRemoved() { base.OnBlockRemoved(); if (renderer != null) { renderer.Unregister(); renderer = null; } }
public override void OnBlockRemoved() { base.OnBlockRemoved(); if (ambientSound != null) { ambientSound.Stop(); ambientSound.Dispose(); } if (renderer != null) { renderer.Unregister(); renderer = null; } }
public override void Initialize(ICoreAPI api) { base.Initialize(api); ownBlock = api.World.BlockAccessor.GetBlock(pos); inventory.LateInitialize("quern-1", api); RegisterGameTickListener(Every100ms, 100); RegisterGameTickListener(Every500ms, 500); if (ambientSound == null && api.Side == EnumAppSide.Client) { ambientSound = ((IClientWorldAccessor)api.World).LoadSound(new SoundParams() { Location = new AssetLocation("sounds/block/mortarandpestle.ogg"), ShouldLoop = true, Position = pos.ToVec3f().Add(0.5f, 0.25f, 0.5f), DisposeOnFinish = false, Volume = SoundLevel }); } if (api is ICoreClientAPI) { renderer = new PestleRenderer(api as ICoreClientAPI, pos, GenMesh("top")); (api as ICoreClientAPI).Event.RegisterRenderer(renderer, EnumRenderStage.Opaque); if (quernBaseMesh == null) { quernBaseMesh = GenMesh("base"); } if (quernTopMesh == null) { quernTopMesh = GenMesh("top"); } } }