Skip to content

Commit

Permalink
Merge pull request #3633 from refinedmods/release/1.13.0-beta.2
Browse files Browse the repository at this point in the history
Release v1.13.0-beta.2
  • Loading branch information
raoulvdberge authored Feb 16, 2024
2 parents 73da326 + a7474e6 commit 2828303
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ public void onDirectionChanged(Direction direction) {
if (network != null) {
network.getCraftingManager().invalidate();
}

level.invalidateCapabilities(pos);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -142,7 +141,6 @@ private void moveItems(GridContainerMenu gridContainer, Object recipe, IRecipeSl

private void move(IRecipeSlotsView recipeSlotsView) {
List<List<ItemStack>> inputs = recipeSlotsView.getSlotViews(RecipeIngredientRole.INPUT).stream().map(view -> {

//Creating a mutable list
List<ItemStack> stacks = view.getItemStacks().collect(Collectors.toCollection(ArrayList::new));

Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<ItemStack>> inputs;
private final ItemStack[][] recipe;

public GridTransferMessage() {
}

public GridTransferMessage(List<List<ItemStack>> 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) {
Expand All @@ -56,10 +49,9 @@ public static void handle(GridTransferMessage message, PlayPayloadContext ctx) {

@Override
public void write(FriendlyByteBuf buf) {
buf.writeInt(inputs.size());
for (List<ItemStack> 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);
}
Expand Down

0 comments on commit 2828303

Please sign in to comment.