diff --git a/build.gradle b/build.gradle
index cf7d305b..2fb944d4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,6 +15,10 @@ buildscript {
name 'jitpack'
url 'https://jitpack.io'
}
+ maven {
+ name "forge"
+ url "http://files.minecraftforge.net/maven"
+ }
mavenLocal()
}
dependencies {
@@ -37,15 +41,18 @@ compileJava {
repositories {
maven { url 'https://dvs1.progwml6.com/files/maven/' }
maven { url 'https://jitpack.io/' }
- maven { url 'https://cfa2.cursemaven.com/' }
+ maven { url 'https://cursemaven.com/' }
+ maven { url "https://minecraft.curseforge.com/api/maven/" }
}
dependencies {
compile 'com.github.phantamanta44:jsr305:1.0.1'
- deobfCompile 'mezz.jei:jei_1.12.2:4.15.0.293'
- deobfCompile "curse.maven:ae2-extended-life-570458:2747063" // pae2
+ deobfCompile 'mezz.jei:jei_1.12.2:4.15.0.293' //jei
+ deobfCompile "curse.maven:ae2-extended-life-570458:3785381" // pae2
deobfCompile "curse.maven:packagedauto-308380:2977147" // 1.0.3.14
deobfCompile "curse.maven:modular-machinery-270790:2761302" // 1.11.1
+ deobfCompile "curse.maven:codechicken-lib-1-8-242818:2779848" //ccl
+ deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735" // gt
}
minecraft {
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 00000000..14c3bd4e
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,4 @@
+systemProp.http.proxyHost=127.0.0.1
+systemProp.http.proxyPort=7890
+systemProp.https.proxyHost=127.0.0.1
+systemProp.https.proxyPort=7890
diff --git a/src/api/java/yalter/mousetweaks/api/IMTModGuiContainer2.java b/src/api/java/yalter/mousetweaks/api/IMTModGuiContainer2.java
new file mode 100644
index 00000000..a05494c7
--- /dev/null
+++ b/src/api/java/yalter/mousetweaks/api/IMTModGuiContainer2.java
@@ -0,0 +1,87 @@
+package yalter.mousetweaks.api;
+
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+
+/**
+ * This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
+ * If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
+ * which happens to be incompatible), check IMTModGuiContainer2Ex instead.
+ * If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
+ * or the MouseTweaksDisableWheelTweak annotations.
+ */
+public interface IMTModGuiContainer2 {
+ /**
+ * If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
+ *
+ * @return True if Mouse Tweaks should be disabled, false otherwise.
+ */
+ boolean MT_isMouseTweaksDisabled();
+
+ /**
+ * If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
+ *
+ * @return True if the Wheel Tweak should be disabled, false otherwise.
+ */
+ boolean MT_isWheelTweakDisabled();
+
+ /**
+ * Returns the Container.
+ *
+ * @return Container that is currently in use.
+ */
+ Container MT_getContainer();
+
+ /**
+ * Returns the Slot that is currently selected by the player, or null if no Slot is selected.
+ *
+ * @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
+ */
+ Slot MT_getSlotUnderMouse();
+
+ /**
+ * Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
+ * or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
+ *
+ * @param slot the slot to check
+ * @return True if slot is a crafting output slot.
+ */
+ boolean MT_isCraftingOutput(Slot slot);
+
+ /**
+ * Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
+ * slots and the Destroy Item slot in the vanilla creative inventory.
+ *
+ * @param slot the slot to check
+ * @return Tru if slot should be ignored by Mouse Tweaks.
+ */
+ boolean MT_isIgnored(Slot slot);
+
+ /**
+ * If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
+ * This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
+ * events are handled (although note these events are handled every game tick, which is far less frequent than every
+ * render tick).
+ *
+ * If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
+ * the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
+ * mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.
+ *
+ * For vanilla containers this method looks like this:
+ *
+ * this.ignoreMouseUp = true;
+ *
+ * if (this.dragSplitting) {
+ * if (this.dragSplittingButton == 1) {
+ * this.dragSplitting = false;
+ * return true;
+ * }
+ * }
+ *
+ * return false;
+ *
+ *
+ * @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
+ */
+ boolean MT_disableRMBDraggingFunctionality();
+}
\ No newline at end of file
diff --git a/src/main/java/com/glodblock/github/client/container/GuiFluidPatternEncoder.java b/src/main/java/com/glodblock/github/client/GuiFluidPatternEncoder.java
similarity index 97%
rename from src/main/java/com/glodblock/github/client/container/GuiFluidPatternEncoder.java
rename to src/main/java/com/glodblock/github/client/GuiFluidPatternEncoder.java
index 1ca5dfde..f9d9e9b1 100644
--- a/src/main/java/com/glodblock/github/client/container/GuiFluidPatternEncoder.java
+++ b/src/main/java/com/glodblock/github/client/GuiFluidPatternEncoder.java
@@ -1,10 +1,11 @@
-package com.glodblock.github.client.container;
+package com.glodblock.github.client;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.render.StackSizeRenderer;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
+import com.glodblock.github.client.container.ContainerFluidPatternEncoder;
import com.glodblock.github.client.render.FluidRenderUtils;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
diff --git a/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java b/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java
index 306e3b00..7349a435 100644
--- a/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java
+++ b/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java
@@ -5,6 +5,9 @@ import appeng.api.definitions.IDefinitions;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.implementations.ContainerPatternTerm;
+import appeng.container.slot.SlotFakeCraftingMatrix;
+import appeng.container.slot.SlotPatternOutputs;
+import appeng.helpers.InventoryAction;
import appeng.util.item.AEItemStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
@@ -14,9 +17,14 @@ import com.glodblock.github.interfaces.PatternConsumer;
import com.glodblock.github.loader.FCItems;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.FluidPatternDetails;
+import com.glodblock.github.util.Util;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
+import net.minecraftforge.items.ItemHandlerHelper;
import java.util.ArrayList;
import java.util.List;
@@ -145,4 +153,48 @@ public class ContainerFluidPatternTerminal extends ContainerPatternTerm implemen
}
}
+ @Override
+ public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
+ if (this.isCraftingMode()) {
+ super.doAction(player, action, slotId, id);
+ return;
+ }
+ if (slotId < 0 || slotId >= this.inventorySlots.size()) {
+ super.doAction(player, action, slotId, id);
+ return;
+ }
+ Slot slot = getSlot(slotId);
+ ItemStack stack = player.inventory.getItemStack();
+ if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && !stack.isEmpty()
+ && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
+ FluidStack fluid = null;
+ switch (action) {
+ case PICKUP_OR_SET_DOWN:
+ fluid = Util.getFluidFromItem(stack);
+ slot.putStack(ItemFluidPacket.newStack(fluid));
+ break;
+ case SPLIT_OR_PLACE_SINGLE:
+ fluid = Util.getFluidFromItem(ItemHandlerHelper.copyStackWithSize(stack, 1));
+ FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
+ if (fluid != null && fluid.equals(origin)) {
+ fluid.amount += origin.amount;
+ if (fluid.amount <= 0) fluid = null;
+ }
+ slot.putStack(ItemFluidPacket.newStack(fluid));
+ break;
+ }
+ if (fluid == null) {
+ super.doAction(player, action, slotId, id);
+ return;
+ }
+ return;
+ }
+ if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
+ if (stack.isEmpty() && !slot.getStack().isEmpty() && slot.getStack().getItem() instanceof ItemFluidPacket) {
+ return;
+ }
+ }
+ super.doAction(player, action, slotId, id);
+ }
+
}
diff --git a/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java b/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java
index 5b41dec0..783dcfeb 100644
--- a/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java
+++ b/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java
@@ -1,6 +1,8 @@
package com.glodblock.github.integration.jei;
import appeng.api.storage.data.IAEItemStack;
+import appeng.core.sync.network.NetworkHandler;
+import appeng.core.sync.packets.PacketValueConfig;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.container.ContainerFluidPatternTerminal;
import com.glodblock.github.common.part.PartFluidPatternTerminal;
@@ -10,12 +12,11 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
-import mezz.jei.transfer.RecipeTransferErrorTooltip;
-import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import java.io.IOException;
public class FluidPatternTerminalRecipeTransferHandler implements IRecipeTransferHandler