diff --git a/package.json b/package.json index 2e30b8e..53d9265 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "node-stream-zip": "^1.15.0", "prettier": "^2.7.1", "prismarine-nbt": "^2.2.1", - "typescript": "^4.8.2" + "typescript": "^4.8.2", + "zod": "^3.22.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32c986b..adddaad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,6 +41,9 @@ dependencies: typescript: specifier: ^4.8.2 version: 4.8.2 + zod: + specifier: ^3.22.4 + version: 3.22.4 devDependencies: '@types/jest': @@ -3443,3 +3446,7 @@ packages: compress-commons: 4.1.2 readable-stream: 3.6.2 dev: false + + /zod@3.22.4: + resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} + dev: false diff --git a/src/common/ingredient.ts b/src/common/ingredient.ts index 27a7dd6..ec5060b 100644 --- a/src/common/ingredient.ts +++ b/src/common/ingredient.ts @@ -1,99 +1,90 @@ import { TagRegistry, TagRegistryHolder } from '../loader/tags' -import { createId, encodeId, Id, IdInput, NormalizedId, TagInput } from './id' +import { createId, encodeId, Id, NormalizedId } from './id' import { Logger } from '../logger' +import { resolveCommonTest } from './predicates' +import { Block, BlockSchema, Fluid, FluidSchema, Item, ItemSchema } from './result' +import zod from 'zod' +import { exists } from '@pssbletrngle/pack-resolver' +import { IllegalShapeError } from '../error' -type Item = Readonly<{ item: string }> -type ItemTag = Readonly<{ tag: string }> +export const ItemTagSchema = zod.object({ + tag: zod.string(), +}) -type Fluid = Readonly<{ fluid: string }> -type FluidTag = Readonly<{ fluidTag: string }> +export type ItemTag = zod.infer -export type Block = Readonly<{ - block: string - weight?: number -}> +export const FluidTagSchema = zod.object({ + fluidTag: zod.string(), +}) -export type BlockTag = Readonly<{ - blockTag: string - weight?: number -}> +export type FluidTag = zod.infer -export type Ingredient = ItemTag | Item | Fluid | FluidTag | Block | BlockTag +export const BlockTagSchema = zod.object({ + blockTag: zod.string(), + weight: zod.number().optional(), +}) + +export type BlockTag = zod.infer + +export type Ingredient = Item | ItemTag | Fluid | FluidTag | Block | BlockTag | IngredientInput[] export type IngredientInput = Ingredient | string export function createIngredient(input: IngredientInput): Ingredient { + if (!input) throw new IllegalShapeError('result input may not be null') + if (typeof input === 'string') { if (input.startsWith('#')) return { tag: input.substring(1) } else return { item: input } } - return input -} - -type ItemStack = Item & - Readonly<{ - count?: number - }> + if (Array.isArray(input)) { + return input.map(createIngredient) + } -type FluidStack = Fluid & - Readonly<{ - amount: number - }> + if (typeof input === 'object') { + if ('item' in input) return ItemSchema.parse(input) + if ('fluid' in input) return FluidSchema.parse(input) + if ('block' in input) return BlockSchema.parse(input) -export type Result = ItemStack | FluidStack | Block -export type ResultInput = Result | string + if ('tag' in input) return ItemTagSchema.parse(input) + if ('fluidTag' in input) return FluidTagSchema.parse(input) + if ('blockTag' in input) return BlockTagSchema.parse(input) + } -export function createResult(input: ResultInput): Result { - if (typeof input === 'string') return { item: input } - return input + throw new IllegalShapeError('unknown ingredient shape', input) } -export type Predicate = (value: T) => boolean +export type Predicate = (value: T, logger: Logger) => boolean export type CommonTest = RegExp | Predicate | T export type IngredientTest = CommonTest | NormalizedId -export function resolveCommonTest( - test: CommonTest>, - resolve: (value: TEntry) => NormalizedId, - tags?: TagRegistry -): Predicate { - if (typeof test === 'function') { - return it => test(resolve(it)) - } else if (test instanceof RegExp) { - return ingredient => { - return test.test(resolve(ingredient)) - } - } else if (test.startsWith('#')) { - return ingredient => { - const id = resolve(ingredient) - if (id.startsWith('#') && test === id) return true - else if (tags) return tags.contains(test as TagInput, id) ?? false - else throw new Error('Cannot parse ID test without tags') - } - } else { - return ingredient => { - return test === resolve(ingredient) - } - } -} - -export function resolveIDTest(test: CommonTest, tags?: TagRegistry): Predicate> { - return resolveCommonTest(test, it => encodeId(it), tags) -} - export function resolveIdIngredientTest( test: NormalizedId | RegExp, tags: TagRegistry, logger: Logger, idSupplier: (it: Ingredient) => Id | null ): Predicate { + function resolveIds(it: IngredientInput): Id[] { + if (Array.isArray(it)) { + return it.flatMap(resolveIds) + } else { + return [idSupplier(createIngredient(it))].filter(exists) + } + } + return resolveCommonTest( test, - ingredient => { - const id = idSupplier(createIngredient(ingredient)) - if (id) return encodeId(id) - logger.warn('unknown ingredient shape:', ingredient) - return '__ignored' as NormalizedId + input => { + try { + return resolveIds(input).map(encodeId) + } catch (error) { + if (error instanceof IllegalShapeError) { + logger.warn((error as Error).message) + return [] + } else { + throw error + } + } }, tags ) @@ -127,7 +118,7 @@ export function resolveIngredientTest( } if (typeof test === 'function') { - return it => test(createIngredient(it)) + return (it, logger) => test(createIngredient(it), logger) } if ('tag' in test) diff --git a/src/common/predicates.ts b/src/common/predicates.ts new file mode 100644 index 0000000..fd930b9 --- /dev/null +++ b/src/common/predicates.ts @@ -0,0 +1,33 @@ +import { encodeId, IdInput, NormalizedId, TagInput } from './id' +import { TagRegistry } from '../loader/tags' +import { CommonTest, Predicate } from './ingredient' + +export function resolveCommonTest( + test: CommonTest>, + resolve: (value: TEntry) => NormalizedId[], + tags?: TagRegistry +): Predicate { + if (typeof test === 'function') { + return it => resolve(it).some(test) + } else if (test instanceof RegExp) { + return ingredient => { + return resolve(ingredient).some(it => test.test(it)) + } + } else if (test.startsWith('#')) { + return ingredient => { + return resolve(ingredient).some(id => { + if (id.startsWith('#') && test === id) return true + else if (tags) return tags.contains(test as TagInput, id) ?? false + else throw new Error('Cannot parse ID test without tags') + }) + } + } else { + return ingredient => { + return resolve(ingredient).includes(test) + } + } +} + +export function resolveIDTest(test: CommonTest, tags?: TagRegistry): Predicate> { + return resolveCommonTest(test, it => [encodeId(it)], tags) +} diff --git a/src/common/result.ts b/src/common/result.ts new file mode 100644 index 0000000..f512210 --- /dev/null +++ b/src/common/result.ts @@ -0,0 +1,52 @@ +import zod from 'zod' +import { IllegalShapeError } from '../error' + +export const ItemSchema = zod.object({ + item: zod.string(), +}) + +export type Item = zod.infer + +export const FluidSchema = zod.object({ + fluid: zod.string(), +}) + +export type Fluid = zod.infer + +export const ItemStackSchema = ItemSchema.and( + zod.object({ + count: zod.number().optional(), + }) +) + +export type ItemStack = zod.infer + +export const FluidStackSchema = FluidSchema.and( + zod.object({ + amount: zod.number().optional(), + }) +) + +export type FluidStack = zod.infer + +export const BlockSchema = zod.object({ + block: zod.string(), + weight: zod.number().optional(), +}) + +export type Block = zod.infer + +export type Result = ItemStack | FluidStack | Block +export type ResultInput = Result | string + +export function createResult(input: ResultInput): Result { + if (!input) throw new IllegalShapeError('result input may not be null') + + if (typeof input === 'string') return { item: input } + + if ('item' in input) return ItemStackSchema.parse(input) + if ('fluid' in input) return FluidStackSchema.parse(input) + if ('block' in input) return BlockSchema.parse(input) + + throw new IllegalShapeError(`unknown result shape`, input) +} diff --git a/src/emit/recipe.ts b/src/emit/recipe.ts index b27db88..ec05e0e 100644 --- a/src/emit/recipe.ts +++ b/src/emit/recipe.ts @@ -7,17 +7,17 @@ import { IngredientInput, IngredientTest, Predicate, - resolveIDTest, resolveIngredientTest, - Result, } from '../common/ingredient' import RecipeRule from '../rule/recipe' import { Logger } from '../logger' import TagsLoader from '../loader/tags' -import { createId, Id, IdInput, NormalizedId } from '../common/id' +import { createId, encodeId, Id, IdInput, NormalizedId } from '../common/id' import { Recipe } from '../parser/recipe' import { RecipeDefinition } from '../schema/recipe' import Registry from '../common/registry' +import { resolveIDTest } from '../common/predicates' +import { Result } from '../common/result' type RecipeTest = Readonly<{ id?: CommonTest @@ -82,7 +82,13 @@ export default class RecipeEmitter implements RecipeRules { const path = this.recipePath(id) - const rules = this.rules.filter(it => it.matches(id, recipe)) + const rules = this.rules.filter(it => { + try { + return it.matches(id, recipe) + } catch (error) { + this.logger.error(`Could not parse recipe ${encodeId(id)}: ${error}`) + } + }) if (rules.length === 0) return const modified = rules.reduce((previous, rule) => previous && rule.modify(previous), recipe) diff --git a/src/emit/tags.ts b/src/emit/tags.ts index 3f2d660..cdaabfb 100644 --- a/src/emit/tags.ts +++ b/src/emit/tags.ts @@ -1,11 +1,12 @@ import { Acceptor } from '@pssbletrngle/pack-resolver' import { toJson } from '../textHelper' -import { CommonTest, resolveIDTest } from '../common/ingredient' +import { CommonTest } from '../common/ingredient' import { Logger } from '../logger' import TagsLoader, { entryId, orderTagEntries, TagRegistry } from '../loader/tags' import { TagDefinition, TagEntry } from '../schema/tag' import { createId, Id, NormalizedId, TagInput } from '../common/id' import Registry from '../common/registry' +import { resolveIDTest } from '../common/predicates' export interface TagRules { add(registry: string, id: `#${string}`, value: TagEntry): void diff --git a/src/error.ts b/src/error.ts new file mode 100644 index 0000000..63072ea --- /dev/null +++ b/src/error.ts @@ -0,0 +1,5 @@ +export class IllegalShapeError extends Error { + constructor(message: string, readonly input?: any) { + super(input ? `${message}: ${JSON.stringify(input)}` : message) + } +} diff --git a/src/logger.ts b/src/logger.ts index 52fbcb2..e3b4e71 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -10,18 +10,23 @@ type LogMethods = { } export type Logger = LogMethods & { - group(): Logger + group(prefix?: string): Logger } -export function wrapLogMethods(logMethods: LogMethods) { - return { ...logMethods, group: () => subLogger(logMethods) } +export function wrapLogMethods(logMethods: LogMethods): Logger { + return { ...logMethods, group: prefix => subLogger(logMethods, prefix) } } -function subLogger(logger: LogMethods): Logger { +function grouped(prefix: string | undefined, message: Logable) { + if (prefix) return `${prefix}: ${message}` + return ` ${message}` +} + +function subLogger(logger: LogMethods, prefix?: string): Logger { return wrapLogMethods({ - error: message => logger.error(` ${message}`), - warn: message => logger.warn(` ${message}`), - info: message => logger.info(` ${message}`), + error: (message, ...args) => logger.error(grouped(prefix, message), ...args), + warn: (message, ...args) => logger.warn(grouped(prefix, message), ...args), + info: (message, ...args) => logger.info(grouped(prefix, message), ...args), }) } diff --git a/src/parser/recipe/botania/apothecary.ts b/src/parser/recipe/botania/apothecary.ts index 98593de..d6d04a4 100644 --- a/src/parser/recipe/botania/apothecary.ts +++ b/src/parser/recipe/botania/apothecary.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type ApothecaryRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/brew.ts b/src/parser/recipe/botania/brew.ts index 540dcdc..f4196f0 100644 --- a/src/parser/recipe/botania/brew.ts +++ b/src/parser/recipe/botania/brew.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type BrewRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/elvenTrade.ts b/src/parser/recipe/botania/elvenTrade.ts index 5b5975d..1ca03c9 100644 --- a/src/parser/recipe/botania/elvenTrade.ts +++ b/src/parser/recipe/botania/elvenTrade.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type ElvenTradeRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/gogWrapper.ts b/src/parser/recipe/botania/gogWrapper.ts index 17b7645..7138f68 100644 --- a/src/parser/recipe/botania/gogWrapper.ts +++ b/src/parser/recipe/botania/gogWrapper.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import RecipeLoader from '../../../loader/recipe' +import { ResultInput } from '../../../common/result' export type GogWrapperRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/manaInfusion.ts b/src/parser/recipe/botania/manaInfusion.ts index 5e2f67f..76515d5 100644 --- a/src/parser/recipe/botania/manaInfusion.ts +++ b/src/parser/recipe/botania/manaInfusion.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { BlockInput, createBlockInput, fromBlockInput } from './orechid' +import { ResultInput } from '../../../common/result' export type ManaInfusionRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/nbtWrapper.ts b/src/parser/recipe/botania/nbtWrapper.ts index 955bc6c..db9af2a 100644 --- a/src/parser/recipe/botania/nbtWrapper.ts +++ b/src/parser/recipe/botania/nbtWrapper.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import RecipeLoader from '../../../loader/recipe' +import { ResultInput } from '../../../common/result' export type NbtWrapperRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/orechid.ts b/src/parser/recipe/botania/orechid.ts index a735bdc..a5fc79f 100644 --- a/src/parser/recipe/botania/orechid.ts +++ b/src/parser/recipe/botania/orechid.ts @@ -1,15 +1,9 @@ import RecipeParser, { Recipe } from '..' -import { - Block, - BlockTag, - createIngredient, - createResult, - IngredientInput, - Predicate, - ResultInput, -} from '../../../common/ingredient' +import { BlockTag, createIngredient, IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { encodeId } from '../../../common/id' +import { Block, createResult, ResultInput } from '../../../common/result' +import { IllegalShapeError } from '../../../error' export type BlockOutput = | string @@ -79,7 +73,7 @@ export function fromBlockInput(input: BlockInput): Block | BlockTag { weight: input.weight, } default: - throw new Error(`Unknown block input type ${(input as BlockInput).type}`) + throw new IllegalShapeError(`Unknown block input type`, input) } } diff --git a/src/parser/recipe/botania/pureDaisy.ts b/src/parser/recipe/botania/pureDaisy.ts index 72f9c76..6114208 100644 --- a/src/parser/recipe/botania/pureDaisy.ts +++ b/src/parser/recipe/botania/pureDaisy.ts @@ -1,5 +1,5 @@ import RecipeParser, { Recipe } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { BlockInput, @@ -9,6 +9,7 @@ import { fromBlockInput, fromBlockOutput, } from './orechid' +import { ResultInput } from '../../../common/result' export type PureDaisyRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/runicAltar.ts b/src/parser/recipe/botania/runicAltar.ts index de34e4c..6cd9971 100644 --- a/src/parser/recipe/botania/runicAltar.ts +++ b/src/parser/recipe/botania/runicAltar.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type RunicAltarRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/botania/terraPlate.ts b/src/parser/recipe/botania/terraPlate.ts index ca0d49b..edb6084 100644 --- a/src/parser/recipe/botania/terraPlate.ts +++ b/src/parser/recipe/botania/terraPlate.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type TerraPlateRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/create/assembly.ts b/src/parser/recipe/create/assembly.ts index b54798e..d9a2a01 100644 --- a/src/parser/recipe/create/assembly.ts +++ b/src/parser/recipe/create/assembly.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { ProcessingRecipe, ProcessingRecipeDefinition } from './processing' +import { ResultInput } from '../../../common/result' export type AssemblyRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/create/processing.ts b/src/parser/recipe/create/processing.ts index 6a45ec6..fcab664 100644 --- a/src/parser/recipe/create/processing.ts +++ b/src/parser/recipe/create/processing.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type ProcessingRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/farmersdelight/cooking.ts b/src/parser/recipe/farmersdelight/cooking.ts index 224073a..6934e0e 100644 --- a/src/parser/recipe/farmersdelight/cooking.ts +++ b/src/parser/recipe/farmersdelight/cooking.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { exists } from '@pssbletrngle/pack-resolver' +import { ResultInput } from '../../../common/result' export type CookingRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/farmersdelight/cutting.ts b/src/parser/recipe/farmersdelight/cutting.ts index c6e29cb..a1cd737 100644 --- a/src/parser/recipe/farmersdelight/cutting.ts +++ b/src/parser/recipe/farmersdelight/cutting.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type CuttingRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/index.ts b/src/parser/recipe/index.ts index 215f34f..238e004 100644 --- a/src/parser/recipe/index.ts +++ b/src/parser/recipe/index.ts @@ -1,5 +1,6 @@ -import { IngredientInput, Predicate, ResultInput } from '../../common/ingredient' +import { IngredientInput, Predicate } from '../../common/ingredient' import { RecipeDefinition } from '../../schema/recipe' +import { ResultInput } from '../../common/result' export function replace(from: Predicate, to: T) { return (it: T) => { diff --git a/src/parser/recipe/thermal/catalyst.ts b/src/parser/recipe/thermal/catalyst.ts index 1d666ba..f1098a2 100644 --- a/src/parser/recipe/thermal/catalyst.ts +++ b/src/parser/recipe/thermal/catalyst.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type ThermalCatalystRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/thermal/index.ts b/src/parser/recipe/thermal/index.ts index 2a3acd3..0f36e27 100644 --- a/src/parser/recipe/thermal/index.ts +++ b/src/parser/recipe/thermal/index.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { arrayOrSelf, exists } from '@pssbletrngle/pack-resolver' +import { ResultInput } from '../../../common/result' export type ThermalRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/vanilla/shaped.ts b/src/parser/recipe/vanilla/shaped.ts index 3230bbf..f2b931c 100644 --- a/src/parser/recipe/vanilla/shaped.ts +++ b/src/parser/recipe/vanilla/shaped.ts @@ -1,7 +1,8 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { mapValues } from 'lodash-es' +import { ResultInput } from '../../../common/result' export type ShapedRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/vanilla/shapeless.ts b/src/parser/recipe/vanilla/shapeless.ts index 33aa7cf..ed272b7 100644 --- a/src/parser/recipe/vanilla/shapeless.ts +++ b/src/parser/recipe/vanilla/shapeless.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type ShapelessRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/vanilla/smelting.ts b/src/parser/recipe/vanilla/smelting.ts index 52b38dd..d3e3574 100644 --- a/src/parser/recipe/vanilla/smelting.ts +++ b/src/parser/recipe/vanilla/smelting.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type SmeltingRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/vanilla/smithing.ts b/src/parser/recipe/vanilla/smithing.ts index 34bd141..a29ad41 100644 --- a/src/parser/recipe/vanilla/smithing.ts +++ b/src/parser/recipe/vanilla/smithing.ts @@ -1,6 +1,7 @@ import RecipeParser, { Recipe, replace } from '..' -import { IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' +import { ResultInput } from '../../../common/result' export type SmithingRecipeDefinition = RecipeDefinition & Readonly<{ diff --git a/src/parser/recipe/vanilla/stonecutting.ts b/src/parser/recipe/vanilla/stonecutting.ts index 2eca79e..5788df5 100644 --- a/src/parser/recipe/vanilla/stonecutting.ts +++ b/src/parser/recipe/vanilla/stonecutting.ts @@ -1,7 +1,9 @@ import RecipeParser, { Recipe } from '..' -import { createResult, IngredientInput, Predicate, ResultInput } from '../../../common/ingredient' +import { IngredientInput, Predicate } from '../../../common/ingredient' import { RecipeDefinition } from '../../../schema/recipe' import { encodeId } from '../../../common/id' +import { createResult, ResultInput } from '../../../common/result' +import { IllegalShapeError } from '../../../error' export type StonecuttingRecipeDefinition = RecipeDefinition & Readonly<{ @@ -28,7 +30,7 @@ class StonecuttingRecipe extends Recipe { replaceResult(from: Predicate, to: ResultInput): Recipe { const result = createResult(to) - if (!('item' in result)) throw new Error('stonecutting does only support item results') + if (!('item' in result)) throw new IllegalShapeError('stonecutting does only support item results', result) return new StonecuttingRecipe({ ...this.definition, diff --git a/src/rule/recipe/index.ts b/src/rule/recipe/index.ts index 1102a76..d417457 100644 --- a/src/rule/recipe/index.ts +++ b/src/rule/recipe/index.ts @@ -1,6 +1,6 @@ import { IngredientInput, Predicate } from '../../common/ingredient' import { Recipe } from '../../parser/recipe' -import { encodeId, Id } from '../../common/id' +import { Id } from '../../common/id' export type RecipeModifier = (recipe: Recipe) => Recipe | null @@ -13,16 +13,11 @@ export default class RecipeRule { ) {} matches(id: Id, recipe: Recipe): boolean { - try { - return ( - this.recipeTests.every(test => test(id)) && - this.ingredientTests.every(test => recipe.getIngredients().some(it => test(it))) && - this.resultTests.every(test => recipe.getResults().some(it => test(it))) - ) - } catch (error) { - console.error(error) - throw new Error(`unable to test recipe ${encodeId(id)}`, { cause: error }) - } + return ( + this.recipeTests.every(test => test(id)) && + this.ingredientTests.every(test => recipe.getIngredients().some(it => test(it))) && + this.resultTests.every(test => recipe.getResults().some(it => test(it))) + ) } modify(recipe: Recipe) { diff --git a/test/__snapshots__/recipeReplacer.test.ts.snap b/test/__snapshots__/recipeReplacer.test.ts.snap index 8562a0c..a4eeb68 100644 --- a/test/__snapshots__/recipeReplacer.test.ts.snap +++ b/test/__snapshots__/recipeReplacer.test.ts.snap @@ -163,167 +163,3 @@ exports[`replace ingredient replacement replaces ingredients with additional inp "type": "minecraft:crafting_shaped", } `; - -exports[`replaces ingredients 1`] = ` -{ - "key": { - "#": { - "item": "minecraft:cobblestone", - }, - "R": { - "item": "minecraft:emerald", - }, - "T": { - "tag": "minecraft:planks", - }, - "X": { - "item": "minecraft:iron_ingot", - }, - }, - "pattern": [ - "TTT", - "#X#", - "#R#", - ], - "result": { - "item": "minecraft:piston", - }, - "type": "minecraft:crafting_shaped", -} -`; - -exports[`replaces ingredients 2`] = ` -{ - "key": { - "#": { - "item": "minecraft:iron_ingot", - }, - "X": { - "item": "minecraft:emerald", - }, - }, - "pattern": [ - " # ", - "#X#", - " # ", - ], - "result": { - "item": "minecraft:compass", - }, - "type": "minecraft:crafting_shaped", -} -`; - -exports[`replaces ingredients in create recipes 1`] = ` -{ - "key": { - "C": { - "tag": "#forge:raw_materials/iron", - }, - }, - "pattern": [ - "CCC", - "CCC", - "CCC", - ], - "result": { - "item": "create:raw_zinc_block", - }, - "type": "minecraft:crafting_shaped", -} -`; - -exports[`replaces ingredients in create recipes 2`] = ` -{ - "ingredients": [ - { - "tag": "#forge:raw_materials/iron", - }, - ], - "processingTime": 400, - "results": [ - { - "item": "create:crushed_raw_zinc", - }, - { - "chance": 0.75, - "item": "create:experience_nugget", - }, - ], - "type": "create:crushing", -} -`; - -exports[`replaces ingredients in create recipes 3`] = ` -{ - "cookingtime": 100, - "experience": 0.7, - "ingredient": { - "tag": "#forge:raw_materials/iron", - }, - "result": "create:zinc_ingot", - "type": "minecraft:blasting", -} -`; - -exports[`replaces ingredients in create recipes 4`] = ` -{ - "cookingtime": 200, - "experience": 0.7, - "ingredient": { - "tag": "#forge:raw_materials/iron", - }, - "result": "create:zinc_ingot", - "type": "minecraft:smelting", -} -`; - -exports[`replaces ingredients with additional input filter 1`] = ` -{ - "key": { - "#": { - "item": "minecraft:cobblestone", - }, - "R": { - "item": "minecraft:emerald", - }, - "T": { - "tag": "minecraft:planks", - }, - "X": { - "item": "minecraft:iron_ingot", - }, - }, - "pattern": [ - "TTT", - "#X#", - "#R#", - ], - "result": { - "item": "minecraft:piston", - }, - "type": "minecraft:crafting_shaped", -} -`; - -exports[`replaces ingredients with additional input filter 2`] = ` -{ - "key": { - "#": { - "tag": "minecraft:planks", - }, - "X": { - "item": "minecraft:emerald", - }, - }, - "pattern": [ - "###", - "#X#", - "###", - ], - "result": { - "item": "minecraft:note_block", - }, - "type": "minecraft:crafting_shaped", -} -`; diff --git a/test/__snapshots__/tagReplacer.test.ts.snap b/test/__snapshots__/tagReplacer.test.ts.snap index 180bdea..b5f8a84 100644 --- a/test/__snapshots__/tagReplacer.test.ts.snap +++ b/test/__snapshots__/tagReplacer.test.ts.snap @@ -22,28 +22,6 @@ exports[`adding of tag entries adds tag entries to custom registries 1`] = ` } `; -exports[`adds tag entries 1`] = ` -{ - "replace": false, - "values": [ - { - "required": false, - "value": "create:brass_block", - }, - "minecraft:obsidian", - ], -} -`; - -exports[`adds tag entries to custom registries 1`] = ` -{ - "replace": false, - "values": [ - "example:entry", - ], -} -`; - exports[`removal of tag entries removes tag entries using id 1`] = ` { "replace": true, @@ -419,379 +397,3 @@ exports[`removal of tag entries removes tag entries using tag 2`] = ` "values": [], } `; - -exports[`removes tag entries using id 1`] = ` -{ - "replace": true, - "values": [ - "minecraft:oak_wood", - "minecraft:stripped_oak_log", - "minecraft:stripped_oak_wood", - ], -} -`; - -exports[`removes tag entries using predicate 1`] = ` -{ - "replace": true, - "values": [ - "minecraft:barrel", - "minecraft:black_shulker_box", - "minecraft:blue_shulker_box", - "minecraft:brown_shulker_box", - "minecraft:chest", - "minecraft:cyan_shulker_box", - "minecraft:ender_chest", - "minecraft:gilded_blackstone", - "minecraft:gray_shulker_box", - "minecraft:green_shulker_box", - "minecraft:light_blue_shulker_box", - "minecraft:light_gray_shulker_box", - "minecraft:lime_shulker_box", - "minecraft:magenta_shulker_box", - "minecraft:orange_shulker_box", - "minecraft:pink_shulker_box", - "minecraft:purple_shulker_box", - "minecraft:red_shulker_box", - "minecraft:shulker_box", - "minecraft:trapped_chest", - "minecraft:white_shulker_box", - "minecraft:yellow_shulker_box", - ], -} -`; - -exports[`removes tag entries using regex 1`] = ` -{ - "replace": true, - "values": [ - "minecraft:birch_log", - "minecraft:birch_wood", - ], -} -`; - -exports[`removes tag entries using tag 1`] = ` -{ - "replace": true, - "values": [ - "create:adjustable_chain_gearshift", - "create:analog_lever", - "create:andesite_casing", - "create:andesite_door", - "create:andesite_encased_cogwheel", - "create:andesite_encased_large_cogwheel", - "create:andesite_encased_shaft", - "create:belt", - "create:black_sail", - "create:black_seat", - "create:blue_sail", - "create:blue_seat", - "create:brass_casing", - "create:brass_door", - "create:brass_encased_cogwheel", - "create:brass_encased_large_cogwheel", - "create:brass_encased_shaft", - "create:brown_sail", - "create:brown_seat", - "create:cart_assembler", - "create:clipboard", - "create:clockwork_bearing", - "create:clutch", - "create:cogwheel", - "create:content_observer", - "create:contraption_controls", - "create:copper_casing", - "create:copper_door", - "create:copycat_panel", - "create:copycat_step", - "create:creative_crate", - "create:cuckoo_clock", - "create:cyan_sail", - "create:cyan_seat", - "create:deployer", - "create:depot", - "create:display_link", - "create:elevator_contact", - "create:elevator_pulley", - "create:encased_chain_drive", - "create:encased_fan", - "create:encased_fluid_pipe", - "create:flywheel", - "create:framed_glass_door", - "create:gantry_carriage", - "create:gantry_shaft", - "create:gearbox", - "create:gearshift", - "create:gray_sail", - "create:gray_seat", - "create:green_sail", - "create:green_seat", - "create:hand_crank", - "create:large_cogwheel", - "create:large_water_wheel", - "create:lectern_controller", - "create:light_blue_sail", - "create:light_blue_seat", - "create:light_gray_sail", - "create:light_gray_seat", - "create:lime_sail", - "create:lime_seat", - "create:linear_chassis", - "create:magenta_sail", - "create:magenta_seat", - "create:mechanical_arm", - "create:mechanical_bearing", - "create:mechanical_crafter", - "create:mechanical_drill", - "create:mechanical_harvester", - "create:mechanical_mixer", - "create:mechanical_piston", - "create:mechanical_piston_head", - "create:mechanical_plough", - "create:mechanical_press", - "create:mechanical_roller", - "create:mechanical_saw", - "create:mysterious_cuckoo_clock", - "create:nozzle", - "create:orange_sail", - "create:orange_seat", - "create:pink_sail", - "create:pink_seat", - "create:piston_extension_pole", - "create:portable_fluid_interface", - "create:portable_storage_interface", - "create:purple_sail", - "create:purple_seat", - "create:radial_chassis", - "create:railway_casing", - "create:red_sail", - "create:red_seat", - "create:redstone_contact", - "create:redstone_link", - "create:refined_radiance_casing", - "create:rope_pulley", - "create:rotation_speed_controller", - "create:sail_frame", - "create:schematic_table", - "create:secondary_linear_chassis", - "create:sequenced_gearshift", - "create:shadow_steel_casing", - "create:speedometer", - "create:sticky_mechanical_piston", - "create:stockpile_switch", - "create:stressometer", - "create:train_door", - "create:turntable", - "create:water_wheel", - "create:water_wheel_structure", - "create:weighted_ejector", - "create:white_sail", - "create:white_seat", - "create:windmill_bearing", - "create:wooden_bracket", - "create:yellow_sail", - "create:yellow_seat", - "minecraft:acacia_button", - "minecraft:acacia_door", - "minecraft:acacia_fence", - "minecraft:acacia_fence_gate", - "minecraft:acacia_planks", - "minecraft:acacia_pressure_plate", - "minecraft:acacia_sapling", - "minecraft:acacia_sign", - "minecraft:acacia_slab", - "minecraft:acacia_stairs", - "minecraft:acacia_trapdoor", - "minecraft:acacia_wall_sign", - "minecraft:attached_melon_stem", - "minecraft:attached_pumpkin_stem", - "minecraft:azalea", - "minecraft:bamboo", - "minecraft:barrel", - "minecraft:bee_nest", - "minecraft:beehive", - "minecraft:beetroots", - "minecraft:big_dripleaf", - "minecraft:big_dripleaf_stem", - "minecraft:birch_button", - "minecraft:birch_door", - "minecraft:birch_fence", - "minecraft:birch_fence_gate", - "minecraft:birch_planks", - "minecraft:birch_pressure_plate", - "minecraft:birch_sapling", - "minecraft:birch_sign", - "minecraft:birch_slab", - "minecraft:birch_stairs", - "minecraft:birch_trapdoor", - "minecraft:birch_wall_sign", - "minecraft:black_banner", - "minecraft:black_wall_banner", - "minecraft:blue_banner", - "minecraft:blue_wall_banner", - "minecraft:bookshelf", - "minecraft:brown_banner", - "minecraft:brown_mushroom", - "minecraft:brown_mushroom_block", - "minecraft:brown_wall_banner", - "minecraft:campfire", - "minecraft:carrots", - "minecraft:cartography_table", - "minecraft:carved_pumpkin", - "minecraft:cave_vines", - "minecraft:cave_vines_plant", - "minecraft:chest", - "minecraft:chorus_flower", - "minecraft:chorus_plant", - "minecraft:cocoa", - "minecraft:composter", - "minecraft:crafting_table", - "minecraft:crimson_button", - "minecraft:crimson_door", - "minecraft:crimson_fence", - "minecraft:crimson_fence_gate", - "minecraft:crimson_fungus", - "minecraft:crimson_planks", - "minecraft:crimson_pressure_plate", - "minecraft:crimson_sign", - "minecraft:crimson_slab", - "minecraft:crimson_stairs", - "minecraft:crimson_trapdoor", - "minecraft:crimson_wall_sign", - "minecraft:cyan_banner", - "minecraft:cyan_wall_banner", - "minecraft:dark_oak_button", - "minecraft:dark_oak_door", - "minecraft:dark_oak_fence", - "minecraft:dark_oak_fence_gate", - "minecraft:dark_oak_planks", - "minecraft:dark_oak_pressure_plate", - "minecraft:dark_oak_sapling", - "minecraft:dark_oak_sign", - "minecraft:dark_oak_slab", - "minecraft:dark_oak_stairs", - "minecraft:dark_oak_trapdoor", - "minecraft:dark_oak_wall_sign", - "minecraft:daylight_detector", - "minecraft:dead_bush", - "minecraft:fern", - "minecraft:fletching_table", - "minecraft:flowering_azalea", - "minecraft:glow_lichen", - "minecraft:grass", - "minecraft:gray_banner", - "minecraft:gray_wall_banner", - "minecraft:green_banner", - "minecraft:green_wall_banner", - "minecraft:hanging_roots", - "minecraft:jack_o_lantern", - "minecraft:jukebox", - "minecraft:jungle_button", - "minecraft:jungle_door", - "minecraft:jungle_fence", - "minecraft:jungle_fence_gate", - "minecraft:jungle_planks", - "minecraft:jungle_pressure_plate", - "minecraft:jungle_sapling", - "minecraft:jungle_sign", - "minecraft:jungle_slab", - "minecraft:jungle_stairs", - "minecraft:jungle_trapdoor", - "minecraft:jungle_wall_sign", - "minecraft:ladder", - "minecraft:large_fern", - "minecraft:lectern", - "minecraft:light_blue_banner", - "minecraft:light_blue_wall_banner", - "minecraft:light_gray_banner", - "minecraft:light_gray_wall_banner", - "minecraft:lily_pad", - "minecraft:lime_banner", - "minecraft:lime_wall_banner", - "minecraft:loom", - "minecraft:magenta_banner", - "minecraft:magenta_wall_banner", - "minecraft:melon", - "minecraft:melon_stem", - "minecraft:mushroom_stem", - "minecraft:nether_wart", - "minecraft:note_block", - "minecraft:oak_button", - "minecraft:oak_door", - "minecraft:oak_fence", - "minecraft:oak_fence_gate", - "minecraft:oak_planks", - "minecraft:oak_pressure_plate", - "minecraft:oak_sapling", - "minecraft:oak_sign", - "minecraft:oak_slab", - "minecraft:oak_stairs", - "minecraft:oak_trapdoor", - "minecraft:oak_wall_sign", - "minecraft:orange_banner", - "minecraft:orange_wall_banner", - "minecraft:pink_banner", - "minecraft:pink_wall_banner", - "minecraft:potatoes", - "minecraft:pumpkin", - "minecraft:pumpkin_stem", - "minecraft:purple_banner", - "minecraft:purple_wall_banner", - "minecraft:red_banner", - "minecraft:red_mushroom", - "minecraft:red_mushroom_block", - "minecraft:red_wall_banner", - "minecraft:scaffolding", - "minecraft:small_dripleaf", - "minecraft:smithing_table", - "minecraft:soul_campfire", - "minecraft:spore_blossom", - "minecraft:spruce_button", - "minecraft:spruce_door", - "minecraft:spruce_fence", - "minecraft:spruce_fence_gate", - "minecraft:spruce_planks", - "minecraft:spruce_pressure_plate", - "minecraft:spruce_sapling", - "minecraft:spruce_sign", - "minecraft:spruce_slab", - "minecraft:spruce_stairs", - "minecraft:spruce_trapdoor", - "minecraft:spruce_wall_sign", - "minecraft:sugar_cane", - "minecraft:sweet_berry_bush", - "minecraft:tall_grass", - "minecraft:trapped_chest", - "minecraft:twisting_vines", - "minecraft:twisting_vines_plant", - "minecraft:vine", - "minecraft:warped_button", - "minecraft:warped_door", - "minecraft:warped_fence", - "minecraft:warped_fence_gate", - "minecraft:warped_fungus", - "minecraft:warped_planks", - "minecraft:warped_pressure_plate", - "minecraft:warped_sign", - "minecraft:warped_slab", - "minecraft:warped_stairs", - "minecraft:warped_trapdoor", - "minecraft:warped_wall_sign", - "minecraft:weeping_vines", - "minecraft:weeping_vines_plant", - "minecraft:wheat", - "minecraft:white_banner", - "minecraft:white_wall_banner", - "minecraft:yellow_banner", - "minecraft:yellow_wall_banner", - ], -} -`; - -exports[`removes tag entries using tag 2`] = ` -{ - "replace": true, - "values": [], -} -`; diff --git a/test/__snapshots__/tagsLoader.test.ts.snap b/test/__snapshots__/tagsLoader.test.ts.snap index 3cba657..a85b79b 100644 --- a/test/__snapshots__/tagsLoader.test.ts.snap +++ b/test/__snapshots__/tagsLoader.test.ts.snap @@ -1197,1201 +1197,3 @@ exports[`loading of tags resolves tags correctly 2`] = ` "minecraft:iron_trapdoor", ] `; - -exports[`loads tags correctly 1`] = ` -[ - "#minecraft:anvil", - "#minecraft:cauldrons", - "#minecraft:rails", - "#minecraft:shulker_boxes", - "#minecraft:walls", - "create:adjustable_chain_gearshift", - "create:analog_lever", - "create:andesite_alloy_block", - "create:andesite_bars", - "create:andesite_belt_funnel", - "create:andesite_casing", - "create:andesite_door", - "create:andesite_encased_cogwheel", - "create:andesite_encased_large_cogwheel", - "create:andesite_encased_shaft", - "create:andesite_funnel", - "create:andesite_ladder", - "create:andesite_pillar", - "create:andesite_scaffolding", - "create:andesite_tunnel", - "create:asurine", - "create:asurine_pillar", - "create:basin", - "create:belt", - "create:black_nixie_tube", - "create:black_valve_handle", - "create:blaze_burner", - "create:blue_nixie_tube", - "create:blue_valve_handle", - "create:brass_bars", - "create:brass_belt_funnel", - "create:brass_block", - "create:brass_casing", - "create:brass_door", - "create:brass_encased_cogwheel", - "create:brass_encased_large_cogwheel", - "create:brass_encased_shaft", - "create:brass_funnel", - "create:brass_ladder", - "create:brass_scaffolding", - "create:brass_tunnel", - "create:brown_nixie_tube", - "create:brown_valve_handle", - "create:calcite_pillar", - "create:cart_assembler", - "create:chute", - "create:clipboard", - "create:clockwork_bearing", - "create:clutch", - "create:cogwheel", - "create:content_observer", - "create:contraption_controls", - "create:controller_rail", - "create:controls", - "create:copper_backtank", - "create:copper_bars", - "create:copper_casing", - "create:copper_door", - "create:copper_ladder", - "create:copper_scaffolding", - "create:copper_shingle_slab", - "create:copper_shingle_stairs", - "create:copper_shingles", - "create:copper_tile_slab", - "create:copper_tile_stairs", - "create:copper_tiles", - "create:copper_valve_handle", - "create:copycat_base", - "create:copycat_panel", - "create:copycat_step", - "create:creative_crate", - "create:creative_fluid_tank", - "create:creative_motor", - "create:crimsite", - "create:crimsite_pillar", - "create:crushing_wheel", - "create:cuckoo_clock", - "create:cut_andesite", - "create:cut_andesite_brick_slab", - "create:cut_andesite_brick_stairs", - "create:cut_andesite_brick_wall", - "create:cut_andesite_bricks", - "create:cut_andesite_slab", - "create:cut_andesite_stairs", - "create:cut_andesite_wall", - "create:cut_asurine", - "create:cut_asurine_brick_slab", - "create:cut_asurine_brick_stairs", - "create:cut_asurine_brick_wall", - "create:cut_asurine_bricks", - "create:cut_asurine_slab", - "create:cut_asurine_stairs", - "create:cut_asurine_wall", - "create:cut_calcite", - "create:cut_calcite_brick_slab", - "create:cut_calcite_brick_stairs", - "create:cut_calcite_brick_wall", - "create:cut_calcite_bricks", - "create:cut_calcite_slab", - "create:cut_calcite_stairs", - "create:cut_calcite_wall", - "create:cut_crimsite", - "create:cut_crimsite_brick_slab", - "create:cut_crimsite_brick_stairs", - "create:cut_crimsite_brick_wall", - "create:cut_crimsite_bricks", - "create:cut_crimsite_slab", - "create:cut_crimsite_stairs", - "create:cut_crimsite_wall", - "create:cut_deepslate", - "create:cut_deepslate_brick_slab", - "create:cut_deepslate_brick_stairs", - "create:cut_deepslate_brick_wall", - "create:cut_deepslate_bricks", - "create:cut_deepslate_slab", - "create:cut_deepslate_stairs", - "create:cut_deepslate_wall", - "create:cut_diorite", - "create:cut_diorite_brick_slab", - "create:cut_diorite_brick_stairs", - "create:cut_diorite_brick_wall", - "create:cut_diorite_bricks", - "create:cut_diorite_slab", - "create:cut_diorite_stairs", - "create:cut_diorite_wall", - "create:cut_dripstone", - "create:cut_dripstone_brick_slab", - "create:cut_dripstone_brick_stairs", - "create:cut_dripstone_brick_wall", - "create:cut_dripstone_bricks", - "create:cut_dripstone_slab", - "create:cut_dripstone_stairs", - "create:cut_dripstone_wall", - "create:cut_granite", - "create:cut_granite_brick_slab", - "create:cut_granite_brick_stairs", - "create:cut_granite_brick_wall", - "create:cut_granite_bricks", - "create:cut_granite_slab", - "create:cut_granite_stairs", - "create:cut_granite_wall", - "create:cut_limestone", - "create:cut_limestone_brick_slab", - "create:cut_limestone_brick_stairs", - "create:cut_limestone_brick_wall", - "create:cut_limestone_bricks", - "create:cut_limestone_slab", - "create:cut_limestone_stairs", - "create:cut_limestone_wall", - "create:cut_ochrum", - "create:cut_ochrum_brick_slab", - "create:cut_ochrum_brick_stairs", - "create:cut_ochrum_brick_wall", - "create:cut_ochrum_bricks", - "create:cut_ochrum_slab", - "create:cut_ochrum_stairs", - "create:cut_ochrum_wall", - "create:cut_scorchia", - "create:cut_scorchia_brick_slab", - "create:cut_scorchia_brick_stairs", - "create:cut_scorchia_brick_wall", - "create:cut_scorchia_bricks", - "create:cut_scorchia_slab", - "create:cut_scorchia_stairs", - "create:cut_scorchia_wall", - "create:cut_scoria", - "create:cut_scoria_brick_slab", - "create:cut_scoria_brick_stairs", - "create:cut_scoria_brick_wall", - "create:cut_scoria_bricks", - "create:cut_scoria_slab", - "create:cut_scoria_stairs", - "create:cut_scoria_wall", - "create:cut_tuff", - "create:cut_tuff_brick_slab", - "create:cut_tuff_brick_stairs", - "create:cut_tuff_brick_wall", - "create:cut_tuff_bricks", - "create:cut_tuff_slab", - "create:cut_tuff_stairs", - "create:cut_tuff_wall", - "create:cut_veridium", - "create:cut_veridium_brick_slab", - "create:cut_veridium_brick_stairs", - "create:cut_veridium_brick_wall", - "create:cut_veridium_bricks", - "create:cut_veridium_slab", - "create:cut_veridium_stairs", - "create:cut_veridium_wall", - "create:cyan_nixie_tube", - "create:cyan_valve_handle", - "create:deepslate_pillar", - "create:deepslate_zinc_ore", - "create:deployer", - "create:depot", - "create:diorite_pillar", - "create:display_board", - "create:display_link", - "create:dripstone_pillar", - "create:elevator_contact", - "create:elevator_pulley", - "create:encased_chain_drive", - "create:encased_fan", - "create:encased_fluid_pipe", - "create:experience_block", - "create:exposed_copper_shingle_slab", - "create:exposed_copper_shingle_stairs", - "create:exposed_copper_shingles", - "create:exposed_copper_tile_slab", - "create:exposed_copper_tile_stairs", - "create:exposed_copper_tiles", - "create:fluid_pipe", - "create:fluid_tank", - "create:fluid_valve", - "create:flywheel", - "create:framed_glass_door", - "create:framed_glass_trapdoor", - "create:gantry_carriage", - "create:gantry_shaft", - "create:gearbox", - "create:gearshift", - "create:glass_fluid_pipe", - "create:granite_pillar", - "create:gray_nixie_tube", - "create:gray_valve_handle", - "create:green_nixie_tube", - "create:green_valve_handle", - "create:hand_crank", - "create:haunted_bell", - "create:hose_pulley", - "create:industrial_iron_block", - "create:item_drain", - "create:item_vault", - "create:large_bogey", - "create:large_cogwheel", - "create:large_water_wheel", - "create:layered_andesite", - "create:layered_asurine", - "create:layered_calcite", - "create:layered_crimsite", - "create:layered_deepslate", - "create:layered_diorite", - "create:layered_dripstone", - "create:layered_granite", - "create:layered_limestone", - "create:layered_ochrum", - "create:layered_scorchia", - "create:layered_scoria", - "create:layered_tuff", - "create:layered_veridium", - "create:light_blue_nixie_tube", - "create:light_blue_valve_handle", - "create:light_gray_nixie_tube", - "create:light_gray_valve_handle", - "create:lime_nixie_tube", - "create:lime_valve_handle", - "create:limestone", - "create:limestone_pillar", - "create:linear_chassis", - "create:lit_blaze_burner", - "create:magenta_nixie_tube", - "create:magenta_valve_handle", - "create:mechanical_arm", - "create:mechanical_bearing", - "create:mechanical_crafter", - "create:mechanical_drill", - "create:mechanical_harvester", - "create:mechanical_mixer", - "create:mechanical_piston", - "create:mechanical_piston_head", - "create:mechanical_plough", - "create:mechanical_press", - "create:mechanical_pump", - "create:mechanical_roller", - "create:mechanical_saw", - "create:metal_bracket", - "create:metal_girder", - "create:metal_girder_encased_shaft", - "create:millstone", - "create:mysterious_cuckoo_clock", - "create:netherite_backtank", - "create:nixie_tube", - "create:nozzle", - "create:ochrum", - "create:ochrum_pillar", - "create:orange_valve_handle", - "create:oxidized_copper_shingle_slab", - "create:oxidized_copper_shingle_stairs", - "create:oxidized_copper_shingles", - "create:oxidized_copper_tile_slab", - "create:oxidized_copper_tile_stairs", - "create:oxidized_copper_tiles", - "create:peculiar_bell", - "create:pink_nixie_tube", - "create:pink_valve_handle", - "create:piston_extension_pole", - "create:placard", - "create:polished_cut_andesite", - "create:polished_cut_andesite_slab", - "create:polished_cut_andesite_stairs", - "create:polished_cut_andesite_wall", - "create:polished_cut_asurine", - "create:polished_cut_asurine_slab", - "create:polished_cut_asurine_stairs", - "create:polished_cut_asurine_wall", - "create:polished_cut_calcite", - "create:polished_cut_calcite_slab", - "create:polished_cut_calcite_stairs", - "create:polished_cut_calcite_wall", - "create:polished_cut_crimsite", - "create:polished_cut_crimsite_slab", - "create:polished_cut_crimsite_stairs", - "create:polished_cut_crimsite_wall", - "create:polished_cut_deepslate", - "create:polished_cut_deepslate_slab", - "create:polished_cut_deepslate_stairs", - "create:polished_cut_deepslate_wall", - "create:polished_cut_diorite", - "create:polished_cut_diorite_slab", - "create:polished_cut_diorite_stairs", - "create:polished_cut_diorite_wall", - "create:polished_cut_dripstone", - "create:polished_cut_dripstone_slab", - "create:polished_cut_dripstone_stairs", - "create:polished_cut_dripstone_wall", - "create:polished_cut_granite", - "create:polished_cut_granite_slab", - "create:polished_cut_granite_stairs", - "create:polished_cut_granite_wall", - "create:polished_cut_limestone", - "create:polished_cut_limestone_slab", - "create:polished_cut_limestone_stairs", - "create:polished_cut_limestone_wall", - "create:polished_cut_ochrum", - "create:polished_cut_ochrum_slab", - "create:polished_cut_ochrum_stairs", - "create:polished_cut_ochrum_wall", - "create:polished_cut_scorchia", - "create:polished_cut_scorchia_slab", - "create:polished_cut_scorchia_stairs", - "create:polished_cut_scorchia_wall", - "create:polished_cut_scoria", - "create:polished_cut_scoria_slab", - "create:polished_cut_scoria_stairs", - "create:polished_cut_scoria_wall", - "create:polished_cut_tuff", - "create:polished_cut_tuff_slab", - "create:polished_cut_tuff_stairs", - "create:polished_cut_tuff_wall", - "create:polished_cut_veridium", - "create:polished_cut_veridium_slab", - "create:polished_cut_veridium_stairs", - "create:polished_cut_veridium_wall", - "create:portable_fluid_interface", - "create:portable_storage_interface", - "create:powered_shaft", - "create:purple_nixie_tube", - "create:purple_valve_handle", - "create:radial_chassis", - "create:railway_casing", - "create:raw_zinc_block", - "create:red_nixie_tube", - "create:red_valve_handle", - "create:redstone_contact", - "create:redstone_link", - "create:refined_radiance_casing", - "create:rope_pulley", - "create:rose_quartz_block", - "create:rose_quartz_lamp", - "create:rose_quartz_tiles", - "create:rotation_speed_controller", - "create:schematic_table", - "create:schematicannon", - "create:scorchia", - "create:scorchia_pillar", - "create:scoria", - "create:scoria_pillar", - "create:secondary_linear_chassis", - "create:sequenced_gearshift", - "create:shadow_steel_casing", - "create:shaft", - "create:small_andesite_brick_slab", - "create:small_andesite_brick_stairs", - "create:small_andesite_brick_wall", - "create:small_andesite_bricks", - "create:small_asurine_brick_slab", - "create:small_asurine_brick_stairs", - "create:small_asurine_brick_wall", - "create:small_asurine_bricks", - "create:small_bogey", - "create:small_calcite_brick_slab", - "create:small_calcite_brick_stairs", - "create:small_calcite_brick_wall", - "create:small_calcite_bricks", - "create:small_crimsite_brick_slab", - "create:small_crimsite_brick_stairs", - "create:small_crimsite_brick_wall", - "create:small_crimsite_bricks", - "create:small_deepslate_brick_slab", - "create:small_deepslate_brick_stairs", - "create:small_deepslate_brick_wall", - "create:small_deepslate_bricks", - "create:small_diorite_brick_slab", - "create:small_diorite_brick_stairs", - "create:small_diorite_brick_wall", - "create:small_diorite_bricks", - "create:small_dripstone_brick_slab", - "create:small_dripstone_brick_stairs", - "create:small_dripstone_brick_wall", - "create:small_dripstone_bricks", - "create:small_granite_brick_slab", - "create:small_granite_brick_stairs", - "create:small_granite_brick_wall", - "create:small_granite_bricks", - "create:small_limestone_brick_slab", - "create:small_limestone_brick_stairs", - "create:small_limestone_brick_wall", - "create:small_limestone_bricks", - "create:small_ochrum_brick_slab", - "create:small_ochrum_brick_stairs", - "create:small_ochrum_brick_wall", - "create:small_ochrum_bricks", - "create:small_rose_quartz_tiles", - "create:small_scorchia_brick_slab", - "create:small_scorchia_brick_stairs", - "create:small_scorchia_brick_wall", - "create:small_scorchia_bricks", - "create:small_scoria_brick_slab", - "create:small_scoria_brick_stairs", - "create:small_scoria_brick_wall", - "create:small_scoria_bricks", - "create:small_tuff_brick_slab", - "create:small_tuff_brick_stairs", - "create:small_tuff_brick_wall", - "create:small_tuff_bricks", - "create:small_veridium_brick_slab", - "create:small_veridium_brick_stairs", - "create:small_veridium_brick_wall", - "create:small_veridium_bricks", - "create:smart_chute", - "create:smart_fluid_pipe", - "create:speedometer", - "create:spout", - "create:steam_engine", - "create:steam_whistle", - "create:steam_whistle_extension", - "create:sticker", - "create:sticky_mechanical_piston", - "create:stockpile_switch", - "create:stressometer", - "create:track", - "create:track_observer", - "create:track_signal", - "create:track_station", - "create:train_door", - "create:train_trapdoor", - "create:tuff_pillar", - "create:turntable", - "create:veridium", - "create:veridium_pillar", - "create:water_wheel", - "create:water_wheel_structure", - "create:waxed_copper_shingle_slab", - "create:waxed_copper_shingle_stairs", - "create:waxed_copper_shingles", - "create:waxed_copper_tile_slab", - "create:waxed_copper_tile_stairs", - "create:waxed_copper_tiles", - "create:waxed_exposed_copper_shingle_slab", - "create:waxed_exposed_copper_shingle_stairs", - "create:waxed_exposed_copper_shingles", - "create:waxed_exposed_copper_tile_slab", - "create:waxed_exposed_copper_tile_stairs", - "create:waxed_exposed_copper_tiles", - "create:waxed_oxidized_copper_shingle_slab", - "create:waxed_oxidized_copper_shingle_stairs", - "create:waxed_oxidized_copper_shingles", - "create:waxed_oxidized_copper_tile_slab", - "create:waxed_oxidized_copper_tile_stairs", - "create:waxed_oxidized_copper_tiles", - "create:waxed_weathered_copper_shingle_slab", - "create:waxed_weathered_copper_shingle_stairs", - "create:waxed_weathered_copper_shingles", - "create:waxed_weathered_copper_tile_slab", - "create:waxed_weathered_copper_tile_stairs", - "create:waxed_weathered_copper_tiles", - "create:weathered_copper_shingle_slab", - "create:weathered_copper_shingle_stairs", - "create:weathered_copper_shingles", - "create:weathered_copper_tile_slab", - "create:weathered_copper_tile_stairs", - "create:weathered_copper_tiles", - "create:weighted_ejector", - "create:white_nixie_tube", - "create:white_valve_handle", - "create:windmill_bearing", - "create:wooden_bracket", - "create:yellow_nixie_tube", - "create:yellow_valve_handle", - "create:zinc_block", - "create:zinc_ore", - "minecraft:amethyst_block", - "minecraft:amethyst_cluster", - "minecraft:ancient_debris", - "minecraft:andesite", - "minecraft:andesite_slab", - "minecraft:andesite_stairs", - "minecraft:basalt", - "minecraft:bell", - "minecraft:black_concrete", - "minecraft:black_glazed_terracotta", - "minecraft:black_terracotta", - "minecraft:blackstone", - "minecraft:blackstone_slab", - "minecraft:blackstone_stairs", - "minecraft:blast_furnace", - "minecraft:blue_concrete", - "minecraft:blue_glazed_terracotta", - "minecraft:blue_ice", - "minecraft:blue_terracotta", - "minecraft:bone_block", - "minecraft:brain_coral_block", - "minecraft:brewing_stand", - "minecraft:brick_slab", - "minecraft:brick_stairs", - "minecraft:bricks", - "minecraft:brown_concrete", - "minecraft:brown_glazed_terracotta", - "minecraft:brown_terracotta", - "minecraft:bubble_coral_block", - "minecraft:budding_amethyst", - "minecraft:calcite", - "minecraft:chain", - "minecraft:chiseled_deepslate", - "minecraft:chiseled_nether_bricks", - "minecraft:chiseled_polished_blackstone", - "minecraft:chiseled_quartz_block", - "minecraft:chiseled_red_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:chiseled_stone_bricks", - "minecraft:coal_block", - "minecraft:coal_ore", - "minecraft:cobbled_deepslate", - "minecraft:cobbled_deepslate_slab", - "minecraft:cobbled_deepslate_stairs", - "minecraft:cobblestone", - "minecraft:cobblestone_slab", - "minecraft:cobblestone_stairs", - "minecraft:conduit", - "minecraft:copper_block", - "minecraft:copper_ore", - "minecraft:cracked_deepslate_bricks", - "minecraft:cracked_deepslate_tiles", - "minecraft:cracked_nether_bricks", - "minecraft:cracked_polished_blackstone_bricks", - "minecraft:cracked_stone_bricks", - "minecraft:crimson_nylium", - "minecraft:crying_obsidian", - "minecraft:cut_copper", - "minecraft:cut_copper_slab", - "minecraft:cut_copper_stairs", - "minecraft:cut_red_sandstone", - "minecraft:cut_red_sandstone_slab", - "minecraft:cut_sandstone", - "minecraft:cut_sandstone_slab", - "minecraft:cyan_concrete", - "minecraft:cyan_glazed_terracotta", - "minecraft:cyan_terracotta", - "minecraft:dark_prismarine", - "minecraft:dark_prismarine_slab", - "minecraft:dark_prismarine_stairs", - "minecraft:dead_brain_coral", - "minecraft:dead_brain_coral_block", - "minecraft:dead_brain_coral_fan", - "minecraft:dead_brain_coral_wall_fan", - "minecraft:dead_bubble_coral", - "minecraft:dead_bubble_coral_block", - "minecraft:dead_bubble_coral_fan", - "minecraft:dead_bubble_coral_wall_fan", - "minecraft:dead_fire_coral", - "minecraft:dead_fire_coral_block", - "minecraft:dead_fire_coral_fan", - "minecraft:dead_fire_coral_wall_fan", - "minecraft:dead_horn_coral", - "minecraft:dead_horn_coral_block", - "minecraft:dead_horn_coral_fan", - "minecraft:dead_horn_coral_wall_fan", - "minecraft:dead_tube_coral", - "minecraft:dead_tube_coral_block", - "minecraft:dead_tube_coral_fan", - "minecraft:dead_tube_coral_wall_fan", - "minecraft:deepslate", - "minecraft:deepslate_brick_slab", - "minecraft:deepslate_brick_stairs", - "minecraft:deepslate_bricks", - "minecraft:deepslate_coal_ore", - "minecraft:deepslate_copper_ore", - "minecraft:deepslate_diamond_ore", - "minecraft:deepslate_emerald_ore", - "minecraft:deepslate_gold_ore", - "minecraft:deepslate_iron_ore", - "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore", - "minecraft:deepslate_tile_slab", - "minecraft:deepslate_tile_stairs", - "minecraft:deepslate_tiles", - "minecraft:diamond_block", - "minecraft:diamond_ore", - "minecraft:diorite", - "minecraft:diorite_slab", - "minecraft:diorite_stairs", - "minecraft:dispenser", - "minecraft:dripstone_block", - "minecraft:dropper", - "minecraft:emerald_block", - "minecraft:emerald_ore", - "minecraft:enchanting_table", - "minecraft:end_stone", - "minecraft:end_stone_brick_slab", - "minecraft:end_stone_brick_stairs", - "minecraft:end_stone_bricks", - "minecraft:ender_chest", - "minecraft:exposed_copper", - "minecraft:exposed_cut_copper", - "minecraft:exposed_cut_copper_slab", - "minecraft:exposed_cut_copper_stairs", - "minecraft:fire_coral_block", - "minecraft:furnace", - "minecraft:gilded_blackstone", - "minecraft:gold_block", - "minecraft:gold_ore", - "minecraft:granite", - "minecraft:granite_slab", - "minecraft:granite_stairs", - "minecraft:gray_concrete", - "minecraft:gray_glazed_terracotta", - "minecraft:gray_terracotta", - "minecraft:green_concrete", - "minecraft:green_glazed_terracotta", - "minecraft:green_terracotta", - "minecraft:grindstone", - "minecraft:heavy_weighted_pressure_plate", - "minecraft:hopper", - "minecraft:horn_coral_block", - "minecraft:ice", - "minecraft:infested_chiseled_stone_bricks", - "minecraft:infested_cobblestone", - "minecraft:infested_cracked_stone_bricks", - "minecraft:infested_deepslate", - "minecraft:infested_mossy_stone_bricks", - "minecraft:infested_stone", - "minecraft:infested_stone_bricks", - "minecraft:iron_bars", - "minecraft:iron_block", - "minecraft:iron_door", - "minecraft:iron_ore", - "minecraft:iron_trapdoor", - "minecraft:lantern", - "minecraft:lapis_block", - "minecraft:lapis_ore", - "minecraft:large_amethyst_bud", - "minecraft:light_blue_concrete", - "minecraft:light_blue_glazed_terracotta", - "minecraft:light_blue_terracotta", - "minecraft:light_gray_concrete", - "minecraft:light_gray_glazed_terracotta", - "minecraft:light_gray_terracotta", - "minecraft:light_weighted_pressure_plate", - "minecraft:lightning_rod", - "minecraft:lime_concrete", - "minecraft:lime_glazed_terracotta", - "minecraft:lime_terracotta", - "minecraft:lodestone", - "minecraft:magenta_concrete", - "minecraft:magenta_glazed_terracotta", - "minecraft:magenta_terracotta", - "minecraft:magma_block", - "minecraft:medium_amethyst_bud", - "minecraft:mossy_cobblestone", - "minecraft:mossy_cobblestone_slab", - "minecraft:mossy_cobblestone_stairs", - "minecraft:mossy_stone_brick_slab", - "minecraft:mossy_stone_brick_stairs", - "minecraft:mossy_stone_bricks", - "minecraft:nether_brick_fence", - "minecraft:nether_brick_slab", - "minecraft:nether_brick_stairs", - "minecraft:nether_bricks", - "minecraft:nether_gold_ore", - "minecraft:nether_quartz_ore", - "minecraft:netherite_block", - "minecraft:netherrack", - "minecraft:observer", - "minecraft:obsidian", - "minecraft:orange_concrete", - "minecraft:orange_glazed_terracotta", - "minecraft:orange_terracotta", - "minecraft:oxidized_copper", - "minecraft:oxidized_cut_copper", - "minecraft:oxidized_cut_copper_slab", - "minecraft:oxidized_cut_copper_stairs", - "minecraft:packed_ice", - "minecraft:petrified_oak_slab", - "minecraft:pink_concrete", - "minecraft:pink_glazed_terracotta", - "minecraft:pink_terracotta", - "minecraft:piston", - "minecraft:piston_head", - "minecraft:pointed_dripstone", - "minecraft:polished_andesite", - "minecraft:polished_andesite_slab", - "minecraft:polished_andesite_stairs", - "minecraft:polished_basalt", - "minecraft:polished_blackstone", - "minecraft:polished_blackstone_brick_slab", - "minecraft:polished_blackstone_brick_stairs", - "minecraft:polished_blackstone_bricks", - "minecraft:polished_blackstone_pressure_plate", - "minecraft:polished_blackstone_slab", - "minecraft:polished_blackstone_stairs", - "minecraft:polished_deepslate", - "minecraft:polished_deepslate_slab", - "minecraft:polished_deepslate_stairs", - "minecraft:polished_diorite", - "minecraft:polished_diorite_slab", - "minecraft:polished_diorite_stairs", - "minecraft:polished_granite", - "minecraft:polished_granite_slab", - "minecraft:polished_granite_stairs", - "minecraft:prismarine", - "minecraft:prismarine_brick_slab", - "minecraft:prismarine_brick_stairs", - "minecraft:prismarine_bricks", - "minecraft:prismarine_slab", - "minecraft:prismarine_stairs", - "minecraft:purple_concrete", - "minecraft:purple_glazed_terracotta", - "minecraft:purple_terracotta", - "minecraft:purpur_block", - "minecraft:purpur_pillar", - "minecraft:purpur_slab", - "minecraft:purpur_stairs", - "minecraft:quartz_block", - "minecraft:quartz_bricks", - "minecraft:quartz_pillar", - "minecraft:quartz_slab", - "minecraft:quartz_stairs", - "minecraft:raw_copper_block", - "minecraft:raw_gold_block", - "minecraft:raw_iron_block", - "minecraft:red_concrete", - "minecraft:red_glazed_terracotta", - "minecraft:red_nether_brick_slab", - "minecraft:red_nether_brick_stairs", - "minecraft:red_nether_bricks", - "minecraft:red_sandstone", - "minecraft:red_sandstone_slab", - "minecraft:red_sandstone_stairs", - "minecraft:red_terracotta", - "minecraft:redstone_block", - "minecraft:redstone_ore", - "minecraft:respawn_anchor", - "minecraft:sandstone", - "minecraft:sandstone_slab", - "minecraft:sandstone_stairs", - "minecraft:small_amethyst_bud", - "minecraft:smoker", - "minecraft:smooth_basalt", - "minecraft:smooth_quartz", - "minecraft:smooth_quartz_slab", - "minecraft:smooth_quartz_stairs", - "minecraft:smooth_red_sandstone", - "minecraft:smooth_red_sandstone_slab", - "minecraft:smooth_red_sandstone_stairs", - "minecraft:smooth_sandstone", - "minecraft:smooth_sandstone_slab", - "minecraft:smooth_sandstone_stairs", - "minecraft:smooth_stone", - "minecraft:smooth_stone_slab", - "minecraft:soul_lantern", - "minecraft:spawner", - "minecraft:sticky_piston", - "minecraft:stone", - "minecraft:stone_brick_slab", - "minecraft:stone_brick_stairs", - "minecraft:stone_bricks", - "minecraft:stone_button", - "minecraft:stone_pressure_plate", - "minecraft:stone_slab", - "minecraft:stone_stairs", - "minecraft:stonecutter", - "minecraft:terracotta", - "minecraft:tube_coral_block", - "minecraft:tuff", - "minecraft:warped_nylium", - "minecraft:waxed_copper_block", - "minecraft:waxed_cut_copper", - "minecraft:waxed_cut_copper_slab", - "minecraft:waxed_cut_copper_stairs", - "minecraft:waxed_exposed_copper", - "minecraft:waxed_exposed_cut_copper", - "minecraft:waxed_exposed_cut_copper_slab", - "minecraft:waxed_exposed_cut_copper_stairs", - "minecraft:waxed_oxidized_copper", - "minecraft:waxed_oxidized_cut_copper", - "minecraft:waxed_oxidized_cut_copper_slab", - "minecraft:waxed_oxidized_cut_copper_stairs", - "minecraft:waxed_weathered_copper", - "minecraft:waxed_weathered_cut_copper", - "minecraft:waxed_weathered_cut_copper_slab", - "minecraft:waxed_weathered_cut_copper_stairs", - "minecraft:weathered_copper", - "minecraft:weathered_cut_copper", - "minecraft:weathered_cut_copper_slab", - "minecraft:weathered_cut_copper_stairs", - "minecraft:white_concrete", - "minecraft:white_glazed_terracotta", - "minecraft:white_terracotta", - "minecraft:yellow_concrete", - "minecraft:yellow_glazed_terracotta", - "minecraft:yellow_terracotta", -] -`; - -exports[`loads tags correctly 2`] = ` -[ - "#minecraft:crimson_stems", - "#minecraft:logs_that_burn", - "#minecraft:warped_stems", -] -`; - -exports[`resolves tags correctly 1`] = ` -[ - "minecraft:black_banner", - "minecraft:black_wall_banner", - "minecraft:blue_banner", - "minecraft:blue_wall_banner", - "minecraft:brown_banner", - "minecraft:brown_wall_banner", - "minecraft:cyan_banner", - "minecraft:cyan_wall_banner", - "minecraft:gray_banner", - "minecraft:gray_wall_banner", - "minecraft:green_banner", - "minecraft:green_wall_banner", - "minecraft:light_blue_banner", - "minecraft:light_blue_wall_banner", - "minecraft:light_gray_banner", - "minecraft:light_gray_wall_banner", - "minecraft:lime_banner", - "minecraft:lime_wall_banner", - "minecraft:magenta_banner", - "minecraft:magenta_wall_banner", - "minecraft:orange_banner", - "minecraft:orange_wall_banner", - "minecraft:pink_banner", - "minecraft:pink_wall_banner", - "minecraft:purple_banner", - "minecraft:purple_wall_banner", - "minecraft:red_banner", - "minecraft:red_wall_banner", - "minecraft:white_banner", - "minecraft:white_wall_banner", - "minecraft:yellow_banner", - "minecraft:yellow_wall_banner", - "minecraft:acacia_fence_gate", - "minecraft:birch_fence_gate", - "minecraft:crimson_fence_gate", - "minecraft:dark_oak_fence_gate", - "minecraft:jungle_fence_gate", - "minecraft:oak_fence_gate", - "minecraft:spruce_fence_gate", - "minecraft:warped_fence_gate", - "minecraft:crimson_hyphae", - "minecraft:crimson_stem", - "minecraft:stripped_crimson_hyphae", - "minecraft:stripped_crimson_stem", - "minecraft:acacia_log", - "minecraft:acacia_wood", - "minecraft:stripped_acacia_log", - "minecraft:stripped_acacia_wood", - "minecraft:birch_log", - "minecraft:birch_wood", - "minecraft:stripped_birch_log", - "minecraft:stripped_birch_wood", - "minecraft:dark_oak_log", - "minecraft:dark_oak_wood", - "minecraft:stripped_dark_oak_log", - "minecraft:stripped_dark_oak_wood", - "minecraft:jungle_log", - "minecraft:jungle_wood", - "minecraft:stripped_jungle_log", - "minecraft:stripped_jungle_wood", - "minecraft:oak_log", - "minecraft:oak_wood", - "minecraft:stripped_oak_log", - "minecraft:stripped_oak_wood", - "minecraft:spruce_log", - "minecraft:spruce_wood", - "minecraft:stripped_spruce_log", - "minecraft:stripped_spruce_wood", - "minecraft:stripped_warped_hyphae", - "minecraft:stripped_warped_stem", - "minecraft:warped_hyphae", - "minecraft:warped_stem", - "minecraft:acacia_planks", - "minecraft:birch_planks", - "minecraft:crimson_planks", - "minecraft:dark_oak_planks", - "minecraft:jungle_planks", - "minecraft:oak_planks", - "minecraft:spruce_planks", - "minecraft:warped_planks", - "minecraft:acacia_sapling", - "minecraft:azalea", - "minecraft:birch_sapling", - "minecraft:dark_oak_sapling", - "minecraft:flowering_azalea", - "minecraft:jungle_sapling", - "minecraft:oak_sapling", - "minecraft:spruce_sapling", - "minecraft:acacia_sign", - "minecraft:birch_sign", - "minecraft:crimson_sign", - "minecraft:dark_oak_sign", - "minecraft:jungle_sign", - "minecraft:oak_sign", - "minecraft:spruce_sign", - "minecraft:warped_sign", - "minecraft:acacia_wall_sign", - "minecraft:birch_wall_sign", - "minecraft:crimson_wall_sign", - "minecraft:dark_oak_wall_sign", - "minecraft:jungle_wall_sign", - "minecraft:oak_wall_sign", - "minecraft:spruce_wall_sign", - "minecraft:warped_wall_sign", - "minecraft:acacia_button", - "minecraft:birch_button", - "minecraft:crimson_button", - "minecraft:dark_oak_button", - "minecraft:jungle_button", - "minecraft:oak_button", - "minecraft:spruce_button", - "minecraft:warped_button", - "create:andesite_door", - "create:brass_door", - "create:copper_door", - "create:framed_glass_door", - "create:train_door", - "minecraft:acacia_door", - "minecraft:birch_door", - "minecraft:crimson_door", - "minecraft:dark_oak_door", - "minecraft:jungle_door", - "minecraft:oak_door", - "minecraft:spruce_door", - "minecraft:warped_door", - "minecraft:acacia_fence", - "minecraft:birch_fence", - "minecraft:crimson_fence", - "minecraft:dark_oak_fence", - "minecraft:jungle_fence", - "minecraft:oak_fence", - "minecraft:spruce_fence", - "minecraft:warped_fence", - "minecraft:acacia_pressure_plate", - "minecraft:birch_pressure_plate", - "minecraft:crimson_pressure_plate", - "minecraft:dark_oak_pressure_plate", - "minecraft:jungle_pressure_plate", - "minecraft:oak_pressure_plate", - "minecraft:spruce_pressure_plate", - "minecraft:warped_pressure_plate", - "minecraft:acacia_slab", - "minecraft:birch_slab", - "minecraft:crimson_slab", - "minecraft:dark_oak_slab", - "minecraft:jungle_slab", - "minecraft:oak_slab", - "minecraft:spruce_slab", - "minecraft:warped_slab", - "minecraft:acacia_stairs", - "minecraft:birch_stairs", - "minecraft:crimson_stairs", - "minecraft:dark_oak_stairs", - "minecraft:jungle_stairs", - "minecraft:oak_stairs", - "minecraft:spruce_stairs", - "minecraft:warped_stairs", - "minecraft:acacia_trapdoor", - "minecraft:birch_trapdoor", - "minecraft:crimson_trapdoor", - "minecraft:dark_oak_trapdoor", - "minecraft:jungle_trapdoor", - "minecraft:oak_trapdoor", - "minecraft:spruce_trapdoor", - "minecraft:warped_trapdoor", - "create:adjustable_chain_gearshift", - "create:analog_lever", - "create:andesite_casing", - "create:andesite_encased_cogwheel", - "create:andesite_encased_large_cogwheel", - "create:andesite_encased_shaft", - "create:belt", - "create:black_sail", - "create:black_seat", - "create:blue_sail", - "create:blue_seat", - "create:brass_casing", - "create:brass_encased_cogwheel", - "create:brass_encased_large_cogwheel", - "create:brass_encased_shaft", - "create:brown_sail", - "create:brown_seat", - "create:cart_assembler", - "create:clipboard", - "create:clockwork_bearing", - "create:clutch", - "create:cogwheel", - "create:content_observer", - "create:contraption_controls", - "create:copper_casing", - "create:copycat_panel", - "create:copycat_step", - "create:creative_crate", - "create:cuckoo_clock", - "create:cyan_sail", - "create:cyan_seat", - "create:deployer", - "create:depot", - "create:display_link", - "create:elevator_contact", - "create:elevator_pulley", - "create:encased_chain_drive", - "create:encased_fan", - "create:encased_fluid_pipe", - "create:flywheel", - "create:gantry_carriage", - "create:gantry_shaft", - "create:gearbox", - "create:gearshift", - "create:gray_sail", - "create:gray_seat", - "create:green_sail", - "create:green_seat", - "create:hand_crank", - "create:large_cogwheel", - "create:large_water_wheel", - "create:lectern_controller", - "create:light_blue_sail", - "create:light_blue_seat", - "create:light_gray_sail", - "create:light_gray_seat", - "create:lime_sail", - "create:lime_seat", - "create:linear_chassis", - "create:magenta_sail", - "create:magenta_seat", - "create:mechanical_arm", - "create:mechanical_bearing", - "create:mechanical_crafter", - "create:mechanical_drill", - "create:mechanical_harvester", - "create:mechanical_mixer", - "create:mechanical_piston", - "create:mechanical_piston_head", - "create:mechanical_plough", - "create:mechanical_press", - "create:mechanical_roller", - "create:mechanical_saw", - "create:mysterious_cuckoo_clock", - "create:nozzle", - "create:orange_sail", - "create:orange_seat", - "create:pink_sail", - "create:pink_seat", - "create:piston_extension_pole", - "create:portable_fluid_interface", - "create:portable_storage_interface", - "create:purple_sail", - "create:purple_seat", - "create:radial_chassis", - "create:railway_casing", - "create:red_sail", - "create:red_seat", - "create:redstone_contact", - "create:redstone_link", - "create:refined_radiance_casing", - "create:rope_pulley", - "create:rotation_speed_controller", - "create:sail_frame", - "create:schematic_table", - "create:secondary_linear_chassis", - "create:sequenced_gearshift", - "create:shadow_steel_casing", - "create:speedometer", - "create:sticky_mechanical_piston", - "create:stockpile_switch", - "create:stressometer", - "create:turntable", - "create:water_wheel", - "create:water_wheel_structure", - "create:weighted_ejector", - "create:white_sail", - "create:white_seat", - "create:windmill_bearing", - "create:wooden_bracket", - "create:yellow_sail", - "create:yellow_seat", - "minecraft:attached_melon_stem", - "minecraft:attached_pumpkin_stem", - "minecraft:azalea", - "minecraft:bamboo", - "minecraft:barrel", - "minecraft:bee_nest", - "minecraft:beehive", - "minecraft:beetroots", - "minecraft:big_dripleaf", - "minecraft:big_dripleaf_stem", - "minecraft:bookshelf", - "minecraft:brown_mushroom", - "minecraft:brown_mushroom_block", - "minecraft:campfire", - "minecraft:carrots", - "minecraft:cartography_table", - "minecraft:carved_pumpkin", - "minecraft:cave_vines", - "minecraft:cave_vines_plant", - "minecraft:chest", - "minecraft:chorus_flower", - "minecraft:chorus_plant", - "minecraft:cocoa", - "minecraft:composter", - "minecraft:crafting_table", - "minecraft:crimson_fungus", - "minecraft:daylight_detector", - "minecraft:dead_bush", - "minecraft:fern", - "minecraft:fletching_table", - "minecraft:glow_lichen", - "minecraft:grass", - "minecraft:hanging_roots", - "minecraft:jack_o_lantern", - "minecraft:jukebox", - "minecraft:ladder", - "minecraft:large_fern", - "minecraft:lectern", - "minecraft:lily_pad", - "minecraft:loom", - "minecraft:melon", - "minecraft:melon_stem", - "minecraft:mushroom_stem", - "minecraft:nether_wart", - "minecraft:note_block", - "minecraft:potatoes", - "minecraft:pumpkin", - "minecraft:pumpkin_stem", - "minecraft:red_mushroom", - "minecraft:red_mushroom_block", - "minecraft:scaffolding", - "minecraft:small_dripleaf", - "minecraft:smithing_table", - "minecraft:soul_campfire", - "minecraft:spore_blossom", - "minecraft:sugar_cane", - "minecraft:sweet_berry_bush", - "minecraft:tall_grass", - "minecraft:trapped_chest", - "minecraft:twisting_vines", - "minecraft:twisting_vines_plant", - "minecraft:vine", - "minecraft:warped_fungus", - "minecraft:weeping_vines", - "minecraft:weeping_vines_plant", - "minecraft:wheat", -] -`; - -exports[`resolves tags correctly 2`] = ` -[ - "minecraft:acacia_trapdoor", - "minecraft:birch_trapdoor", - "minecraft:crimson_trapdoor", - "minecraft:dark_oak_trapdoor", - "minecraft:jungle_trapdoor", - "minecraft:oak_trapdoor", - "minecraft:spruce_trapdoor", - "minecraft:warped_trapdoor", - "create:framed_glass_trapdoor", - "create:train_trapdoor", - "minecraft:iron_trapdoor", -] -`; diff --git a/test/id.test.ts b/test/id.test.ts index 352a35e..1cc7a71 100644 --- a/test/id.test.ts +++ b/test/id.test.ts @@ -1,6 +1,6 @@ import { createId, encodeId, Id, NormalizedId } from '../src/common/id' -import { resolveIDTest } from '../src/common/ingredient' import Registry from '../src/common/registry' +import { resolveIDTest } from '../src/common/predicates' it('parses id from string', () => { expect(createId('minecraft:stone')).toMatchObject({ namespace: 'minecraft', path: 'stone' }) diff --git a/test/ingredient.test.ts b/test/ingredient.test.ts index 8247ab6..35b6531 100644 --- a/test/ingredient.test.ts +++ b/test/ingredient.test.ts @@ -7,7 +7,7 @@ import { Ingredient } from '../src/common/ingredient' const logger = createTestLogger() const loader = new PackLoader(logger) beforeAll(async () => { - const resolver = createTestResolver({ include: ['data/*/tags/**/*.json'] }) + const resolver = createTestResolver() await loader.loadFrom(resolver) }, 10_000) @@ -22,15 +22,15 @@ describe('tests regarding ingredient/result shapes', () => { predicate(['test', { whatever: true }] as any as Ingredient) predicate({} as any as Ingredient) + predicate(10 as any as Ingredient) + predicate(null as any as Ingredient) - expect(logger.warn).toBeCalledTimes(2) + expect(logger.warn).toBeCalledTimes(4) }) it('does not encounter any unknown ingredient shapes', async () => { const acceptor = createTestAcceptor() - // TODO pretty sure this should fail - loader.recipes.replaceIngredient('minecraft:coal', { item: 'minecraft:diamond' }) loader.recipes.replaceIngredient({ item: 'minecraft:coal' }, { item: 'minecraft:diamond' }) loader.recipes.replaceIngredient({ fluid: 'minecraft:water' }, { item: 'minecraft:lava' })