Fixed not being able to start autocrafting, fixes #714

This commit is contained in:
Raoul Van den Berge
2016-12-06 16:09:44 +01:00
parent 0c47ff0813
commit ac212dcf86
3 changed files with 20 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
# Refined Storage Changelog
### 1.3.3
- Updated Forge to 2188 (raoulvdberge)
- Fixed not being able to start a crafting task (raoulvdberge)
### 1.3.2
- Fixed being able to exceed max stack size while shift clicking (raoulvdberge)
- Fixed Wrench clearing NBT data when reset causing problems with Morph O Tool (raoulvdberge)

View File

@@ -84,8 +84,9 @@ public final class RSUtils {
buf.writeInt(Item.getIdFromItem(stack.getItem()));
buf.writeInt(stack.getCount());
buf.writeInt(stack.getItemDamage());
if (network != null) {
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
if (network != null) {
buf.writeInt(API.instance().getItemStackHashCode(stack));
buf.writeBoolean(network.hasPattern(stack));
buf.writeBoolean(displayCraftText);

View File

@@ -2,10 +2,12 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
import com.raoulvdberge.refinedstorage.api.util.IStackList;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task.CraftingTask;
import com.raoulvdberge.refinedstorage.apiimpl.network.item.NetworkItemWirelessCraftingMonitor;
@@ -142,7 +144,18 @@ public class ItemGridHandler implements IItemGridHandler {
@Override
public void onCraftingPreviewRequested(EntityPlayerMP player, int hash, int quantity) {
ItemStack stack = network.getItemStorageCache().getList().get(hash);
IStackList<ItemStack> cache = network.getItemStorageCache().getList().copy();
// Since patterns aren't in the cache by default anymore, we add them here manually again
for (ICraftingPattern pattern : network.getPatterns()) {
for (ItemStack output : pattern.getOutputs()) {
if (output != null) {
cache.add(output);
}
}
}
ItemStack stack = cache.get(hash);
if (stack != null) {
Thread calculationThread = new Thread(() -> {