diff --git a/CHANGELOG.md b/CHANGELOG.md index cb1777a87c..0677c8390b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.13.0-beta.2] - 2024-02-16 + +### Fixed + +- Fixed JEI transfer in the Pattern Grid wrongly choosing "Processing" mode. +- Fixed JEI transfer not working in single player. + ## [1.13.0-beta.1] - 2024-02-12 ### Added @@ -3525,7 +3532,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Internal test release. -[Unreleased]: https://github.com/refinedmods/refinedstorage/compare/v1.13.0-beta.1...HEAD +[Unreleased]: https://github.com/refinedmods/refinedstorage/compare/v1.13.0-beta.2...HEAD + +[1.13.0-beta.2]: https://github.com/refinedmods/refinedstorage/compare/v1.13.0-beta.1...v1.13.0-beta.2 [1.13.0-beta.1]: https://github.com/refinedmods/refinedstorage/compare/v1.12.4...v1.13.0-beta.1 diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/CrafterNetworkNode.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/CrafterNetworkNode.java index 3369509978..df92b43a36 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/CrafterNetworkNode.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/CrafterNetworkNode.java @@ -156,6 +156,8 @@ public void onDirectionChanged(Direction direction) { if (network != null) { network.getCraftingManager().invalidate(); } + + level.invalidateCapabilities(pos); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/NetworkNodeBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/NetworkNodeBlock.java index ee18e2dcbb..f089d8fff4 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/NetworkNodeBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/NetworkNodeBlock.java @@ -46,7 +46,6 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b } @Override - @SuppressWarnings("deprecation") public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) { if (state.getBlock() != newState.getBlock()) { BlockEntity blockEntity = level.getBlockEntity(pos); diff --git a/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java b/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java index f5441ca3c3..2260b41d8f 100644 --- a/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java +++ b/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java @@ -19,7 +19,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; import net.neoforged.neoforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; @@ -128,9 +128,8 @@ private void moveItems(GridContainerMenu gridContainer, Object recipe, IRecipeSl this.lastTransferTimeMs = System.currentTimeMillis(); boolean isCraftingRecipe = false; - if(recipe instanceof Recipe castRecipe) - { - isCraftingRecipe = castRecipe.getType() == net.minecraft.world.item.crafting.RecipeType.CRAFTING; + if (recipe instanceof RecipeHolder castRecipe) { + isCraftingRecipe = castRecipe.value().getType() == net.minecraft.world.item.crafting.RecipeType.CRAFTING; } if (gridContainer.getGrid().getGridType() == GridType.PATTERN && !isCraftingRecipe) { @@ -142,7 +141,6 @@ private void moveItems(GridContainerMenu gridContainer, Object recipe, IRecipeSl private void move(IRecipeSlotsView recipeSlotsView) { List> inputs = recipeSlotsView.getSlotViews(RecipeIngredientRole.INPUT).stream().map(view -> { - //Creating a mutable list List stacks = view.getItemStacks().collect(Collectors.toCollection(ArrayList::new)); @@ -158,7 +156,12 @@ private void move(IRecipeSlotsView recipeSlotsView) { return stacks; }).toList(); - RS.NETWORK_HANDLER.sendToServer(new GridTransferMessage(inputs)); + final ItemStack[][] inputsArray = new ItemStack[inputs.size()][]; + for (int i = 0; i < inputs.size(); i++) { + inputsArray[i] = inputs.get(i).toArray(new ItemStack[0]); + } + + RS.NETWORK_HANDLER.sendToServer(new GridTransferMessage(inputsArray)); } private void moveForProcessing(IRecipeSlotsView recipeLayout, GridContainerMenu gridContainer, Player player) { diff --git a/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java b/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java index 45c08c4e0a..65911f9299 100644 --- a/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java +++ b/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java @@ -16,30 +16,23 @@ public class GridTransferMessage implements CustomPacketPayload { public static final ResourceLocation ID = new ResourceLocation(RS.ID, "grid_transfer"); - private ItemStack[][] recipe; - private List> inputs; + private final ItemStack[][] recipe; - public GridTransferMessage() { - } - - public GridTransferMessage(List> inputs) { - this.inputs = inputs; + public GridTransferMessage(final ItemStack[][] recipe) { + this.recipe = recipe; } public static GridTransferMessage decode(FriendlyByteBuf buf) { - GridTransferMessage msg = new GridTransferMessage(); int slots = buf.readInt(); - msg.recipe = new ItemStack[slots][]; + final ItemStack[][] recipe = new ItemStack[slots][]; for (int i = 0; i < slots; i++) { int numberOfIngredients = buf.readInt(); - msg.recipe[i] = new ItemStack[numberOfIngredients]; - + recipe[i] = new ItemStack[numberOfIngredients]; for (int j = 0; j < numberOfIngredients; j++) { - msg.recipe[i][j] = StackUtils.readItemStack(buf); + recipe[i][j] = StackUtils.readItemStack(buf); } } - - return msg; + return new GridTransferMessage(recipe); } public static void handle(GridTransferMessage message, PlayPayloadContext ctx) { @@ -56,10 +49,9 @@ public static void handle(GridTransferMessage message, PlayPayloadContext ctx) { @Override public void write(FriendlyByteBuf buf) { - buf.writeInt(inputs.size()); - for (List stacks : inputs) { - buf.writeInt(stacks.size()); - + buf.writeInt(recipe.length); + for (ItemStack[] stacks : recipe) { + buf.writeInt(stacks.length); for (ItemStack possibleStack : stacks) { StackUtils.writeItemStack(buf, possibleStack); }