Bugfixes
This commit is contained in:
@@ -7,12 +7,12 @@ import com.refinedmods.refinedstorage.api.network.INetwork;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.handler.IItemGridHandler;
|
||||
import com.refinedmods.refinedstorage.api.network.security.Permission;
|
||||
import com.refinedmods.refinedstorage.api.storage.cache.IStorageCache;
|
||||
import com.refinedmods.refinedstorage.api.util.Action;
|
||||
import com.refinedmods.refinedstorage.api.util.IComparer;
|
||||
import com.refinedmods.refinedstorage.api.util.StackListEntry;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import com.refinedmods.refinedstorage.apiimpl.autocrafting.preview.ErrorCraftingPreviewElement;
|
||||
import com.refinedmods.refinedstorage.apiimpl.storage.cache.ItemStorageCache;
|
||||
import com.refinedmods.refinedstorage.container.GridContainer;
|
||||
import com.refinedmods.refinedstorage.network.grid.GridCraftingPreviewResponseMessage;
|
||||
import com.refinedmods.refinedstorage.network.grid.GridCraftingStartResponseMessage;
|
||||
@@ -105,14 +105,13 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
took.setCount(remainder.getCount());
|
||||
}
|
||||
}
|
||||
if (!took.isEmpty()) {
|
||||
if (ItemHandlerHelper.insertItemStacked(playerInventory.get(), took, true).isEmpty()) {
|
||||
|
||||
if (!took.isEmpty() && ItemHandlerHelper.insertItemStacked(playerInventory.get(), took, true).isEmpty()) {
|
||||
took = network.extractItem(item, size, Action.PERFORM);
|
||||
|
||||
ItemHandlerHelper.insertItemStacked(playerInventory.get(), took, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
took = network.extractItem(item, size, Action.PERFORM);
|
||||
|
||||
@@ -272,15 +271,20 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
|
||||
if (shift) { // shift
|
||||
flags |= EXTRACT_SHIFT;
|
||||
|
||||
if (!stackInSlot.isEmpty()) {
|
||||
if (up) { // scroll up
|
||||
player.inventory.setInventorySlotContents(slot, gridHandler.onInsert(player, stackInSlot, true));
|
||||
} else { // scroll down
|
||||
gridHandler.onExtract(player, stackInSlot, slot, flags);
|
||||
}
|
||||
}
|
||||
} else { //ctrl
|
||||
if (up) { // scroll up
|
||||
if (!stackOnCursor.isEmpty()) {
|
||||
gridHandler.onInsert(player, stackOnCursor, true);
|
||||
player.updateHeldItem();
|
||||
}
|
||||
} else { //scroll down
|
||||
if (stackOnCursor.isEmpty()) {
|
||||
gridHandler.onExtract(player, stackInSlot, -1, flags);
|
||||
@@ -312,7 +316,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
if (shift && id != null) {
|
||||
flags |= EXTRACT_SHIFT;
|
||||
if (up) { //scroll up, insert hovering stack pulled from Inventory
|
||||
ItemStorageCache cache = (ItemStorageCache) grid.getStorageCache();
|
||||
IStorageCache<ItemStack> cache = grid.getStorageCache();
|
||||
if (cache == null || cache.getList().get(id) == null) {
|
||||
return;
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.container.GridContainer;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -12,7 +13,7 @@ public class GridItemGridScrollMessage {
|
||||
private final boolean shift;
|
||||
private final boolean up;
|
||||
|
||||
public GridItemGridScrollMessage(UUID id, boolean shift, boolean up) {
|
||||
public GridItemGridScrollMessage(@Nullable UUID id, boolean shift, boolean up) {
|
||||
this.id = id;
|
||||
this.shift = shift;
|
||||
this.up = up;
|
||||
|
@@ -529,7 +529,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
}
|
||||
|
||||
if (isOverInventory(x - guiLeft, y - guiTop)) {
|
||||
if (grid.getGridType() != GridType.FLUID && hoveredSlot != null) {
|
||||
if (grid.getGridType() != GridType.FLUID && hoveredSlot != null && hoveredSlot.getHasStack()) {
|
||||
RS.NETWORK_HANDLER.sendToServer(new GridItemInventoryScrollMessage(hoveredSlot.getSlotIndex(), hasShiftDown(), delta > 0));
|
||||
}
|
||||
} else if (isOverSlotArea(x - guiLeft, y - guiTop)) {
|
||||
@@ -599,7 +599,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
}
|
||||
|
||||
public boolean canSort() {
|
||||
return doSort || !hasShiftDown() && !hasControlDown();
|
||||
return doSort || (!hasShiftDown() && !hasControlDown());
|
||||
}
|
||||
|
||||
public static List<IGridSorter> getSorters() {
|
||||
|
Reference in New Issue
Block a user