diff --git a/Mouse Tweaks.iml b/Mouse Tweaks.iml
index 9ab7daa..5133546 100644
--- a/Mouse Tweaks.iml
+++ b/Mouse Tweaks.iml
@@ -10,6 +10,7 @@
+
diff --git a/ant/build_mousetweaks.xml b/ant/build_mousetweaks.xml
index f8a73dc..99f8ac3 100644
--- a/ant/build_mousetweaks.xml
+++ b/ant/build_mousetweaks.xml
@@ -6,13 +6,13 @@
-
+
-
+
-
+
diff --git a/ant/buildnumber.txt b/ant/buildnumber.txt
index 4e3c1ed..3808a2d 100644
--- a/ant/buildnumber.txt
+++ b/ant/buildnumber.txt
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
-#Thu Jun 05 18:08:30 MSK 2014
-build.number=182
+#Tue Jul 22 00:32:27 MSK 2014
+build.number=184
diff --git a/java/yalter/mousetweaks/Config.java b/java/yalter/mousetweaks/Config.java
index 0e76268..a19729d 100644
--- a/java/yalter/mousetweaks/Config.java
+++ b/java/yalter/mousetweaks/Config.java
@@ -1,9 +1,6 @@
package yalter.mousetweaks;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
+import java.io.*;
import java.util.Properties;
public class Config {
@@ -37,7 +34,12 @@ public class Config {
public boolean saveConfig() {
try {
- FileWriter configWriter = new FileWriter(fileName);
+ File config = new File(fileName);
+ File parentDir = config.getParentFile();
+ if (!parentDir.exists())
+ parentDir.mkdirs();
+
+ FileWriter configWriter = new FileWriter(config);
properties.store(configWriter, null);
configWriter.close();
diff --git a/java/yalter/mousetweaks/Constants.java b/java/yalter/mousetweaks/Constants.java
index 7c6d91b..f021b6a 100644
--- a/java/yalter/mousetweaks/Constants.java
+++ b/java/yalter/mousetweaks/Constants.java
@@ -9,7 +9,7 @@ public class Constants {
public static final String ISMOUSEOVERSLOT_NAME = "a";
public static final String FIELDE_NAME = "H";
public static final String FIELDq_NAME = "t";
- public static final String MCPROFILER_NAME = "A";
+ public static final String MCPROFILER_NAME = "z";
// Forge obfuscated names
public static final String ISMOUSEOVERSLOT_FORGE_NAME = "func_146981_a";
@@ -18,7 +18,10 @@ public class Constants {
public static final String MCPROFILER_FORGE_NAME = "field_71424_I";
// MCP names - these are the same as Forge ones for the most part
- public static final String MCPROFILER_MCP_NAME = "mcProfiler";
+ public static final String ISMOUSEOVERSLOT_MCP_NAME = "isMouseOverSlot";
+ public static final String FIELDE_MCP_NAME = "ignoreMouseUp";
+ public static final String FIELDq_MCP_NAME = "dragSplitting";
+ public static final String MCPROFILER_MCP_NAME = "mcProfiler";
// OnTick methods
public static final String ONTICKMETHOD_FORGE_NAME = "Forge";
diff --git a/java/yalter/mousetweaks/DeobfuscationLayer.java b/java/yalter/mousetweaks/DeobfuscationLayer.java
index 4ab2229..5f38181 100644
--- a/java/yalter/mousetweaks/DeobfuscationLayer.java
+++ b/java/yalter/mousetweaks/DeobfuscationLayer.java
@@ -7,10 +7,8 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.multiplayer.PlayerControllerMP;
-import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Mouse;
@@ -54,7 +52,7 @@ public class DeobfuscationLayer {
}
protected static Container getContainer(GuiContainer guiContainer) {
- return guiContainer.field_147002_h;
+ return guiContainer.inventorySlots;
}
protected static List> getSlots(Container container) {
@@ -69,18 +67,6 @@ public class DeobfuscationLayer {
return (slot == null) ? null : slot.getStack();
}
- protected static int getItemStackID(ItemStack itemStack) {
- return Item.getIdFromItem(itemStack.getItem());
- }
-
- protected static boolean hasSubtypesItemStack(ItemStack itemStack) {
- return itemStack.getHasSubtypes();
- }
-
- protected static int getItemStackItemDamage(ItemStack itemStack) {
- return itemStack.getItemDamage();
- }
-
protected static int getWindowId(Container container) {
return container.windowId;
}
@@ -101,10 +87,6 @@ public class DeobfuscationLayer {
return getThePlayer().inventory;
}
- protected static GameSettings getGameSettings() {
- return mc.gameSettings;
- }
-
protected static int getDisplayWidth() {
return mc.displayWidth;
}
@@ -139,13 +121,11 @@ public class DeobfuscationLayer {
protected static boolean areStacksCompatible(ItemStack itemStack1, ItemStack itemStack2) {
return ((itemStack1 == null) || (itemStack2 == null))
- || ((getItemStackID(itemStack1) == getItemStackID(itemStack2))
- && (!hasSubtypesItemStack(itemStack1)
- || (getItemStackItemDamage(itemStack1) == getItemStackItemDamage(itemStack2))));
+ || itemStack1.isItemEqual(itemStack2);
}
protected static boolean isMouseOverSlot(GuiContainer guiContainer, Slot slot) {
- return (Boolean) Reflection.guiContainerClass.invokeMethod(guiContainer, "isMouseOverSlot", slot, getRequiredMouseX(), getRequiredMouseY());
+ return (Boolean) Reflection.guiContainerClass.invokeMethod(guiContainer, Constants.ISMOUSEOVERSLOT_FORGE_NAME, slot, getRequiredMouseX(), getRequiredMouseY());
}
protected static Slot getSelectedSlot(GuiContainer guiContainer, Container container, int slotCount) {
@@ -169,20 +149,16 @@ public class DeobfuscationLayer {
}
protected static int getRequiredMouseX() {
- ScaledResolution var8 = new ScaledResolution(getGameSettings(), getDisplayWidth(),
+ ScaledResolution var8 = new ScaledResolution(mc, getDisplayWidth(),
getDisplayHeight());
int var9 = var8.getScaledWidth();
return (Mouse.getX() * var9) / getDisplayWidth();
}
protected static int getRequiredMouseY() {
- ScaledResolution var8 = new ScaledResolution(getGameSettings(), getDisplayWidth(),
+ ScaledResolution var8 = new ScaledResolution(mc, getDisplayWidth(),
getDisplayHeight());
int var10 = var8.getScaledHeight();
return var10 - ((Mouse.getY() * var10) / getDisplayHeight()) - 1;
}
-
- protected static void sendClientMessage(String message) {
- getThePlayer().sendChatMessage(message);
- }
}
diff --git a/java/yalter/mousetweaks/Main.java b/java/yalter/mousetweaks/Main.java
index 1229e1f..9b32a84 100644
--- a/java/yalter/mousetweaks/Main.java
+++ b/java/yalter/mousetweaks/Main.java
@@ -330,7 +330,8 @@ public class Main extends DeobfuscationLayer {
if (Mouse.isButtonDown(1)) { // Right mouse button
if ((Main.RMBTweak == 1) && !Main.DisableRMBTweak) {
- if ((stackOnMouse != null) && areStacksCompatible(stackOnMouse, targetStack)) {
+ if ((stackOnMouse != null) && areStacksCompatible(stackOnMouse, targetStack)
+ && !isCraftingOutputSlot(currentScreen, selectedSlot)) {
if ((firstSlot != null) && !firstSlotClicked) {
firstSlotClicked = true;
disableRMBDragWithID(currentScreen);
@@ -353,8 +354,13 @@ public class Main extends DeobfuscationLayer {
clickSlot(currentScreen, selectedSlot, 0, true);
} else { // If shift is not down, we need to merge the item stack on the mouse with the one in the slot.
if ((getItemStackSize(stackOnMouse) + getItemStackSize(targetStack)) <= getMaxItemStackSize(stackOnMouse)) {
- clickSlot(currentScreen, selectedSlot, 0, false); // We need to click on the slot so that our item stack gets merged with
- clickSlot(currentScreen, selectedSlot, 0, false); // it, and then click again to return the stack to the mouse.
+ // We need to click on the slot so that our item stack gets merged with it,
+ // and then click again to return the stack to the mouse.
+ // However, if the slot is crafting output, then the item is added to the mouse stack
+ // on the first click and we don't need to click the second time.
+ clickSlot(currentScreen, selectedSlot, 0, false);
+ if (!isCraftingOutputSlot(currentScreen, selectedSlot))
+ clickSlot(currentScreen, selectedSlot, 0, false);
}
}
}
diff --git a/java/yalter/mousetweaks/Reflection.java b/java/yalter/mousetweaks/Reflection.java
index 4d806e7..efb707f 100644
--- a/java/yalter/mousetweaks/Reflection.java
+++ b/java/yalter/mousetweaks/Reflection.java
@@ -29,7 +29,7 @@ public class Reflection {
guiContainerClass.storeClass("GuiContainer", GuiContainer.class);
Method isMouseOverSlot = getMethod(GuiContainer.class,
- getObfuscatedName(Constants.ISMOUSEOVERSLOT_FORGE_NAME, Constants.ISMOUSEOVERSLOT_FORGE_NAME, Constants.ISMOUSEOVERSLOT_NAME), Slot.class, int.class,
+ getObfuscatedName(Constants.ISMOUSEOVERSLOT_MCP_NAME, Constants.ISMOUSEOVERSLOT_FORGE_NAME, Constants.ISMOUSEOVERSLOT_NAME), Slot.class, int.class,
int.class);
if (isMouseOverSlot == null) {
@@ -37,11 +37,11 @@ public class Reflection {
return false;
}
- guiContainerClass.storeMethod("isMouseOverSlot", isMouseOverSlot);
+ guiContainerClass.storeMethod(Constants.ISMOUSEOVERSLOT_FORGE_NAME, isMouseOverSlot);
Field field;
field = getField(GuiContainer.class,
- getObfuscatedName(Constants.FIELDE_FORGE_NAME, Constants.FIELDE_FORGE_NAME, Constants.FIELDE_NAME));
+ getObfuscatedName(Constants.FIELDE_MCP_NAME, Constants.FIELDE_FORGE_NAME, Constants.FIELDE_NAME));
if (field == null) {
Logger.Log("Failed to retrieve the E field, disabling RMBTweak");
@@ -50,7 +50,7 @@ public class Reflection {
guiContainerClass.storeField(Constants.FIELDE_FORGE_NAME, field);
field = getField(GuiContainer.class,
- getObfuscatedName(Constants.FIELDq_FORGE_NAME, Constants.FIELDq_FORGE_NAME, Constants.FIELDq_NAME));
+ getObfuscatedName(Constants.FIELDq_MCP_NAME, Constants.FIELDq_FORGE_NAME, Constants.FIELDq_NAME));
if (field == null) {
Logger.Log("Failed to retreive the q field, disabling RMBTweak");