Fix issue #43
This commit is contained in:
@@ -6,7 +6,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import refinedstorage.RefinedStorageUtils;
|
||||
import refinedstorage.item.ItemPattern;
|
||||
|
||||
public class CraftingPattern {
|
||||
@@ -52,33 +51,6 @@ public class CraftingPattern {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public boolean comparePattern(World world, CraftingPattern otherPattern, int flags) {
|
||||
if (otherPattern == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (otherPattern.getInputs().length != inputs.length ||
|
||||
otherPattern.getOutputs().length != outputs.length ||
|
||||
otherPattern.isProcessing() != processing ||
|
||||
!otherPattern.getCrafter(world).getPos().equals(getCrafter(world).getPos())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inputs.length; ++i) {
|
||||
if (!RefinedStorageUtils.compareStack(inputs[i], otherPattern.getInputs()[i], flags)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < outputs.length; ++i) {
|
||||
if (!RefinedStorageUtils.compareStack(outputs[i], otherPattern.getOutputs()[i], flags)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setBoolean(ItemPattern.NBT_PROCESSING, processing);
|
||||
|
||||
|
@@ -119,14 +119,20 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
|
||||
public void onCrafted(ContainerGrid container) {
|
||||
if (!worldObj.isRemote) {
|
||||
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
|
||||
ItemStack slot = craftingInventory.getStackInSlot(i);
|
||||
ItemStack[] remainder = CraftingManager.getInstance().func_180303_b(craftingInventory, worldObj);
|
||||
|
||||
if (slot != null) {
|
||||
if (slot.stackSize == 1 && isConnected()) {
|
||||
craftingInventory.setInventorySlotContents(i, controller.take(slot.copy()));
|
||||
} else {
|
||||
craftingInventory.decrStackSize(i, 1);
|
||||
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
|
||||
if (remainder[i] != null) {
|
||||
craftingInventory.setInventorySlotContents(i, remainder[i].copy());
|
||||
} else {
|
||||
ItemStack slot = craftingInventory.getStackInSlot(i);
|
||||
|
||||
if (slot != null) {
|
||||
if (slot.stackSize == 1 && isConnected()) {
|
||||
craftingInventory.setInventorySlotContents(i, controller.take(slot.copy()));
|
||||
} else {
|
||||
craftingInventory.decrStackSize(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user