diff --git a/gradle.properties b/gradle.properties index 0aee7ba6d..2a3cc0f61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w40a + minecraft_version=1.21.2-pre1 loader_version=0.16.5 jsr305_version=3.0.2 fabric_version=0.105.1+1.21.2 diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index d1aa25275..1f5b6ea23 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -36,6 +36,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -50,6 +51,7 @@ import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.item.crafting.SingleItemRecipe; import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; import net.minecraft.world.phys.Vec3; public class Inventories @@ -121,7 +123,7 @@ public static void apply(Expression expression) } List recipesOutput = new ArrayList<>(); RegistryAccess regs = cc.registryAccess(); - SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(cc.level()); + ContextMap context = SlotDisplayContext.fromLevel(cc.level()); for (Recipe recipe : recipes) { List results = new ArrayList<>(); diff --git a/src/main/java/carpet/script/utils/RecipeHelper.java b/src/main/java/carpet/script/utils/RecipeHelper.java index c235e84f5..94c484d0e 100644 --- a/src/main/java/carpet/script/utils/RecipeHelper.java +++ b/src/main/java/carpet/script/utils/RecipeHelper.java @@ -3,11 +3,12 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.display.RecipeDisplay; -import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; import net.minecraft.world.level.Level; import java.util.ArrayList; @@ -18,7 +19,9 @@ public class RecipeHelper public static List> getRecipesForOutput(RecipeManager recipeManager, RecipeType type, ResourceLocation id, Level level) { List> results = new ArrayList<>(); - SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level); + + + ContextMap context = SlotDisplayContext.fromLevel(level); recipeManager.getRecipes().forEach(r -> { if (r.value().getType() == type) { @@ -39,7 +42,8 @@ public static List> getRecipesForOutput(RecipeManager recipeManager, R public static List> getRecipesForOutput(RecipeManager recipeManager, ResourceLocation id, Level level) { List> results = new ArrayList<>(); - SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level); + + ContextMap context = SlotDisplayContext.fromLevel(level); recipeManager.getRecipes().forEach(r -> { for (RecipeDisplay recipeDisplay : r.value().display()) {