1.21 Migration Guide
Link to 121-migration-guide
Major Changes
Link to major-changes
Tag names
Link to tag-names
With 1.21, Mojang has stopped hard coding the blocks
, entity_types
, fluids
, game_events
and items
tag folders, they are now treated the same as other types of tags, with singular names:
Old | New |
---|---|
Old blocks | New block |
Old entity_types | New entity_type |
Old fluids | New fluid |
Old game_events | New game_event |
Old items | New item |
This change means that scripts need to be updated to reference the new folder, all instances of <tag:items:
now needs to become <tag:item:
, you can safely use your text editor's 'find and replace in files' feature to perform the following replacements:
Replace | With |
---|---|
Replace <tag:blocks: | With <tag:block: |
Replace <tag:entity_types: | With <tag:entity_type: |
Replace <tag:fluids: | With <tag:fluid: |
Replace <tag:game_events: | With <tag:game_event: |
Replace <tag:items: | With <tag:item: |
RecipeInput
Link to recipeinput
To use the crafttweaker.api.recipe.type.Recipe
class in older versions, such as to query a recipe, scripts would need to look like the following:
ZenScript Copyimport crafttweaker.api.recipe.RecipeHolder;
import crafttweaker.api.recipe.type.Recipe;
import crafttweaker.api.world.Container;
val recipe = recipes.getRecipeByName("minecraft:acacia_boat");
if recipe is RecipeHolder<Recipe<Container>> {
println(recipe.value.resultItem.commandString);
}
In 1.21, Mojang has introduced a new class to replace Container
, crafttweaker.api.recipe.input.RecipeInput
, which functions similarly to Container
, the above script now needs to look like:
ZenScript Copyimport crafttweaker.api.recipe.RecipeHolder;
import crafttweaker.api.recipe.type.Recipe;
crafttweaker.api.recipe.input.RecipeInput
val recipe = recipes.getRecipeByName("minecraft:acacia_boat");
if recipe is RecipeHolder<Recipe<RecipeInput>> {
println(recipe.value.resultItem.commandString);
}
Ingredient
Link to ingredient
The crafttweaker.api.item.Ingredient
class has been moved to crafttweaker.api.ingredient.Ingredient
ResourceLocation
Link to resourcelocation
The constructor for crafttweaker.api.resource.ResourceLocation
has been removed, ResourceLocation
s can still be constructed using the bracket handler: <resource:namespace:path>
, but can also be constructed by using the new parse
and fromNameSpaceAndPath
methods:
ZenScript Copyimport crafttweaker.api.resource.ResourceLocation;
val old = <resource:minecraft:acacia_boat>;
val parse = ResourceLocation.parse("minecraft:acacia_boat");
val fromNameSpaceAndPath = ResourceLocation.fromNameSpaceAndPath("minecraft", "acacia_boat");
LootingLevelEvent
Link to lootinglevelevent
The NeoForge crafttweaker.neoforge.api.event.entity.living.LootingLevelEvent
event has been removed.
There is no replacement for this at this time, but may be in the future: https://github.com/neoforged/NeoForge/issues/1112