Fixed Interface with Crafting Upgrade being stuck if an earlier item configuration has missing items or fluids. Fixes #2114
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# Refined Storage Changelog
|
||||
|
||||
### 1.6.13
|
||||
- Fixed Interface with Crafting Upgrade being stuck if an earlier item configuration has missing items or fluids (raoulvdberge)
|
||||
|
||||
### 1.6.12
|
||||
- Increased the speed of autocrafting (raoulvdberge)
|
||||
- Fixed External Storage sending storage updates when it is disabled (raoulvdberge)
|
||||
|
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.api.autocrafting;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorListener;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -78,7 +77,7 @@ public interface ICraftingManager {
|
||||
ICraftingPatternChainList createPatternChainList();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #request(INetworkNode, ItemStack, int)}
|
||||
* @deprecated Use {@link #request(Object, ItemStack, int)}
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
@@ -87,7 +86,7 @@ public interface ICraftingManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #request(INetworkNode, FluidStack, int)}
|
||||
* @deprecated Use {@link #request(Object, FluidStack, int)}
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
@@ -104,7 +103,7 @@ public interface ICraftingManager {
|
||||
* @return the crafting task created, or null if no task is created
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingTask request(INetworkNode source, ItemStack stack, int amount);
|
||||
ICraftingTask request(Object source, ItemStack stack, int amount);
|
||||
|
||||
/**
|
||||
* Schedules a crafting task if the task isn't scheduled yet.
|
||||
@@ -115,7 +114,7 @@ public interface ICraftingManager {
|
||||
* @return the crafting task created, or null if no task is created
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingTask request(INetworkNode source, FluidStack stack, int amount);
|
||||
ICraftingTask request(Object source, FluidStack stack, int amount);
|
||||
|
||||
/**
|
||||
* Tracks an incoming stack.
|
||||
|
@@ -44,7 +44,7 @@ public class CraftingManager implements ICraftingManager {
|
||||
private List<UUID> tasksToCancel = new ArrayList<>();
|
||||
private NBTTagList tasksToRead;
|
||||
|
||||
private Map<INetworkNode, Long> throttledRequesters = new HashMap<>();
|
||||
private Map<Object, Long> throttledRequesters = new HashMap<>();
|
||||
|
||||
private Set<ICraftingMonitorListener> listeners = new HashSet<>();
|
||||
|
||||
@@ -228,7 +228,7 @@ public class CraftingManager implements ICraftingManager {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICraftingTask request(INetworkNode source, ItemStack stack, int amount) {
|
||||
public ICraftingTask request(Object source, ItemStack stack, int amount) {
|
||||
if (isThrottled(source)) {
|
||||
return null;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class CraftingManager implements ICraftingManager {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ICraftingTask request(INetworkNode source, FluidStack stack, int amount) {
|
||||
public ICraftingTask request(Object source, FluidStack stack, int amount) {
|
||||
if (isThrottled(source)) {
|
||||
return null;
|
||||
}
|
||||
@@ -298,22 +298,22 @@ public class CraftingManager implements ICraftingManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void throttle(@Nullable INetworkNode node) {
|
||||
OneSixMigrationHelper.removalHook(); // Remove @Nullable node
|
||||
private void throttle(@Nullable Object source) {
|
||||
OneSixMigrationHelper.removalHook(); // Remove @Nullable source
|
||||
|
||||
if (node != null) {
|
||||
throttledRequesters.put(node, MinecraftServer.getCurrentTimeMillis());
|
||||
if (source != null) {
|
||||
throttledRequesters.put(source, MinecraftServer.getCurrentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isThrottled(@Nullable INetworkNode node) {
|
||||
OneSixMigrationHelper.removalHook(); // Remove @Nullable node
|
||||
private boolean isThrottled(@Nullable Object source) {
|
||||
OneSixMigrationHelper.removalHook(); // Remove @Nullable source
|
||||
|
||||
if (node == null) {
|
||||
if (source == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Long throttledSince = throttledRequesters.get(node);
|
||||
Long throttledSince = throttledRequesters.get(source);
|
||||
if (throttledSince == null) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
||||
|
||||
if (took == null) {
|
||||
if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
||||
network.getCraftingManager().request(this, slot, stackSize);
|
||||
network.getCraftingManager().request(new SlottedCraftingRequest(this, filterSlot), slot, stackSize);
|
||||
}
|
||||
} else if (ItemHandlerHelper.insertItem(handler, took, true).isEmpty()) {
|
||||
took = network.extractItem(slot, Math.min(slot.getMaxStackSize(), stackSize), compare, Action.PERFORM);
|
||||
|
@@ -119,7 +119,7 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
||||
delta -= result == null ? 0 : result.getCount();
|
||||
|
||||
if (delta > 0 && upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
||||
network.getCraftingManager().request(this, wanted, delta);
|
||||
network.getCraftingManager().request(new SlottedCraftingRequest(this, i), wanted, delta);
|
||||
}
|
||||
} else if (delta < 0) {
|
||||
ItemStack remainder = network.insertItemTracked(got, Math.abs(delta));
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class SlottedCraftingRequest {
|
||||
private INetworkNode node;
|
||||
private int slot;
|
||||
|
||||
public SlottedCraftingRequest(INetworkNode node, int slot) {
|
||||
this.node = node;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SlottedCraftingRequest that = (SlottedCraftingRequest) o;
|
||||
|
||||
return slot == that.slot && Objects.equals(node, that.node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(node, slot);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user