Some more crafting speed up. Now: faster interaction with ouput!
This commit is contained in:
@@ -13,11 +13,9 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import de.skate702.craftingkeys.config.Config;
|
import de.skate702.craftingkeys.config.Config;
|
||||||
import de.skate702.craftingkeys.config.GuiConfig;
|
|
||||||
import de.skate702.craftingkeys.config.GuiConfigHandler;
|
import de.skate702.craftingkeys.config.GuiConfigHandler;
|
||||||
import de.skate702.craftingkeys.manager.*;
|
import de.skate702.craftingkeys.manager.*;
|
||||||
import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
|
import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
|
||||||
import de.skate702.craftingkeys.util.LanguageLocalizer;
|
|
||||||
import de.skate702.craftingkeys.util.Logger;
|
import de.skate702.craftingkeys.util.Logger;
|
||||||
import de.skate702.craftingkeys.util.Util;
|
import de.skate702.craftingkeys.util.Util;
|
||||||
import net.minecraft.client.gui.*;
|
import net.minecraft.client.gui.*;
|
||||||
@@ -110,7 +108,7 @@ public class CraftingKeys {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onGuiOpened(GuiOpenEvent event) {
|
public void onGuiOpened(GuiOpenEvent event) {
|
||||||
if (event.gui instanceof GuiMainMenu) {
|
if (event.gui instanceof GuiMainMenu) {
|
||||||
event.gui = new GuiConfig(); // Delete this!
|
//event.gui = new GuiConfig(); // Delete this!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,10 @@ public abstract class ContainerManager {
|
|||||||
} else if (Util.isHoldingStack()) { // MOVE FROM HAND
|
} else if (Util.isHoldingStack()) { // MOVE FROM HAND
|
||||||
|
|
||||||
onHolding(slotIndex);
|
onHolding(slotIndex);
|
||||||
handleNumKey();
|
handleNumKey(currentHoveredSlot);
|
||||||
|
} else { // HANDLE NUM KEY MOVING (also with empty hand now -> speed-up)
|
||||||
|
|
||||||
|
handleNumKey(currentHoveredSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -148,8 +150,9 @@ public abstract class ContainerManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles what to do with NumKey-Inputs while holding a item.
|
* Handles what to do with NumKey-Inputs while holding a item.
|
||||||
|
* @param currentHoveredSlot
|
||||||
*/
|
*/
|
||||||
protected void handleNumKey() {
|
protected void handleNumKey(Slot currentHoveredSlot) {
|
||||||
|
|
||||||
// hotbar-slots are always the last 9 slots of the currently opened inventory
|
// hotbar-slots are always the last 9 slots of the currently opened inventory
|
||||||
int hotbarStartIndex = Util.client.thePlayer.openContainer.getInventory().size() - 9 - 1;
|
int hotbarStartIndex = Util.client.thePlayer.openContainer.getInventory().size() - 9 - 1;
|
||||||
@@ -177,15 +180,33 @@ public abstract class ContainerManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
leftClick(hotbarStartIndex + inputdelta);
|
// If no stack is held and a num-key is pressed, get the output by interaction, but only
|
||||||
Logger.info("handleNumKey()", "Moved to hotbar slot " + inputdelta + ".");
|
// if there could not be meant another stack at mouse position. cool logic!
|
||||||
|
if (!Util.isHoldingStack()) {
|
||||||
|
|
||||||
moveStackToInventory(-1);
|
if (currentHoveredSlot == null || !currentHoveredSlot.getHasStack()) {
|
||||||
|
Logger.info("handleNumKey()", "Trying output to hotbar speedup.");
|
||||||
// Handle Minecraft handling. Ah...
|
onInteractionKeyPressed();
|
||||||
while (Keyboard.next()) {
|
}
|
||||||
Logger.info("handleNumKey()", "The cake is a lie!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If held, move!
|
||||||
|
if (Util.isHoldingStack()) {
|
||||||
|
|
||||||
|
// TODO: Make place?
|
||||||
|
|
||||||
|
leftClick(hotbarStartIndex + inputdelta);
|
||||||
|
Logger.info("handleNumKey()", "Moved to hotbar slot " + inputdelta + ".");
|
||||||
|
|
||||||
|
moveStackToInventory(-1);
|
||||||
|
|
||||||
|
// Handle Minecraft handling. Ah...
|
||||||
|
while (Keyboard.next()) {
|
||||||
|
Logger.info("handleNumKey()", "The cake is a lie!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user