Merge branch 'jei-transfer-highlight' into AE2-Omnifactory
This commit is contained in:
@@ -81,6 +81,7 @@ public class GuiCraftConfirm extends AEBaseGui {
|
||||
this.setScrollBar(scrollbar);
|
||||
|
||||
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
|
||||
this.ccc.setGui(this);
|
||||
|
||||
if (te instanceof WirelessTerminalGuiObject) {
|
||||
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
|
||||
@@ -95,6 +95,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource {
|
||||
protected GuiCraftingCPU(final ContainerCraftingCPU container) {
|
||||
super(container);
|
||||
this.craftingCpu = container;
|
||||
this.craftingCpu.setGui(this);
|
||||
this.ySize = GUI_HEIGHT;
|
||||
this.xSize = GUI_WIDTH;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -81,4 +82,8 @@ public class GuiCraftingTerm extends GuiMEMonitorable {
|
||||
protected String getBackground() {
|
||||
return "guis/crafting.png";
|
||||
}
|
||||
|
||||
public ItemRepo getRepo() {
|
||||
return this.repo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,11 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.ActionKey;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.*;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.me.SlotME;
|
||||
@@ -73,7 +77,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
private static int craftingGridOffsetY;
|
||||
|
||||
private static String memoryText = "";
|
||||
private final ItemRepo repo;
|
||||
protected final ItemRepo repo;
|
||||
private final int offsetX = 9;
|
||||
private final int lowerTextureOffset = 0;
|
||||
private final IConfigManager configSrc;
|
||||
|
||||
@@ -51,6 +51,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
||||
|
||||
private final ItemRepo repo;
|
||||
private final int rows = 4;
|
||||
private final ContainerNetworkStatus cns;
|
||||
private GuiImgButton units;
|
||||
private int tooltip = -1;
|
||||
|
||||
@@ -65,6 +66,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
||||
this.ySize = 153;
|
||||
this.xSize = 195;
|
||||
this.repo.setRowSize(5);
|
||||
|
||||
this.cns = (ContainerNetworkStatus) this.inventorySlots;
|
||||
this.cns.setGui(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -268,4 +268,8 @@ public class ItemRepo {
|
||||
this.updateJEI(this.searchString);
|
||||
}
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getList() {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
@@ -61,6 +62,7 @@ import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
@@ -85,6 +87,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
||||
public boolean noCPU = true;
|
||||
@GuiSync(7)
|
||||
public String myName = "";
|
||||
private GuiCraftConfirm guiCraftConfirm;
|
||||
|
||||
public ContainerCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
@@ -403,4 +406,12 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
||||
public void setJob(final Future<ICraftingJob> job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||
this.guiCraftConfirm.postUpdate(list, ref);
|
||||
}
|
||||
|
||||
public void setGui(GuiCraftConfirm guiCraftConfirm) {
|
||||
this.guiCraftConfirm = guiCraftConfirm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
@@ -47,6 +49,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject {
|
||||
@@ -58,6 +61,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
|
||||
@GuiSync(0)
|
||||
public long eta = -1;
|
||||
private GuiCraftingCPU guiCraftingCPU;
|
||||
|
||||
public ContainerCraftingCPU(final InventoryPlayer ip, final Object te) {
|
||||
super(ip, te);
|
||||
@@ -232,4 +236,12 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
private void setNetwork(final IGrid network) {
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||
this.guiCraftingCPU.postUpdate(list, ref);
|
||||
}
|
||||
|
||||
public void setGui(GuiCraftingCPU guiCraftingCPU) {
|
||||
this.guiCraftingCPU = guiCraftingCPU;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ import appeng.container.ContainerNull;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.parts.reporting.AbstractPartTerminal;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.WrapperInvItemHandler;
|
||||
|
||||
@@ -42,6 +42,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
@@ -64,13 +65,14 @@ import net.minecraftforge.fml.common.Loader;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
||||
|
||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
private final IMEMonitor<IAEItemStack> monitor;
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
public final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync(99)
|
||||
@@ -357,11 +359,19 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
this.hasPower = isPowered;
|
||||
}
|
||||
|
||||
private IConfigManagerHost getGui() {
|
||||
public IConfigManagerHost getGui() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list) {
|
||||
((GuiMEMonitorable) this.gui).postUpdate(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
@@ -42,6 +43,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContainerNetworkStatus extends AEBaseContainer {
|
||||
@@ -56,6 +58,7 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
||||
public long maxPower;
|
||||
private IGrid network;
|
||||
private int delay = 40;
|
||||
private GuiNetworkStatus guiNetworkStatus;
|
||||
|
||||
public ContainerNetworkStatus(final InventoryPlayer ip, final INetworkTool te) {
|
||||
super(ip, null, null);
|
||||
@@ -160,4 +163,12 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
||||
private void setPowerUsage(final long powerUsage) {
|
||||
this.powerUsage = powerUsage;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list) {
|
||||
this.guiNetworkStatus.postUpdate(list);
|
||||
}
|
||||
|
||||
public void setGui(GuiNetworkStatus guiNetworkStatus) {
|
||||
this.guiNetworkStatus = guiNetworkStatus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,15 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
@@ -43,8 +48,10 @@ import appeng.util.item.AEItemStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
|
||||
@@ -20,19 +20,18 @@ package appeng.core.sync.packets;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.implementations.ContainerNetworkStatus;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -132,22 +131,22 @@ public class PacketMEInventoryUpdate extends AppEngPacket {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
final Container c = player.openContainer;
|
||||
|
||||
if (gs instanceof GuiCraftConfirm) {
|
||||
((GuiCraftConfirm) gs).postUpdate(this.list, this.ref);
|
||||
if (c instanceof ContainerCraftConfirm) {
|
||||
((ContainerCraftConfirm) c).postUpdate(this.list, this.ref);
|
||||
}
|
||||
|
||||
if (gs instanceof GuiCraftingCPU) {
|
||||
((GuiCraftingCPU) gs).postUpdate(this.list, this.ref);
|
||||
if (c instanceof ContainerCraftingCPU) {
|
||||
((ContainerCraftingCPU) c).postUpdate(this.list, this.ref);
|
||||
}
|
||||
|
||||
if (gs instanceof GuiMEMonitorable) {
|
||||
((GuiMEMonitorable) gs).postUpdate(this.list);
|
||||
if (c instanceof ContainerMEMonitorable) {
|
||||
((ContainerMEMonitorable) c).postUpdate(this.list);
|
||||
}
|
||||
|
||||
if (gs instanceof GuiNetworkStatus) {
|
||||
((GuiNetworkStatus) gs).postUpdate(this.list);
|
||||
if (c instanceof ContainerNetworkStatus) {
|
||||
((ContainerNetworkStatus) c).postUpdate(this.list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import mezz.jei.api.gui.ITooltipCallback;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CraftableCallBack implements ITooltipCallback<ItemStack> {
|
||||
private final IItemList<IAEItemStack> list;
|
||||
private final Container container;
|
||||
|
||||
public CraftableCallBack(Container container, IItemList<IAEItemStack> ir) {
|
||||
this.list = ir;
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTooltip(int slotIndex, boolean input, ItemStack ingredient, List<String> tooltip) {
|
||||
if (list != null) {
|
||||
AEItemStack stack = AEItemStack.fromItemStack(ingredient);
|
||||
if (list.findPrecise(stack) != null) {
|
||||
tooltip.add(I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing"));
|
||||
tooltip.add(I18n.translateToLocalFormatted("gui.tooltips.appliedenergistics2.Craftable"));
|
||||
if (Mouse.isButtonDown(2)) {
|
||||
((AEBaseContainer) container).setTargetStack(stack);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.AUTO_CRAFT, container.getInventory().size(), 0);
|
||||
NetworkHandler.instance().sendToServer(p);
|
||||
}
|
||||
} else {
|
||||
tooltip.add(I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import mezz.jei.api.gui.IGuiIngredient;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||
import mezz.jei.gui.recipes.RecipeLayout;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
|
||||
import static mezz.jei.api.recipe.transfer.IRecipeTransferError.Type.USER_FACING;
|
||||
|
||||
public class JEIMissingItem implements IRecipeTransferError {
|
||||
|
||||
private boolean errored;
|
||||
|
||||
JEIMissingItem(Container container, @Nonnull IRecipeLayout recipeLayout) {
|
||||
if (container instanceof ContainerCraftingTerm) {
|
||||
ContainerCraftingTerm craftingTerm = (ContainerCraftingTerm) container;
|
||||
GuiCraftingTerm g = (GuiCraftingTerm) craftingTerm.getGui();
|
||||
|
||||
IItemList<IAEItemStack> ir = g.getRepo().getList();
|
||||
boolean found;
|
||||
this.errored = false;
|
||||
|
||||
recipeLayout.getItemStacks().addTooltipCallback(new CraftableCallBack(container, ir));
|
||||
|
||||
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||
found = false;
|
||||
if (i.isInput() && i.getAllIngredients().size() > 0) {
|
||||
for (Object o : i.getAllIngredients()) {
|
||||
if (o instanceof ItemStack) {
|
||||
ItemStack stack = (ItemStack) o;
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
||||
Collection<IAEItemStack> fuzzy = ir.findFuzzy(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL);
|
||||
if (fuzzy.size() > 0) {
|
||||
for (IAEItemStack itemStack : fuzzy) {
|
||||
if (itemStack.getStackSize() > 0) {
|
||||
if (itemStack.fuzzyComparison(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IAEItemStack ext = ir.findPrecise(AEItemStack.fromItemStack(stack));
|
||||
if (ext != null) {
|
||||
if (ext.getStackSize() > 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
this.errored = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Type getType() {
|
||||
return USER_FACING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(Minecraft minecraft, int mouseX, int mouseY, @Nonnull IRecipeLayout recipeLayout, int recipeX, int recipeY) {
|
||||
Container c = minecraft.player.openContainer;
|
||||
if (c instanceof ContainerCraftingTerm) {
|
||||
ContainerCraftingTerm craftingTerm = (ContainerCraftingTerm) c;
|
||||
|
||||
GuiCraftingTerm g = (GuiCraftingTerm) craftingTerm.getGui();
|
||||
IItemList<IAEItemStack> ir = g.getRepo().getList();
|
||||
boolean found;
|
||||
boolean craftable;
|
||||
this.errored = false;
|
||||
|
||||
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||
found = false;
|
||||
craftable = false;
|
||||
if (i.isInput() && i.getAllIngredients().size() > 0) {
|
||||
for (Object o : i.getAllIngredients()) {
|
||||
if (o instanceof ItemStack) {
|
||||
ItemStack stack = (ItemStack) o;
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
||||
Collection<IAEItemStack> fuzzy = ir.findFuzzy(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL);
|
||||
if (fuzzy.size() > 0) {
|
||||
for (IAEItemStack itemStack : fuzzy) {
|
||||
if (itemStack.getStackSize() > 0) {
|
||||
if (itemStack.fuzzyComparison(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (itemStack.isCraftable()) {
|
||||
craftable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IAEItemStack ext = ir.findPrecise(AEItemStack.fromItemStack(stack));
|
||||
if (ext != null) {
|
||||
if (ext.getStackSize() > 0) {
|
||||
break;
|
||||
} else {
|
||||
if (ext.isCraftable()) {
|
||||
craftable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (craftable) {
|
||||
i.drawHighlight(minecraft, new Color(0.0f, 0.0f, 1.0f, 0.4f), recipeX, recipeY);
|
||||
} else {
|
||||
i.drawHighlight(minecraft, new Color(1.0f, 0.0f, 0.0f, 0.4f), recipeX, recipeY);
|
||||
}
|
||||
this.errored = true;
|
||||
} else {
|
||||
this.errored = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.errored) {
|
||||
((RecipeLayout) recipeLayout).getRecipeTransferButton().init(Minecraft.getMinecraft().player.openContainer, Minecraft.getMinecraft().player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean errored() {
|
||||
return this.errored;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
@@ -40,6 +41,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -62,7 +64,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IRecipeTransferError transferRecipe(T container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||
public IRecipeTransferError transferRecipe(@Nonnull T container, IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||
final String recipeType = recipeLayout.getRecipeCategory().getUid();
|
||||
|
||||
if (recipeType.equals(VanillaRecipeCategoryUid.INFORMATION) || recipeType.equals(VanillaRecipeCategoryUid.FUEL)) {
|
||||
@@ -70,6 +72,11 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
}
|
||||
|
||||
if (!doTransfer) {
|
||||
if (container instanceof ContainerCraftingTerm && recipeType.equals(VanillaRecipeCategoryUid.CRAFTING)) {
|
||||
JEIMissingItem error = new JEIMissingItem(container, recipeLayout);
|
||||
if (error.errored())
|
||||
return error;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user