Fixed Regulator mode item and fluid counts not saving properly. Fixes #2517
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# Refined Storage Changelog
|
# Refined Storage Changelog
|
||||||
|
|
||||||
|
### 1.8.7
|
||||||
|
- Fixed Regulator mode item and fluid counts not saving properly (raoulvdberge)
|
||||||
|
|
||||||
### 1.8.6
|
### 1.8.6
|
||||||
- Fixed Constructor duplication bug (Darkere)
|
- Fixed Constructor duplication bug (Darkere)
|
||||||
|
|
||||||
|
@@ -61,8 +61,11 @@ public class FluidInventory {
|
|||||||
|
|
||||||
fluids[slot] = stack;
|
fluids[slot] = stack;
|
||||||
|
|
||||||
listeners.forEach(l -> l.onChanged(this, slot, false));
|
onChanged(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChanged(int slot) {
|
||||||
|
listeners.forEach(l -> l.onChanged(this, slot, false));
|
||||||
updateEmptyState();
|
updateEmptyState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,6 +53,10 @@ public class BaseItemHandler extends ItemStackHandler {
|
|||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
|
onChanged(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChanged(int slot) {
|
||||||
this.empty = stacks.stream().allMatch(ItemStack::isEmpty);
|
this.empty = stacks.stream().allMatch(ItemStack::isEmpty);
|
||||||
this.listeners.forEach(l -> l.onChanged(this, slot, reading));
|
this.listeners.forEach(l -> l.onChanged(this, slot, reading));
|
||||||
}
|
}
|
||||||
|
@@ -3,12 +3,14 @@ package com.refinedmods.refinedstorage.network;
|
|||||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||||
import com.refinedmods.refinedstorage.container.slot.filter.FilterSlot;
|
import com.refinedmods.refinedstorage.container.slot.filter.FilterSlot;
|
||||||
import com.refinedmods.refinedstorage.container.slot.legacy.LegacyFilterSlot;
|
import com.refinedmods.refinedstorage.container.slot.legacy.LegacyFilterSlot;
|
||||||
|
import com.refinedmods.refinedstorage.inventory.item.BaseItemHandler;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.inventory.container.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraftforge.fml.network.NetworkEvent;
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@@ -46,6 +48,16 @@ public class SetFilterSlotMessage {
|
|||||||
// Avoid resetting allowed tag list in the pattern grid.
|
// Avoid resetting allowed tag list in the pattern grid.
|
||||||
if (API.instance().getComparer().isEqualNoQuantity(slot.getStack(), message.stack)) {
|
if (API.instance().getComparer().isEqualNoQuantity(slot.getStack(), message.stack)) {
|
||||||
slot.getStack().setCount(message.stack.getCount());
|
slot.getStack().setCount(message.stack.getCount());
|
||||||
|
|
||||||
|
if (slot instanceof FilterSlot) {
|
||||||
|
IItemHandler itemHandler = ((FilterSlot) slot).getItemHandler();
|
||||||
|
|
||||||
|
if (itemHandler instanceof BaseItemHandler) {
|
||||||
|
((BaseItemHandler) itemHandler).onChanged(slot.getSlotIndex());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
slot.inventory.markDirty();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
slot.putStack(message.stack);
|
slot.putStack(message.stack);
|
||||||
}
|
}
|
||||||
|
@@ -47,6 +47,7 @@ public class SetFluidFilterSlotMessage {
|
|||||||
// Avoid resetting allowed tag list in the pattern grid.
|
// Avoid resetting allowed tag list in the pattern grid.
|
||||||
if (API.instance().getComparer().isEqual(fluidFilterSlot.getFluidInventory().getFluid(slot.getSlotIndex()), message.stack, IComparer.COMPARE_NBT)) {
|
if (API.instance().getComparer().isEqual(fluidFilterSlot.getFluidInventory().getFluid(slot.getSlotIndex()), message.stack, IComparer.COMPARE_NBT)) {
|
||||||
fluidFilterSlot.getFluidInventory().getFluid(slot.getSlotIndex()).setAmount(message.stack.getAmount());
|
fluidFilterSlot.getFluidInventory().getFluid(slot.getSlotIndex()).setAmount(message.stack.getAmount());
|
||||||
|
fluidFilterSlot.getFluidInventory().onChanged(slot.getSlotIndex());
|
||||||
} else {
|
} else {
|
||||||
fluidFilterSlot.getFluidInventory().setFluid(slot.getSlotIndex(), message.stack);
|
fluidFilterSlot.getFluidInventory().setFluid(slot.getSlotIndex(), message.stack);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user