Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public interface MotherloadMineConfig extends Config
String inventorySetup = "inventory-setup";
String useDepositAll = "useDepositAll";
String antiCrash = "antiCrash";
String dropGems = "dropGems";
String useUpstairsMine = "useUpstairsMine";
String useUpstairsHopper = "useUpstairsHopper";
String miningArea = "miningArea";
Expand Down Expand Up @@ -89,6 +90,18 @@ default boolean useAntiCrash()
return false;
}

@ConfigItem(
keyName = dropGems,
name = "Drop Gems",
description = "Automatically drop gems while mining",
position = 4,
section = generalSection
)
default boolean dropGems()
{
return false;
}

// Mine upstairs
@ConfigItem(
keyName = useUpstairsMine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
)
public class MotherloadMinePlugin extends Plugin {

static final String version = "1.8.4";
static final String version = "1.9.0";

@Inject
private MotherloadMineConfig config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ private void executeTask()
case DEPOSIT_HOPPER:
depositHopper();
break;
case DROP_GEMS:
dropGems();
break;
}
}

Expand All @@ -176,6 +179,11 @@ private void determineStatusFromInventory()
return;
}

if (config.dropGems() && hasGemsInInventory()) {
status = MLMStatus.DROP_GEMS;
return;
}

int payDirtCount = payDirtCount();
if (payDirtCount > 0 && Rs2Inventory.isFull()) {
resetMiningState();
Expand Down Expand Up @@ -263,6 +271,16 @@ private boolean hasOreInInventory()
);
}

private boolean hasGemsInInventory() {
return Rs2Inventory.contains(ItemID.UNCUT_SAPPHIRE, ItemID.UNCUT_EMERALD, ItemID.UNCUT_RUBY, ItemID.UNCUT_DIAMOND);
}

private void dropGems() {
if (hasGemsInInventory()) {
Rs2Inventory.dropAll(ItemID.UNCUT_SAPPHIRE, ItemID.UNCUT_EMERALD, ItemID.UNCUT_RUBY, ItemID.UNCUT_DIAMOND);
}
}

private int payDirtCount() {
return Rs2Inventory.count(ItemID.PAYDIRT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public enum MLMStatus {
DEPOSIT_HOPPER,
BANKING,
EMPTY_SACK,
FIXING_WATERWHEEL
FIXING_WATERWHEEL,
DROP_GEMS
}