Skip to content

Commit

Permalink
1.21.2-pre1
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Oct 8, 2024
1 parent ef8a9fd commit 8acbfa5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/carpet/script/api/Inventories.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -121,7 +123,7 @@ public static void apply(Expression expression)
}
List<Value> 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<Value> results = new ArrayList<>();
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/carpet/script/utils/RecipeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,7 +19,9 @@ public class RecipeHelper
public static List<Recipe<?>> getRecipesForOutput(RecipeManager recipeManager, RecipeType<?> type, ResourceLocation id, Level level)
{
List<Recipe<?>> results = new ArrayList<>();
SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level);


ContextMap context = SlotDisplayContext.fromLevel(level);
recipeManager.getRecipes().forEach(r -> {
if (r.value().getType() == type)
{
Expand All @@ -39,7 +42,8 @@ public static List<Recipe<?>> getRecipesForOutput(RecipeManager recipeManager, R
public static List<Recipe<?>> getRecipesForOutput(RecipeManager recipeManager, ResourceLocation id, Level level)
{
List<Recipe<?>> 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())
{
Expand Down

0 comments on commit 8acbfa5

Please sign in to comment.