Fixed exporter crafting upgrades taking priority over other tasks, should fix #198

This commit is contained in:
Raoul Van den Berge
2016-07-18 01:09:33 +02:00
parent 35f6714cef
commit 40b3d47c42
4 changed files with 19 additions and 4 deletions

View File

@@ -1,5 +1,10 @@
# Refined Storage Changelog # Refined Storage Changelog
### 0.8.11
**Bugfixes**
- Fixed minor dupe bug with JEI transferring
- Fixed exporter crafting upgrades taking priority over other tasks
### 0.8.10 ### 0.8.10
**Bugfixes** **Bugfixes**
- Fixed not being able to get some items out of Grid - Fixed not being able to get some items out of Grid

View File

@@ -2,6 +2,7 @@ package refinedstorage.apiimpl.autocrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import refinedstorage.RefinedStorageUtils; import refinedstorage.RefinedStorageUtils;
import refinedstorage.api.autocrafting.ICraftingPattern; import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
@@ -9,8 +10,13 @@ import refinedstorage.api.network.INetworkMaster;
public class CraftingTaskScheduler { public class CraftingTaskScheduler {
private static final String NBT_SCHEDULED = "CraftingTaskScheduled"; private static final String NBT_SCHEDULED = "CraftingTaskScheduled";
private TileEntity tile;
private ItemStack scheduledItem; private ItemStack scheduledItem;
public CraftingTaskScheduler(TileEntity tile) {
this.tile = tile;
}
public boolean canSchedule(int compare, ItemStack item) { public boolean canSchedule(int compare, ItemStack item) {
return scheduledItem == null || !RefinedStorageUtils.compareStack(scheduledItem, item, compare); return scheduledItem == null || !RefinedStorageUtils.compareStack(scheduledItem, item, compare);
} }
@@ -21,12 +27,16 @@ public class CraftingTaskScheduler {
if (pattern != null) { if (pattern != null) {
scheduledItem = item; scheduledItem = item;
network.addCraftingTask(network.createCraftingTask(pattern)); network.addCraftingTaskAsLast(network.createCraftingTask(pattern));
tile.markDirty();
} }
} }
public void resetSchedule() { public void resetSchedule() {
this.scheduledItem = null; scheduledItem = null;
tile.markDirty();
} }
public void writeToNBT(NBTTagCompound tag) { public void writeToNBT(NBTTagCompound tag) {

View File

@@ -46,7 +46,7 @@ public class TileConstructor extends TileNode implements ICompareConfig {
private int compare = 0; private int compare = 0;
private IBlockState block; private IBlockState block;
private CraftingTaskScheduler scheduler = new CraftingTaskScheduler(); private CraftingTaskScheduler scheduler = new CraftingTaskScheduler(this);
@Override @Override
public int getEnergyUsage() { public int getEnergyUsage() {

View File

@@ -33,7 +33,7 @@ public class TileExporter extends TileNode implements ICompareConfig {
private int compare = 0; private int compare = 0;
private CraftingTaskScheduler scheduler = new CraftingTaskScheduler(); private CraftingTaskScheduler scheduler = new CraftingTaskScheduler(this);
@Override @Override
public int getEnergyUsage() { public int getEnergyUsage() {