This commit is contained in:
Raoul Van den Berge
2016-06-15 22:05:03 +02:00
parent 06fdcc88e7
commit 410d1613d2
4 changed files with 10 additions and 25 deletions

View File

@@ -65,25 +65,13 @@ public class ContainerGrid extends ContainerBase {
return grid; return grid;
} }
@Override public void sendCraftingSlots() {
public void detectAndSendChanges() {
for (int i = 0; i < inventorySlots.size(); ++i) { for (int i = 0; i < inventorySlots.size(); ++i) {
if (inventorySlots.get(i) instanceof SlotGridCrafting || inventorySlots.get(i) == craftingResultSlot) { Slot slot = inventorySlots.get(i);
if (slot instanceof SlotGridCrafting || slot == craftingResultSlot) {
for (int j = 0; j < listeners.size(); ++j) { for (int j = 0; j < listeners.size(); ++j) {
listeners.get(j).sendSlotContents(this, i, inventorySlots.get(i).getStack()); listeners.get(j).sendSlotContents(this, i, slot.getStack());
}
} else {
ItemStack current = inventorySlots.get(i).getStack();
ItemStack cached = inventoryItemStacks.get(i);
if (!ItemStack.areItemStacksEqual(cached, current)) {
cached = current == null ? null : current.copy();
inventoryItemStacks.set(i, cached);
for (int j = 0; j < listeners.size(); ++j) {
listeners.get(j).sendSlotContents(this, i, cached);
}
} }
} }
} }
@@ -100,11 +88,7 @@ public class ContainerGrid extends ContainerBase {
@Override @Override
public boolean canMergeSlot(ItemStack stack, Slot slot) { public boolean canMergeSlot(ItemStack stack, Slot slot) {
if (slot == craftingResultSlot || slot == patternResultSlot) { return (slot == craftingResultSlot || slot == patternResultSlot) ? false : super.canMergeSlot(stack, slot);
return false;
}
return super.canMergeSlot(stack, slot);
} }
@Override @Override

View File

@@ -31,7 +31,7 @@ public class SlotGridCraftingResult extends SlotCrafting {
if (!player.worldObj.isRemote) { if (!player.worldObj.isRemote) {
grid.onCrafted(); grid.onCrafted();
container.detectAndSendChanges(); container.sendCraftingSlots();
} }
} }
} }

View File

@@ -222,9 +222,9 @@ public class GuiGrid extends GuiBase {
drawString(7, 7, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid")); drawString(7, 7, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
if (grid.getType() == EnumGridType.CRAFTING) { if (grid.getType() == EnumGridType.CRAFTING) {
drawString(7, 94, t("container.crafting")); drawString(7, 95, t("container.crafting"));
} else if (grid.getType() == EnumGridType.PATTERN) { } else if (grid.getType() == EnumGridType.PATTERN) {
drawString(7, 94, t("gui.refinedstorage:grid.pattern")); drawString(7, 95, t("gui.refinedstorage:grid.pattern"));
} }
drawString(7, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 163 : 114, t("container.inventory")); drawString(7, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 163 : 114, t("container.inventory"));

View File

@@ -187,6 +187,7 @@ public class TileGrid extends TileMachine implements IGrid {
} }
} }
container.sendCraftingSlots();
container.detectAndSendChanges(); container.detectAndSendChanges();
} }