This commit is contained in:
Raoul Van den Berge
2016-05-14 23:31:17 +02:00
parent 010bdbb232
commit ea192d9f93
2 changed files with 13 additions and 35 deletions

View File

@@ -6,7 +6,6 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.item.ItemPattern; import refinedstorage.item.ItemPattern;
public class CraftingPattern { public class CraftingPattern {
@@ -52,33 +51,6 @@ public class CraftingPattern {
return outputs; 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) { public void writeToNBT(NBTTagCompound tag) {
tag.setBoolean(ItemPattern.NBT_PROCESSING, processing); tag.setBoolean(ItemPattern.NBT_PROCESSING, processing);

View File

@@ -119,7 +119,12 @@ public class TileGrid extends TileMachine implements IGrid {
public void onCrafted(ContainerGrid container) { public void onCrafted(ContainerGrid container) {
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
ItemStack[] remainder = CraftingManager.getInstance().func_180303_b(craftingInventory, worldObj);
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) { for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
if (remainder[i] != null) {
craftingInventory.setInventorySlotContents(i, remainder[i].copy());
} else {
ItemStack slot = craftingInventory.getStackInSlot(i); ItemStack slot = craftingInventory.getStackInSlot(i);
if (slot != null) { if (slot != null) {
@@ -130,6 +135,7 @@ public class TileGrid extends TileMachine implements IGrid {
} }
} }
} }
}
onCraftingMatrixChanged(); onCraftingMatrixChanged();