Skip to content

Commit

Permalink
Use ReleaseVersion.cmp as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico314159 committed May 19, 2024
1 parent c8363df commit 9c553dc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 28 additions & 21 deletions packages/java-edition/src/mcfunction/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as core from '@spyglassmc/core'
import { ReleaseVersion } from '../../dependency'

export const ColorArgumentValues = [...core.Color.ColorNames, 'reset']

Expand All @@ -11,27 +12,33 @@ export const GamemodeArgumentValues = [
'spectator',
]

export const ItemSlotArgumentValues = [
...[...Array(54).keys()].map((n) => `container.${n}`),
...[...Array(27).keys()].map((n) => `enderchest.${n}`),
...[...Array(15).keys()].map((n) => `horse.${n}`),
...[...Array(9).keys()].map((n) => `hotbar.${n}`),
...[...Array(27).keys()].map((n) => `inventory.${n}`),
...[...Array(4).keys()].map((n) => `player.crafting.${n}`),
...[...Array(8).keys()].map((n) => `villager.${n}`),
'armor.chest',
'armor.feet',
'armor.head',
'armor.legs',
'armor.body',
'contents',
'horse.chest',
'horse.saddle',
'player.cursor',
'weapon',
'weapon.mainhand',
'weapon.offhand',
]
export function getItemSlotArgumentValues(release: ReleaseVersion) {
const output = [
...[...Array(54).keys()].map((n) => `container.${n}`),
...[...Array(27).keys()].map((n) => `enderchest.${n}`),
...[...Array(15).keys()].map((n) => `horse.${n}`),
...[...Array(9).keys()].map((n) => `hotbar.${n}`),
...[...Array(27).keys()].map((n) => `inventory.${n}`),
...[...Array(8).keys()].map((n) => `villager.${n}`),
'armor.chest',
'armor.feet',
'armor.head',
'armor.legs',
'horse.chest',
'horse.saddle',
'weapon',
'weapon.mainhand',
'weapon.offhand',
]
if (ReleaseVersion.cmp(release, '1.20.5') >= 0) {
output.push(...[...Array(4).keys()].map((n) => `player.crafting.${n}`),
'armor.body',
'contents',
'player.cursor')
}
else { output.push('horse.armor') }
return output
}

export const OperationArgumentValues = [
'=',
Expand Down

0 comments on commit 9c553dc

Please sign in to comment.