Skip to content

Update Create Mod Generators to 1.21.1 #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 142 additions & 94 deletions public/mcdoc/create.mcdoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use ::java::world::component::DataComponentPatch

dispatch minecraft:resource[create:recipes] to struct Recipes {
type: #[id] Type,
type: Type,
...create:recipes[[type]],
}

enum(string) Type {
Compacting = "create:compacting",
Crushing = "create:crushing",
Cutting = "create:cutting",
Deploying = "create:deploying",
Expand All @@ -25,6 +28,48 @@ struct NBT {
Potion?: string,
}

type Item = struct {
#[until="1.20.2"]
item: string,
#[since="1.21.1"]
id: string,
chance?: float @ 0..,
count?: int @ 1..,
#[since="1.21.1"]
components?: DataComponentPatch,
}

type ItemWithCount = struct {
#[until="1.20.2"]
item: string,
#[since="1.21.1"]
id: string,
count?: int @ 0..,
#[since="1.21.1"]
components?: DataComponentPatch,
}

type SimpleItem = struct {
#[until="1.20.2"]
item: string,
#[since="1.21.1"]
id: string,
#[since="1.21.1"]
components?: DataComponentPatch,
}

type Fluid = struct {
#[until="1.20.2"]
fluid: string,
#[until="1.20.2"]
nbt?: NBT,
#[since="1.21.1"]
id: string,
amount: int @ 1..,
#[since="1.21.1"]
components?: DataComponentPatch,
}

type ItemOrTag = (
struct {
item: string,
Expand All @@ -33,168 +78,171 @@ type ItemOrTag = (
}
)

type ItemOrTagWithCount = (
struct {
item: string,
count?: int @ 1..,
} | struct {
tag: string,
count?: int @ 1..,
}
)

type FluidOrTag = (
struct {
fluid: string,
#[since="1.21.1"]
type: "fluid_stack",
amount: int @ 1..,
#[until="1.20.2"]
nbt?: NBT,
#[since="1.21.1"]
components?: DataComponentPatch,
} | struct {
#[until="1.20.2"]
fluidTag: string,
#[since="1.21.1"]
fluid_tag: string,
#[since="1.21.1"]
type: "fluid_tag",
amount: int @ 1..,
#[until="1.20.2"]
nbt?: NBT,
#[since="1.21.1"]
components?: DataComponentPatch,
}
)

type MixingResult = struct {
id: string,
/// Used for items; optional field.
count?: int @ 1..,
/// Used for fluids; mandatory field.
amount?: int @ 1..,
components?: DataComponentPatch,
}

dispatch create:recipes[create:compacting] to struct {
ingredients: [(ItemOrTagWithCount | FluidOrTag)] @ 1..,
#[until="1.20.2"]
results: [(ItemWithCount | Fluid)] @ 1..,
#[since="1.21.1"]
results: [MixingResult] @ 1,
}

dispatch create:recipes[create:crushing] to struct {
#[until="1.20.2"]
processingTime: int @ 1..,
#[since="1.21.1"]
processing_time: int @ 1..,
ingredients: [ItemOrTag] @ 1,
results: [struct {
chance?: float @ 0..,
count?: int @ 1..,
item: string,
}] @ 1..,
results: [Item] @ 1..,
}

dispatch create:recipes[create:cutting] to struct {
#[until="1.20.2"]
processingTime: int @ 1..,
ingredients: [struct {
item?: string, // Make the user select only one
tag?: string,
count?: int @ 1..,
}] @ 1,
results: [struct {
item: string,
count?: int @ 1..,
}] @ 1,
#[since="1.21.1"]
processing_time: int @ 1..,
ingredients: [ItemOrTag] @ 1,
results: [Item] @ 1,
}

dispatch create:recipes[create:deploying] to struct {
/// The first object is the base item and the second object is the ingredient
/// The first item is the base item; the second is the ingredient to be deployed.
ingredients: [ItemOrTag] @ 2,
/// Defaults to false.
#[until="1.20.2"]
keepHeldItem?: boolean,
results: [struct {
item: string,
}] @ 1,
/// Defaults to false.
#[since="1.21.1"]
keep_held_item?: boolean,
results: [SimpleItem] @ 1,
}

dispatch create:recipes[create:emptying] to struct {
ingredients: [ItemOrTag] @ 1,
results: [struct {
item: string,
count?: int @ 1..,
}, struct {
fluid: string,
amount: int @ 1..,
}],
results: [SimpleItem, Fluid],
}

dispatch create:recipes[create:filling] to struct {
ingredients: [ItemOrTag, FluidOrTag],
results: [struct { item: string }] @ 1,
results: [SimpleItem] @ 1,
}

dispatch create:recipes[create:haunting] to struct {
ingredients: [ItemOrTag] @ 1,
results: [struct {
chance?: float @ 0..,
count?: int @ 1..,
item: string,
}] @ 1..,
results: [Item] @ 1..,
}

dispatch create:recipes[create:item_application] to struct {
/// The first object is the base item and the second object is the ingredient
/// The first item is the base item; the second is the ingredient to be applied.
ingredients: [ItemOrTag] @ 2,
results: [struct {
item: string,
}] @ 1,
results: [SimpleItem] @ 1,
}

dispatch create:recipes[create:mechanical_crafting] to struct {
acceptMirrored?: boolean,
/// Warning: JEI will not display recipes greater in size than 9x9
pattern: [string],
#[until="1.20.2"]
acceptMirrored: boolean,
#[since="1.21.1"]
accept_mirrored: boolean,
/// Identifier for the category this goes in the recipe book.
#[since="1.21.1"]
category: string,
/// <b style="color: var(--accent-warning);">Warning: </b>Recipes larger than 9x9 will not be displayed in JEI.
pattern: [#[crafting_ingredient(definition=true)] string],
key: struct {
[string]: ItemOrTag,
},
result: struct {
count?: int @ 1..,
item: string,
[#[crafting_ingredient] string]: ItemOrTag,
},
result: ItemWithCount,
/// Determines if a notification is shown when unlocking this recipe. Defaults to true.
#[since="1.21.1"]
show_notification?: boolean,
}

dispatch create:recipes[create:milling] to struct {
#[until="1.20.2"]
processingTime: int @ 1..,
#[since="1.21.1"]
processing_time: int @ 1..,
ingredients: [ItemOrTag] @ 1,
results: [struct {
chance?: float @ 0..,
count?: int @ 1..,
item: string,
}] @ 1..,
results: [Item] @ 1..,
}

dispatch create:recipes[create:mixing] to struct {
#[until="1.20.2"]
heatRequirement?: ("heated" | "superheated"),
ingredients: [(struct {
count: int @ 1..,
item: string,
} | struct {
count: int @ 1..,
tag: string,
} | struct {
fluid: string,
amount: int @ 1..,
nbt?: NBT,
} | struct {
fluidTag: string,
amount: int @ 1..,
nbt?: NBT,
})] @ 1..,
results: [(struct {
count: int @ 1..,
item: string,
} | struct {
fluid: string,
amount: int @ 1..,
nbt?: NBT,
})] @ 1,
#[since="1.21.1"]
heat_requirement?: ("heated" | "superheated"),
ingredients: [(ItemOrTagWithCount | FluidOrTag)] @ 1..,
#[until="1.20.2"]
results: [(ItemWithCount | Fluid)] @ 1..,
#[since="1.21.1"]
results: [MixingResult] @ 1,
}

dispatch create:recipes[create:pressing] to struct {
ingredients: [ItemOrTag] @ 1,
results: [struct {
item: string,
count?: int @ 1..,
}] @ 1,
ingredients: [ItemOrTag] @ 1..,
results: [ItemWithCount] @ 1,
}

dispatch create:recipes[create:sandpaper_polishing] to struct {
ingredients: [ItemOrTag] @ 1,
results: [struct {
item: string,
count?: int @ 1..,
}] @ 1,
results: [ItemWithCount] @ 1,
}

dispatch create:recipes[create:sequenced_assembly] to struct {
ingredient: ItemOrTag,
loops: int @ 1..,
results: [struct {
chance?: float @ 0..,
count?: int @ 1..,
item: string,
}],
results: [Item] @ 1..,
sequence: [Recipes],
transitionalItem: struct {
item: string,
},
#[until="1.20.2"]
transitionalItem: SimpleItem,
#[since="1.21.1"]
transitional_item: SimpleItem,
}

dispatch create:recipes[create:splashing] to struct {
ingredients: [ItemOrTag] @ 1,
results: [struct {
chance?: float @ 0..,
count?: int @ 1..,
item: string,
}] @ 1..,
results: [Item] @ 1..,
}