From 3e687f441ed135ff5161acb21c4732d4cd01bab7 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 16 Feb 2024 15:01:50 +0100 Subject: [PATCH 1/4] fix: invalidate caps --- .../refinedstorage/apiimpl/network/node/CrafterNetworkNode.java | 2 ++ 1 file changed, 2 insertions(+) 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 From 6959fbc0408bd03fb0d5aee15317586d2ecdc336 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 16 Feb 2024 15:03:32 +0100 Subject: [PATCH 2/4] fix: jei transfer in the pattern grid wrongly choosing processing mode --- CHANGELOG.md | 4 ++++ .../integration/jei/GridRecipeTransferHandler.java | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb1777a87c..5dec899fae 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Fixed JEI transfer in the Pattern Grid wrongly choosing "Processing" mode. + ## [1.13.0-beta.1] - 2024-02-12 ### Added 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..2fd061fadd 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)); From 9888c0b2e9bb8a969aafe6448913e5fcc934ce56 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 16 Feb 2024 15:03:52 +0100 Subject: [PATCH 3/4] fix: jei transfer not working in single player --- CHANGELOG.md | 1 + .../block/NetworkNodeBlock.java | 1 - .../jei/GridRecipeTransferHandler.java | 7 ++++- .../network/grid/GridTransferMessage.java | 28 +++++++------------ 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dec899fae..0118a8dd54 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### 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 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 2fd061fadd..2260b41d8f 100644 --- a/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java +++ b/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java @@ -156,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); } From a7474e6d95f6c0945c33ad1a236507dd895de80f Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 16 Feb 2024 14:09:17 +0000 Subject: [PATCH 4/4] chore: prepare release v1.13.0-beta.2 --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0118a8dd54..0677c8390b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ 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. @@ -3530,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