diff --git a/packages/protocol/src/protocol.ts b/packages/protocol/src/protocol.ts index 31e1ad2..7d45d23 100644 --- a/packages/protocol/src/protocol.ts +++ b/packages/protocol/src/protocol.ts @@ -113,11 +113,6 @@ export class Protocol { return off } - /** @deprecated Use `on` instead. */ - onReceive(handler: (event: BedrockReceiveEvent) => void, options?: { sourceType?: ScriptEventSource }): () => void { - return options ? this.on(handler, options) : this.on(handler) - } - dispose(): void { this.#subscriptions.clear() if (this.#listener) { diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts index 208ecc0..0f19e0e 100644 --- a/packages/runtime/src/index.ts +++ b/packages/runtime/src/index.ts @@ -12,5 +12,5 @@ export { Protocol } from '@mcbe-mods/protocol' export type { BedrockReceiveEvent, ProtocolCipher, ProtocolOptions } from '@mcbe-mods/protocol' export { RPC } from '@mcbe-mods/rpc' export type { RPCOptions } from '@mcbe-mods/rpc' -export { Base64, calcGameTicks, Color, color, Experience, getCubeRange, getRadiusRange, getRandomProbability, getRandomRangeValue, getSphereRange, ms2ticks, splitGroups, unique, utf8Decode, utf8Encode } from '@mcbe-mods/utils' +export { Base64, Color, Experience, getCubeRange, getRandomProbability, getRandomRangeValue, getSphereRange, ms2ticks, splitGroups, unique, utf8Decode, utf8Encode } from '@mcbe-mods/utils' export type { Location, StyleId, Stylizer } from '@mcbe-mods/utils' diff --git a/packages/utils/src/color.ts b/packages/utils/src/color.ts index ba3ad24..609c449 100644 --- a/packages/utils/src/color.ts +++ b/packages/utils/src/color.ts @@ -72,6 +72,3 @@ function createStylizer(extend: string[]): Stylizer { * ``` */ export const Color = /* #__PURE__ */ createStylizer([]) - -/** @deprecated Use `Color` instead. */ -export const color = Color diff --git a/packages/utils/src/getRadiusRange.ts b/packages/utils/src/getRadiusRange.ts deleted file mode 100644 index 180dbd7..0000000 --- a/packages/utils/src/getRadiusRange.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { getCubeRange } from './getCubeRange' - -/** @deprecated Use `getCubeRange` from `./getCubeRange` instead. */ -export const getRadiusRange = getCubeRange -export { getCubeRange, getSphereRange, type Location } from './getCubeRange' diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index fc2f6a7..f0db322 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,13 +1,12 @@ export { Base64 } from './base64' -export { Color, color } from './color' +export { Color } from './color' export type { StyleId, Stylizer } from './color' export { Experience } from './Experience' export { getCubeRange, getSphereRange } from './getCubeRange' export type { Location } from './getCubeRange' -export { getRadiusRange } from './getRadiusRange' export { getRandomProbability } from './getRandomProbability' export { getRandomRangeValue } from './getRandomRangeValue' -export { calcGameTicks, ms2ticks } from './ms2ticks' +export { ms2ticks } from './ms2ticks' export { splitGroups } from './splitGroups' export { utf8Decode, utf8Encode } from './textCodec' export { unique } from './unique' diff --git a/packages/utils/src/ms2ticks.ts b/packages/utils/src/ms2ticks.ts index dd1f0a0..ef286d5 100644 --- a/packages/utils/src/ms2ticks.ts +++ b/packages/utils/src/ms2ticks.ts @@ -13,6 +13,3 @@ export function ms2ticks(milliseconds: number = 1000, gameTicksPerSecond: number = 20, millisecondsPerSecond: number = 1000): number { return Math.floor(milliseconds * gameTicksPerSecond / millisecondsPerSecond) } - -/** @deprecated Use `ms2ticks` instead. */ -export const calcGameTicks = ms2ticks diff --git a/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.d.ts b/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.d.ts index 3d979e7..428ec8e 100644 --- a/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.d.ts +++ b/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.d.ts @@ -50,8 +50,5 @@ export declare function utf8Encode(_: string): Uint8Array; // #endregion // #region Variables -export declare const calcGameTicks: typeof ms2ticks; -export declare const color: Stylizer; export declare const Color: Stylizer; -export declare const getRadiusRange: typeof getCubeRange; // #endregion \ No newline at end of file diff --git a/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.js b/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.js index b56f1e7..129f29b 100644 --- a/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.js +++ b/packages/utils/test/__snapshots__/tsnapi/@mcbe-mods/utils/index.snapshot.js @@ -40,8 +40,5 @@ export function utf8Encode(_) {} // #endregion // #region Variables -export var calcGameTicks /* const */ -export var color /* const */ export var Color /* const */ -export var getRadiusRange /* const */ // #endregion \ No newline at end of file diff --git a/packages/utils/test/color.test.ts b/packages/utils/test/color.test.ts index c6b71f2..b73f4f3 100644 --- a/packages/utils/test/color.test.ts +++ b/packages/utils/test/color.test.ts @@ -1,32 +1,32 @@ import { describe, expect, it } from 'vitest' -import { color } from '../src/index' +import { Color } from '../src/index' -describe('color', () => { +describe('Color', () => { it('single color', () => { - expect(color.green('hello')).toBe('§ahello') + expect(Color.green('hello')).toBe('§ahello') }) it('color + style chaining', () => { - expect(color.green.italic.bold('hello')).toBe('§a§o§lhello') + expect(Color.green.italic.bold('hello')).toBe('§a§o§lhello') }) it('multiple arguments', () => { - expect(color.green('hello', ' world')).toBe('§ahello world') + expect(Color.green('hello', ' world')).toBe('§ahello world') }) it('with reset', () => { - expect(color.green.italic.bold('Dedicated Ser') + color.reset('ver') + color.red.obfuscated('!!!')) + expect(Color.green.italic.bold('Dedicated Ser') + Color.reset('ver') + Color.red.obfuscated('!!!')) .toBe('§a§o§lDedicated Ser§rver§c§k!!!') }) it('starts a new chain after calling', () => { - const red = color.red - const green = color.green + const red = Color.red + const green = Color.green expect(red('a')).toBe('§ca') expect(green('b')).toBe('§ab') }) it('unknown property access returns undefined', () => { - expect((color as any).unknown).toBeUndefined() + expect((Color as any).unknown).toBeUndefined() }) }) diff --git a/packages/utils/test/getRadiusRange.test.ts b/packages/utils/test/getRadiusRange.test.ts index 113ab39..dd106ee 100644 --- a/packages/utils/test/getRadiusRange.test.ts +++ b/packages/utils/test/getRadiusRange.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { getCubeRange, getRadiusRange, getSphereRange } from '../src/index' +import { getCubeRange, getSphereRange } from '../src/index' describe('getCubeRange', () => { it('radius 0 returns only center', () => { @@ -34,12 +34,6 @@ describe('getCubeRange', () => { const keys = positions.map(p => `${p.x},${p.y},${p.z}`) expect(new Set(keys).size).toBe(positions.length) }) - - it('getRadiusRange is a deprecated alias', () => { - expect(getRadiusRange).toBe(getCubeRange) - const result = getRadiusRange({ x: 1, y: 2, z: 3 }, 1) - expect(result).toHaveLength(27) - }) }) describe('getSphereRange', () => {