Patterns in interface

This commit is contained in:
Raoul Van den Berge
2016-04-10 15:05:20 +02:00
parent c6074aec30
commit d8ea51ceec
7 changed files with 29 additions and 5 deletions

View File

@@ -3,8 +3,12 @@ package refinedstorage.container;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.RefinedStorageItems;
import refinedstorage.container.slot.IItemValidator;
import refinedstorage.container.slot.SlotFiltered;
import refinedstorage.container.slot.SlotOutput; import refinedstorage.container.slot.SlotOutput;
import refinedstorage.container.slot.SlotSpecimen; import refinedstorage.container.slot.SlotSpecimen;
import refinedstorage.item.ItemPattern;
import refinedstorage.tile.TileInterface; import refinedstorage.tile.TileInterface;
public class ContainerInterface extends ContainerBase { public class ContainerInterface extends ContainerBase {
@@ -23,7 +27,16 @@ public class ContainerInterface extends ContainerBase {
addSlotToContainer(new SlotOutput(tile, i, 8 + (18 * (i - 18)), 100)); addSlotToContainer(new SlotOutput(tile, i, 8 + (18 * (i - 18)), 100));
} }
addPlayerInventory(8, 136); for (int i = 27; i < 27 + 9; ++i) {
addSlotToContainer(new SlotFiltered(tile, i, 8 + (18 * (i - 27)), 134, new IItemValidator() {
@Override
public boolean isValid(ItemStack stack) {
return stack.getItem() == RefinedStorageItems.PATTERN && ItemPattern.hasResult(stack);
}
}));
}
addPlayerInventory(8, 168);
} }
@Override @Override

View File

@@ -10,7 +10,7 @@ public class GuiInterface extends GuiBase {
private TileInterface tile; private TileInterface tile;
public GuiInterface(ContainerInterface container, TileInterface tile) { public GuiInterface(ContainerInterface container, TileInterface tile) {
super(container, 176, 218); super(container, 176, 250);
this.tile = tile; this.tile = tile;
} }
@@ -38,6 +38,7 @@ public class GuiInterface extends GuiBase {
public void drawForeground(int mouseX, int mouseY) { public void drawForeground(int mouseX, int mouseY) {
drawString(7, 7, t("gui.refinedstorage:interface.import")); drawString(7, 7, t("gui.refinedstorage:interface.import"));
drawString(7, 42, t("gui.refinedstorage:interface.export")); drawString(7, 42, t("gui.refinedstorage:interface.export"));
drawString(7, 123, t("container.inventory")); drawString(7, 122, t("gui.refinedstorage:interface.patterns"));
drawString(7, 156, t("container.inventory"));
} }
} }

View File

@@ -43,8 +43,16 @@ public class ItemPattern extends ItemBase {
pattern.getTagCompound().setTag(NBT_RESULT, stackTag); pattern.getTagCompound().setTag(NBT_RESULT, stackTag);
} }
public static boolean hasResult(ItemStack pattern) {
if (pattern.getTagCompound() == null) {
return false;
}
return pattern.getTagCompound().hasKey(NBT_RESULT);
}
public static ItemStack getResult(ItemStack pattern) { public static ItemStack getResult(ItemStack pattern) {
if (pattern.getTagCompound() == null || !pattern.getTagCompound().hasKey(NBT_RESULT)) { if (!hasResult(pattern)) {
return null; return null;
} }

View File

@@ -26,7 +26,7 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
18, 19, 20, 21, 22, 23, 24, 25, 26 18, 19, 20, 21, 22, 23, 24, 25, 26
}; };
private InventorySimple inventory = new InventorySimple("interface", 9 * 3, this); private InventorySimple inventory = new InventorySimple("interface", 9 * 4, this);
private int compare = 0; private int compare = 0;

View File

@@ -19,6 +19,7 @@ gui.refinedstorage:constructor=Constructor
gui.refinedstorage:relay=Relay gui.refinedstorage:relay=Relay
gui.refinedstorage:interface.import=Interface Import gui.refinedstorage:interface.import=Interface Import
gui.refinedstorage:interface.export=Interface Export gui.refinedstorage:interface.export=Interface Export
gui.refinedstorage:interface.patterns=Patterns
misc.refinedstorage:energy_stored=%d / %d RF misc.refinedstorage:energy_stored=%d / %d RF
misc.refinedstorage:energy_usage=Usage: %d RF/t misc.refinedstorage:energy_usage=Usage: %d RF/t

View File

@@ -19,6 +19,7 @@ gui.refinedstorage:constructor=Constructor
gui.refinedstorage:relay=Relais gui.refinedstorage:relay=Relais
gui.refinedstorage:interface.import=Interface Import gui.refinedstorage:interface.import=Interface Import
gui.refinedstorage:interface.export=Interface Export gui.refinedstorage:interface.export=Interface Export
gui.refinedstorage:interface.patterns=Patronen
misc.refinedstorage:energy_stored=%d / %d RF misc.refinedstorage:energy_stored=%d / %d RF
misc.refinedstorage:energy_usage=Vebruik: %d RF/t misc.refinedstorage:energy_usage=Vebruik: %d RF/t

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB