Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
QPCrummer committed Jun 22, 2024
1 parent 4dfb35e commit b4da6cf
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modImplementation include("eu.pb4:polymer-core:0.8.0-beta.8+1.20.6")
modImplementation include("xyz.nucleoid:server-translations-api:2.3.0+1.20.5-rc2")
modImplementation "maven.modrinth:lithium:mc1.20.6-0.12.3"
modImplementation include("eu.pb4:polymer-core:0.9.2+1.21")
modImplementation include("xyz.nucleoid:server-translations-api:2.3.1+1.21-pre2")
modImplementation "maven.modrinth:lithium:mc1.21-0.12.7"
include(implementation("com.moulberry:mixinconstraints:1.0.1"))
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
org.gradle.jvmargs=-Xmx1G
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
fabric_version=0.97.8+1.20.6
mod_version=1.0.16
fabric_version=0.100.3+1.21
mod_version=1.0.17
maven_group=com.github.tatercertified
archives_base_name=fabricautocrafter
modrinth_id=wbqioEpc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class AutoCrafterMod implements ModInitializer {

public static final Identifier IDENTIFIER = new Identifier("autocrafter", "autocrafter");
public static final Identifier IDENTIFIER = Identifier.of("autocrafter", "autocrafter");
public static final Block BLOCK = new AutoCrafter(AbstractBlock.Settings.copy(Blocks.CRAFTING_TABLE).strength(2.5f, 2.5f));
public static final BlockItem ITEM = new PolymerBlockItem(BLOCK, new Item.Settings(), Items.CRAFTING_TABLE);
public static final BlockEntityType<AutoCraftingTableBlockEntity> TYPE = BlockEntityType.Builder.create(AutoCraftingTableBlockEntity::new, BLOCK).build(null);
Expand All @@ -32,5 +32,6 @@ public void onInitialize() {
Registry.register(Registries.ITEM, IDENTIFIER, ITEM);
Registry.register(Registries.BLOCK_ENTITY_TYPE, IDENTIFIER, TYPE);
PolymerBlockUtils.registerBlockEntity(TYPE);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.recipe.*;
import net.minecraft.recipe.input.CraftingRecipeInput;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -124,7 +125,7 @@ public ItemStack getStack(int slot) {
if (slot > 0) return this.inventory.get(slot - 1);
if (!output.isEmpty()) return output;
Optional<CraftingRecipe> recipe = getCurrentRecipe();
return recipe.map(craftingRecipe -> craftingRecipe.craft(craftingInventory, this.getWorld().getRegistryManager())).orElse(ItemStack.EMPTY);
return recipe.map(craftingRecipe -> craftingRecipe.craft(craftingInventory.createRecipeInput(), this.getWorld().getRegistryManager())).orElse(ItemStack.EMPTY);
}

@Override
Expand Down Expand Up @@ -201,14 +202,14 @@ private Optional<CraftingRecipe> getCurrentRecipe() {
for (RecipeEntry<CraftingRecipe> entry : manager.getAllOfType(RecipeType.CRAFTING)) {
if (entry.value().equals(recipe)) {
CraftingRecipe mapRecipe = entry.value();
if (mapRecipe.matches(this.craftingInventory, world)) {
if (mapRecipe.matches(this.craftingInventory.createRecipeInput(), world)) {
return Optional.of(mapRecipe);
}
}
}
}

Optional<RecipeEntry<CraftingRecipe>> recipe = manager.getFirstMatch(RecipeType.CRAFTING, craftingInventory, world);
Optional<RecipeEntry<CraftingRecipe>> recipe = manager.getFirstMatch(RecipeType.CRAFTING, craftingInventory.createRecipeInput(), world);
recipe.ifPresent(this::setLastRecipe);

return recipe.map(RecipeEntry::value);
Expand All @@ -220,8 +221,9 @@ private ItemStack craft() {
if (optionalRecipe.isEmpty()) return ItemStack.EMPTY;

final CraftingRecipe recipe = optionalRecipe.get();
final ItemStack result = recipe.craft(craftingInventory, this.getWorld().getRegistryManager());
final DefaultedList<ItemStack> remaining = world.getRecipeManager().getRemainingStacks(RecipeType.CRAFTING, craftingInventory, world);
final CraftingRecipeInput input = craftingInventory.createRecipeInput();
final ItemStack result = recipe.craft(input, this.getWorld().getRegistryManager());
final DefaultedList<ItemStack> remaining = world.getRecipeManager().getRemainingStacks(RecipeType.CRAFTING, input, world);
for (int i = 0; i < 9; i++) {
ItemStack current = inventory.get(i);
ItemStack remainingStack = remaining.get(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.CraftingRecipe;
import net.minecraft.recipe.RecipeEntry;
import net.minecraft.recipe.RecipeMatcher;
import net.minecraft.recipe.RecipeUnlocker;
Expand Down Expand Up @@ -97,8 +96,8 @@ public void clearCraftingSlots() {
}

@Override
public boolean matches(RecipeEntry<? extends Recipe<RecipeInputInventory>> recipe) {
return recipe.value().matches(this.crafting_inv, this.player.getWorld());
public boolean matches(RecipeEntry<CraftingRecipe> recipe) {
return recipe.value().matches(this.crafting_inv.createRecipeInput(), this.player.getWorld());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"depends": {
"fabricloader": "*",
"fabric": "*",
"minecraft": ">=1.20.5",
"minecraft": ">=1.21",
"java": ">=21"
},
"recommends": {
Expand Down

0 comments on commit b4da6cf

Please sign in to comment.