1.21 Migration Guide

Link to 121-migration-guide

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:

OldNew
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:

ReplaceWith
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:

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
Copy
import 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
Copy
import 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);
}

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, ResourceLocations 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
Copy
import 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