Skip to content

Commit

Permalink
Merge pull request Slimefun#3163 from martinbrom/feature/miner-deepsl…
Browse files Browse the repository at this point in the history
…ate-option

Add the option to prevent IndustrialMiner from mining deepslate ores
  • Loading branch information
TheBusyBiscuit authored Jul 10, 2021
2 parents ad2e0f3 + 11ba156 commit a94d26e
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class IndustrialMiner extends MultiBlockMachine {
protected final List<MachineFuel> fuelTypes = new ArrayList<>();

private final ItemSetting<Boolean> canMineAncientDebris = new ItemSetting<>(this, "can-mine-ancient-debris", false);
private final ItemSetting<Boolean> canMineDeepslateOres = new ItemSetting<>(this, "can-mine-deepslate-ores", true);
private final boolean silkTouch;
private final int range;

Expand All @@ -64,6 +65,7 @@ public IndustrialMiner(Category category, SlimefunItemStack item, Material baseM

registerDefaultFuelTypes();
addItemSetting(canMineAncientDebris);
addItemSetting(canMineDeepslateOres);
}

/**
Expand Down Expand Up @@ -159,12 +161,12 @@ public void addFuelType(int ores, @Nonnull ItemStack item) {
}

@Override
public String getLabelLocalPath() {
public @Nonnull String getLabelLocalPath() {
return "guide.tooltips.recipes.generator";
}

@Override
public List<ItemStack> getDisplayRecipes() {
public @Nonnull List<ItemStack> getDisplayRecipes() {
List<ItemStack> list = new ArrayList<>();

for (MachineFuel fuel : fuelTypes) {
Expand Down Expand Up @@ -217,14 +219,16 @@ public void onInteract(Player p, Block b) {
* @return Whether this {@link IndustrialMiner} is capable of mining this {@link Material}
*/
public boolean canMine(@Nonnull Material type) {
if (SlimefunTag.INDUSTRIAL_MINER_ORES.isTagged(type)) {
return true;
} else if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
return type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue();
MinecraftVersion version = SlimefunPlugin.getMinecraftVersion();
if (version.isAtLeast(MinecraftVersion.MINECRAFT_1_16) && type == Material.ANCIENT_DEBRIS) {
return canMineAncientDebris.getValue();
}

if (version.isAtLeast(MinecraftVersion.MINECRAFT_1_17) && SlimefunTag.DEEPSLATE_ORES.isTagged(type)) {
return canMineDeepslateOres.getValue();
}

return false;
return SlimefunTag.INDUSTRIAL_MINER_ORES.isTagged(type);
}

}

0 comments on commit a94d26e

Please sign in to comment.