Skip to content

Commit

Permalink
Enable pressing shift to take 10 items
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Sep 20, 2024
1 parent d75f72e commit 75c6335
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Harmony/XUiC_WheelItemStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ public override void Init()

private void SetDnD(ItemStack stack) => xui.dragAndDrop.CurrentStack = stack;

static bool IsShiftPressed => Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);

protected virtual int TransferItems(int amount,
ItemStack src, Action<ItemStack> setSrc,
ItemStack dst, Action<ItemStack> setDst)
{
if (IsShiftPressed) amount *= 10;
if (WheelItemStack.TransferItems(amount, src, setSrc, dst, setDst) > 0)
{
// Copied from vanilla
Expand Down
3 changes: 3 additions & 0 deletions Harmony/XUiC_WheelRequiredItemStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ public class XUiC_WheelRequiredItemStack : XUiC_RequiredItemStack

private void SetDnD(ItemStack stack) => xui.dragAndDrop.CurrentStack = stack;

static bool IsShiftPressed => Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);

protected virtual int TransferItems(int amount,
ItemStack src, Action<ItemStack> setSrc,
ItemStack dst, Action<ItemStack> setDst)
{
if (IsShiftPressed) amount *= 10;
if (WheelItemStack.TransferItems(amount, src, setSrc, dst, setDst) > 0)
{
// Copied from vanilla
Expand Down
3 changes: 3 additions & 0 deletions SmxCompat/XUiC_WheelQuartzItemStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ public override void Init()

private void SetDnD(ItemStack stack) => xui.dragAndDrop.CurrentStack = stack;

static bool IsShiftPressed => Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);

protected virtual int TransferItems(int amount,
ItemStack src, Action<ItemStack> setSrc,
ItemStack dst, Action<ItemStack> setDst)
{
if (IsShiftPressed) amount *= 10;
if (WheelItemStack.TransferItems(amount, src, setSrc, dst, setDst) > 0)
{
// Copied from vanilla
Expand Down

0 comments on commit 75c6335

Please sign in to comment.