Skip to content

Commit 935c477

Browse files
committed
feat: update to 1.21
shockingly simple upgrade (the point releases were worse)
1 parent ba578f6 commit 935c477

23 files changed

+68
-76
lines changed

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ dependencies {
165165
"fabric-api-lookup-api-v1",
166166
"fabric-gametest-api-v1",
167167
"fabric-item-api-v1",
168-
"fabric-models-v0",
168+
"fabric-model-loading-api-v1",
169169
"fabric-renderer-api-v1",
170170
"fabric-rendering-data-attachment-v1",
171171
"fabric-rendering-fluids-v1",

gradle.properties

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ mod.name=MachineLib
66
mod.version=0.7.0
77

88
# Minecraft and Fabric Loader
9-
minecraft.version=1.20.6
9+
minecraft.version=1.21
1010
loader.version=0.15.11
11-
yarn.build=3
11+
yarn.build=8
1212

1313
# Mod Dependencies
14-
badpackets.version=0.7.2
15-
energy.version=4.0.0
16-
fabric.version=0.100.4+1.20.6
14+
badpackets.version=0.8.1
15+
energy.version=4.1.0
16+
fabric.version=0.100.6+1.21
1717

1818
# Optional Mod Dependencies
19-
cloth.config.version=14.0.126
20-
modmenu.version=10.0.0
21-
rei.version=15.0.728
22-
architectury.version=12.1.3
23-
wthit.version=11.4.1
19+
cloth.config.version=15.0.127
20+
modmenu.version=11.0.1
21+
rei.version=16.0.729
22+
architectury.version=13.0.3
23+
wthit.version=12.2.2

src/main/java/dev/galacticraft/machinelib/api/block/entity/BasicRecipeMachineBlockEntity.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
import dev.galacticraft.machinelib.api.storage.StorageSpec;
2727
import dev.galacticraft.machinelib.api.storage.slot.ItemResourceSlot;
2828
import net.minecraft.core.BlockPos;
29-
import net.minecraft.world.Container;
3029
import net.minecraft.world.item.Item;
3130
import net.minecraft.world.item.ItemStack;
3231
import net.minecraft.world.item.crafting.Recipe;
3332
import net.minecraft.world.item.crafting.RecipeHolder;
33+
import net.minecraft.world.item.crafting.RecipeInput;
3434
import net.minecraft.world.item.crafting.RecipeType;
3535
import net.minecraft.world.level.block.entity.BlockEntityType;
3636
import net.minecraft.world.level.block.state.BlockState;
@@ -40,14 +40,14 @@
4040
/**
4141
* A machine block entity that processes recipes.
4242
*
43-
* @param <C> The type of inventory the recipe type uses.
43+
* @param <I> The type of inventory the recipe type uses.
4444
* @param <R> The type of recipe the machine uses.
4545
*/
46-
public abstract class BasicRecipeMachineBlockEntity<C extends Container, R extends Recipe<C>> extends RecipeMachineBlockEntity<C, R> {
46+
public abstract class BasicRecipeMachineBlockEntity<I extends RecipeInput, R extends Recipe<I>> extends RecipeMachineBlockEntity<I, R> {
4747
/**
4848
* An inventory for use in finding vanilla recipes for this machine.
4949
*/
50-
protected final @NotNull C craftingInv;
50+
protected final @NotNull I craftingInv;
5151

5252
protected final SlottedStorageAccess<Item, ItemResourceSlot> inputSlots;
5353
protected final SlottedStorageAccess<Item, ItemResourceSlot> outputSlots;
@@ -62,7 +62,7 @@ public abstract class BasicRecipeMachineBlockEntity<C extends Container, R exten
6262
* @param inputSlot The index of the recipe input slot.
6363
* @param outputSlot The index of the recipe output slot.
6464
*/
65-
protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMachineBlockEntity<C, R>> type,
65+
protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMachineBlockEntity<I, R>> type,
6666
BlockPos pos, BlockState state, RecipeType<R> recipeType, StorageSpec spec, int inputSlot, int outputSlot) {
6767
this(type, pos, state, recipeType, spec, inputSlot, 1, outputSlot);
6868
}
@@ -78,7 +78,7 @@ protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMac
7878
* @param inputSlotsLen The number of recipe input slots.
7979
* @param outputSlot The index of the recipe output slot.
8080
*/
81-
protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMachineBlockEntity<C, R>> type,
81+
protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMachineBlockEntity<I, R>> type,
8282
BlockPos pos, BlockState state, RecipeType<R> recipeType, StorageSpec spec, int inputSlots, int inputSlotsLen, int outputSlot) {
8383
this(type, pos, state, recipeType, spec, inputSlots, inputSlotsLen, outputSlot, 1);
8484
}
@@ -95,7 +95,7 @@ protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMac
9595
* @param outputSlots The index of the first recipe output slot.
9696
* @param outputSlotsLen The number of recipe output slots.
9797
*/
98-
protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMachineBlockEntity<C, R>> type,
98+
protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMachineBlockEntity<I, R>> type,
9999
BlockPos pos, BlockState state, RecipeType<R> recipeType, StorageSpec spec, int inputSlots, int inputSlotsLen, int outputSlots, int outputSlotsLen) {
100100
super(type, pos, state, recipeType, spec);
101101

@@ -105,7 +105,7 @@ protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMac
105105
this.craftingInv = this.createCraftingInv();
106106
}
107107

108-
protected abstract C createCraftingInv();
108+
protected abstract I createCraftingInv();
109109

110110
/**
111111
* Creates an inventory for use in finding vanilla recipes for this machine.
@@ -115,7 +115,7 @@ protected BasicRecipeMachineBlockEntity(BlockEntityType<? extends BasicRecipeMac
115115
*/
116116
@Override
117117
@Contract(pure = true)
118-
protected @NotNull C craftingInv() {
118+
protected @NotNull I craftingInv() {
119119
return this.craftingInv;
120120
}
121121

src/main/java/dev/galacticraft/machinelib/api/block/entity/MachineBlockEntity.java

-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
package dev.galacticraft.machinelib.api.block.entity;
2424

25-
import dev.galacticraft.machinelib.api.block.MachineBlock;
2625
import dev.galacticraft.machinelib.api.machine.MachineStatus;
2726
import dev.galacticraft.machinelib.api.menu.MachineMenu;
2827
import dev.galacticraft.machinelib.api.storage.MachineEnergyStorage;
@@ -34,7 +33,6 @@
3433
import dev.galacticraft.machinelib.api.transfer.ResourceFlow;
3534
import dev.galacticraft.machinelib.api.util.BlockFace;
3635
import dev.galacticraft.machinelib.api.util.StorageHelper;
37-
import dev.galacticraft.machinelib.client.api.screen.MachineScreen;
3836
import dev.galacticraft.machinelib.impl.Constant;
3937
import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity;
4038
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
@@ -69,10 +67,6 @@
6967
* <p>
7068
* This class handles three different types of storage and IO configurations:
7169
* {@link MachineEnergyStorage energy}, {@link MachineItemStorage item} and {@link MachineFluidStorage fluid} storage.
72-
*
73-
* @see MachineBlock
74-
* @see MachineMenu
75-
* @see MachineScreen
7670
*/
7771
public abstract class MachineBlockEntity extends ConfiguredBlockEntity implements RenderDataBlockEntity {
7872
private final @NotNull MachineItemStorage itemStorage;

src/main/java/dev/galacticraft/machinelib/api/block/entity/RecipeMachineBlockEntity.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
import net.minecraft.nbt.CompoundTag;
3232
import net.minecraft.server.level.ServerLevel;
3333
import net.minecraft.util.profiling.ProfilerFiller;
34-
import net.minecraft.world.Container;
3534
import net.minecraft.world.item.crafting.Recipe;
3635
import net.minecraft.world.item.crafting.RecipeHolder;
36+
import net.minecraft.world.item.crafting.RecipeInput;
3737
import net.minecraft.world.item.crafting.RecipeType;
3838
import net.minecraft.world.level.Level;
3939
import net.minecraft.world.level.block.entity.BlockEntityType;
@@ -46,10 +46,10 @@
4646
/**
4747
* A machine block entity that processes recipes.
4848
*
49-
* @param <C> The type of inventory the recipe type uses.
49+
* @param <I> The type of inventory the recipe type uses.
5050
* @param <R> The type of recipe the machine uses.
5151
*/
52-
public abstract class RecipeMachineBlockEntity<C extends Container, R extends Recipe<C>> extends MachineBlockEntity {
52+
public abstract class RecipeMachineBlockEntity<I extends RecipeInput, R extends Recipe<I>> extends MachineBlockEntity {
5353
/**
5454
* The type of recipe that this machine processes.
5555
*/
@@ -93,7 +93,7 @@ public abstract class RecipeMachineBlockEntity<C extends Container, R extends Re
9393
* @param state The block state of the machine.
9494
* @param recipeType The type of recipe to be processed.
9595
*/
96-
protected RecipeMachineBlockEntity(@NotNull BlockEntityType<? extends RecipeMachineBlockEntity<C, R>> type, @NotNull BlockPos pos, BlockState state, @NotNull RecipeType<R> recipeType,
96+
protected RecipeMachineBlockEntity(@NotNull BlockEntityType<? extends RecipeMachineBlockEntity<I, R>> type, @NotNull BlockPos pos, BlockState state, @NotNull RecipeType<R> recipeType,
9797
StorageSpec spec) {
9898
super(type, pos, state, spec);
9999
this.recipeType = recipeType;
@@ -106,7 +106,7 @@ protected RecipeMachineBlockEntity(@NotNull BlockEntityType<? extends RecipeMach
106106
* @return The crafting inventory of the machine.
107107
*/
108108
@Contract(pure = true)
109-
protected abstract @NotNull C craftingInv();
109+
protected abstract @NotNull I craftingInv();
110110

111111
/**
112112
* Inserts the active recipe's output into the machine's inventory.

src/main/java/dev/galacticraft/machinelib/api/gametest/RecipeGameTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
import net.minecraft.gametest.framework.GameTestGenerator;
3131
import net.minecraft.gametest.framework.GameTestHelper;
3232
import net.minecraft.gametest.framework.TestFunction;
33-
import net.minecraft.world.Container;
3433
import net.minecraft.world.item.Items;
3534
import net.minecraft.world.item.crafting.Recipe;
35+
import net.minecraft.world.item.crafting.RecipeInput;
3636
import net.minecraft.world.level.block.Block;
3737
import org.jetbrains.annotations.MustBeInvokedByOverriders;
3838
import org.jetbrains.annotations.NotNull;
@@ -42,26 +42,26 @@
4242
/**
4343
* Provides a base implementation for testing recipe-based machines.
4444
*
45-
* @param <C> the type of container used by the recipe
45+
* @param <I> the type of container used by the recipe
4646
* @param <R> the type of recipe used by the recipe
4747
* @param <Machine> the type of machine used in the game test
4848
* @see RecipeMachineBlockEntity
4949
*/
50-
public abstract class RecipeGameTest<C extends Container, R extends Recipe<C>, Machine extends RecipeMachineBlockEntity<C, R>> extends MachineGameTest<Machine> {
50+
public abstract class RecipeGameTest<I extends RecipeInput, R extends Recipe<I>, Machine extends RecipeMachineBlockEntity<I, R>> extends MachineGameTest<Machine> {
5151
protected final int recipeRuntime;
5252
private final int outputSlotsStart;
5353
private final int outputSlotsLength;
54-
private final List<IngredientSupplier<C, R, Machine>> conditions;
54+
private final List<IngredientSupplier<I, R, Machine>> conditions;
5555

56-
protected RecipeGameTest(@NotNull Block block, List<IngredientSupplier<C, R, Machine>> conditions, int recipeRuntime) {
56+
protected RecipeGameTest(@NotNull Block block, List<IngredientSupplier<I, R, Machine>> conditions, int recipeRuntime) {
5757
this(block, conditions, -1, 0, recipeRuntime);
5858
}
5959

60-
protected RecipeGameTest(@NotNull Block block, List<IngredientSupplier<C, R, Machine>> conditions, int outputSlot, int recipeRuntime) {
60+
protected RecipeGameTest(@NotNull Block block, List<IngredientSupplier<I, R, Machine>> conditions, int outputSlot, int recipeRuntime) {
6161
this(block, conditions, outputSlot, 1, recipeRuntime);
6262
}
6363

64-
protected RecipeGameTest(@NotNull Block block, List<IngredientSupplier<C, R, Machine>> conditions, int outputSlotsStart, int outputSlotsLength, int recipeRuntime) {
64+
protected RecipeGameTest(@NotNull Block block, List<IngredientSupplier<I, R, Machine>> conditions, int outputSlotsStart, int outputSlotsLength, int recipeRuntime) {
6565
super(block);
6666

6767
this.outputSlotsStart = outputSlotsStart;
@@ -84,7 +84,7 @@ protected void fillOutputSlots(@NotNull MachineItemStorage storage) {
8484
}
8585

8686
protected void fulfillRunConditions(Machine machine) {
87-
for (IngredientSupplier<C, R, Machine> condition : this.conditions) {
87+
for (IngredientSupplier<I, R, Machine> condition : this.conditions) {
8888
condition.supplyIngredient(machine);
8989
}
9090
}

src/main/java/dev/galacticraft/machinelib/api/gametest/recipe/IngredientSupplier.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
package dev.galacticraft.machinelib.api.gametest.recipe;
2424

2525
import dev.galacticraft.machinelib.api.block.entity.RecipeMachineBlockEntity;
26-
import net.minecraft.world.Container;
2726
import net.minecraft.world.item.crafting.Recipe;
27+
import net.minecraft.world.item.crafting.RecipeInput;
2828

2929
/**
3030
* A functional interface for fulfilling the run requirements of a machine.
3131
*
32-
* @param <C> the type of container
32+
* @param <I> the type of container
3333
* @param <R> the type of recipe
3434
* @param <Machine> the type of machine
3535
*/
3636
@FunctionalInterface
37-
public interface IngredientSupplier<C extends Container, R extends Recipe<C>, Machine extends RecipeMachineBlockEntity<C, R>> {
37+
public interface IngredientSupplier<I extends RecipeInput, R extends Recipe<I>, Machine extends RecipeMachineBlockEntity<I, R>> {
3838
/**
3939
* Fulfills a single run requirement of a machine (energy, item, fluid, etc.).
4040
* It is best to split requirements to test as many edge cases as possible.

src/main/java/dev/galacticraft/machinelib/api/menu/ConfiguredMenu.java

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import dev.galacticraft.machinelib.api.transfer.ResourceType;
3939
import dev.galacticraft.machinelib.api.util.BlockFace;
4040
import dev.galacticraft.machinelib.api.util.ItemStackUtil;
41-
import dev.galacticraft.machinelib.client.api.screen.Tank;
4241
import dev.galacticraft.machinelib.impl.compat.vanilla.RecipeOutputStorageSlot;
4342
import dev.galacticraft.machinelib.impl.compat.vanilla.StorageSlot;
4443
import net.minecraft.network.RegistryFriendlyByteBuf;

src/main/java/dev/galacticraft/machinelib/api/menu/RecipeMachineMenu.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@
2525
import dev.galacticraft.machinelib.api.block.entity.RecipeMachineBlockEntity;
2626
import net.minecraft.network.RegistryFriendlyByteBuf;
2727
import net.minecraft.server.level.ServerPlayer;
28-
import net.minecraft.world.Container;
2928
import net.minecraft.world.entity.player.Inventory;
3029
import net.minecraft.world.inventory.MenuType;
3130
import net.minecraft.world.item.crafting.Recipe;
3231
import net.minecraft.world.item.crafting.RecipeHolder;
32+
import net.minecraft.world.item.crafting.RecipeInput;
3333
import org.jetbrains.annotations.NotNull;
3434

3535
/**
3636
* A simple menu that keeps track of recipe progress
3737
*
3838
* @param <Machine> The type of machine block entity
3939
* @param <R> The type of recipe the machine processes
40-
* @param <C> The type of storage the recipe uses
40+
* @param <I> The type of storage the recipe uses
4141
* @see MachineMenu
4242
*/
43-
public abstract class RecipeMachineMenu<C extends Container, R extends Recipe<C>, Machine extends RecipeMachineBlockEntity<C, R>> extends MachineMenu<Machine> {
43+
public abstract class RecipeMachineMenu<I extends RecipeInput, R extends Recipe<I>, Machine extends RecipeMachineBlockEntity<I, R>> extends MachineMenu<Machine> {
4444
/**
4545
* The amount of progress the machine has made in crafting a recipe.
4646
* Counts from zero to {@link #maxProgress}, if {@link #maxProgress} > 0.
@@ -59,7 +59,7 @@ public abstract class RecipeMachineMenu<C extends Container, R extends Recipe<C>
5959
* @param player The player who is interacting with this menu.
6060
* @param machine The machine this menu is for.
6161
*/
62-
public RecipeMachineMenu(MenuType<? extends RecipeMachineMenu<C, R, Machine>> type, int syncId, @NotNull ServerPlayer player, @NotNull Machine machine) {
62+
public RecipeMachineMenu(MenuType<? extends RecipeMachineMenu<I, R, Machine>> type, int syncId, @NotNull ServerPlayer player, @NotNull Machine machine) {
6363
super(type, syncId, player, machine);
6464
}
6565

@@ -71,7 +71,7 @@ public RecipeMachineMenu(MenuType<? extends RecipeMachineMenu<C, R, Machine>> ty
7171
* @param buf The data buffer containing the information needed to initialize the menu.
7272
* @param type The type of machine associated with this menu.
7373
*/
74-
protected RecipeMachineMenu(MenuType<? extends RecipeMachineMenu<C, R, Machine>> type, int syncId, @NotNull Inventory inventory, @NotNull RegistryFriendlyByteBuf buf) {
74+
protected RecipeMachineMenu(MenuType<? extends RecipeMachineMenu<I, R, Machine>> type, int syncId, @NotNull Inventory inventory, @NotNull RegistryFriendlyByteBuf buf) {
7575
super(type, syncId, inventory, buf);
7676
}
7777

src/main/java/dev/galacticraft/machinelib/client/api/screen/Tank.java src/main/java/dev/galacticraft/machinelib/api/menu/Tank.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* SOFTWARE.
2121
*/
2222

23-
package dev.galacticraft.machinelib.client.api.screen;
23+
package dev.galacticraft.machinelib.api.menu;
2424

2525
import com.google.common.base.Preconditions;
2626
import dev.galacticraft.machinelib.api.storage.slot.ResourceSlot;

src/main/java/dev/galacticraft/machinelib/client/api/screen/MachineScreen.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import dev.galacticraft.machinelib.api.machine.configuration.IOFace;
3333
import dev.galacticraft.machinelib.api.machine.configuration.RedstoneMode;
3434
import dev.galacticraft.machinelib.api.menu.MachineMenu;
35+
import dev.galacticraft.machinelib.api.menu.Tank;
3536
import dev.galacticraft.machinelib.api.transfer.InputType;
3637
import dev.galacticraft.machinelib.api.transfer.ResourceType;
3738
import dev.galacticraft.machinelib.api.util.BlockFace;
@@ -92,10 +93,10 @@
9293
public class MachineScreen<Machine extends MachineBlockEntity, Menu extends MachineMenu<Machine>> extends AbstractContainerScreen<Menu> {
9394
private static final ItemStack REDSTONE = new ItemStack(Items.REDSTONE);
9495
private static final ItemStack GUNPOWDER = new ItemStack(Items.GUNPOWDER);
95-
private static final ItemStack UNLIT_TORCH = new ItemStack(getOptionalItem(new ResourceLocation("galacticraft", "unlit_torch"), Items.TORCH));
96+
private static final ItemStack UNLIT_TORCH = new ItemStack(getOptionalItem(ResourceLocation.fromNamespaceAndPath("galacticraft", "unlit_torch"), Items.TORCH));
9697
private static final ItemStack REDSTONE_TORCH = new ItemStack(Items.REDSTONE_TORCH);
97-
private static final ItemStack WRENCH = new ItemStack(getOptionalItem(new ResourceLocation("galacticraft", "standard_wrench"), Items.HOPPER));
98-
private static final ItemStack ALUMINUM_WIRE = new ItemStack(getOptionalItem(new ResourceLocation("galacticraft", "aluminum_wire"), Items.MOJANG_BANNER_PATTERN));
98+
private static final ItemStack WRENCH = new ItemStack(getOptionalItem(ResourceLocation.fromNamespaceAndPath("galacticraft", "standard_wrench"), Items.HOPPER));
99+
private static final ItemStack ALUMINUM_WIRE = new ItemStack(getOptionalItem(ResourceLocation.fromNamespaceAndPath("galacticraft", "aluminum_wire"), Items.MOJANG_BANNER_PATTERN));
99100
private static final ItemStack IRON_CHESTPLATE = new ItemStack(Items.IRON_CHESTPLATE);
100101

101102
private static final int SPACING = 4;

src/main/java/dev/galacticraft/machinelib/client/impl/MachineLibClient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void onInitializeClient() {
5959
throw new RuntimeException(ex);
6060
}
6161
String path = entry.getKey().getPath();
62-
return new Pair<>(new ResourceLocation(entry.getKey().getNamespace(), path.substring(path.indexOf('/') + 1, path.lastIndexOf('.'))), element);
62+
return new Pair<>(ResourceLocation.fromNamespaceAndPath(entry.getKey().getNamespace(), path.substring(path.indexOf('/') + 1, path.lastIndexOf('.'))), element);
6363
}, executor))
6464
.map(CompletableFuture::join)
6565
.filter(pair -> pair.getSecond().isJsonObject() && pair.getSecond().getAsJsonObject().has(MachineModelRegistry.MARKER))

0 commit comments

Comments
 (0)