public override void Initialize(ICoreAPI api) { base.Initialize(api); if (api.Side == EnumAppSide.Server) { ICoreServerAPI sapi = api as ICoreServerAPI; tpLocation = manager.GetOrCreateLocation(Pos); RegisterGameTickListener(OnServerGameTick, 50); } else { RegisterGameTickListener(OnClientGameTick, 50); teleportingSound = (api as ICoreClientAPI).World.LoadSound(new SoundParams() { Location = new AssetLocation("sounds/block/teleporter.ogg"), ShouldLoop = true, Position = Pos.ToVec3f(), RelativePosition = false, DisposeOnFinish = false, Volume = 0.5f }); } ownBlock = Block as BlockTeleporter; posvec = new Vec3d(Pos.X, Pos.Y + 1, Pos.Z); }
public override void Initialize(ICoreAPI api) { base.Initialize(api); manager = api.ModLoader.GetModSystem <TeleporterManager>(); if (api.Side == EnumAppSide.Server) { ICoreServerAPI sapi = api as ICoreServerAPI; tpLocation = manager.GetOrCreateLocation(pos); RegisterGameTickListener(OnServerGameTick, 50); } else { RegisterGameTickListener(OnClientGameTick, 50); } block = api.World.BlockAccessor.GetBlock(pos) as BlockTeleporter; posvec = new Vec3d(pos.X, pos.Y + 1, pos.Z); }