1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Merge pull request #2173 from lleyton/master

Allow Ancient Debris to be mined by Industrial Miners
This commit is contained in:
TheBusyBiscuit 2020-08-02 22:16:13 +02:00 committed by GitHub
commit 503286c750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -47,6 +48,7 @@ public class IndustrialMiner extends MultiBlockMachine {
private final int range; private final int range;
private final boolean silkTouch; private final boolean silkTouch;
private final ItemSetting<Boolean> canMineAncientDebris = new ItemSetting<>("can-mine-ancient-debris", false);
public IndustrialMiner(Category category, SlimefunItemStack item, Material baseMaterial, boolean silkTouch, int range) { public IndustrialMiner(Category category, SlimefunItemStack item, Material baseMaterial, boolean silkTouch, int range) {
super(category, item, new ItemStack[] { null, null, null, new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(Material.CHEST), new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(baseMaterial), new ItemStack(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.BLAST_FURNACE : Material.FURNACE), new ItemStack(baseMaterial) }, BlockFace.UP); super(category, item, new ItemStack[] { null, null, null, new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(Material.CHEST), new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(baseMaterial), new ItemStack(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.BLAST_FURNACE : Material.FURNACE), new ItemStack(baseMaterial) }, BlockFace.UP);
@ -55,6 +57,7 @@ public class IndustrialMiner extends MultiBlockMachine {
this.silkTouch = silkTouch; this.silkTouch = silkTouch;
registerDefaultFuelTypes(); registerDefaultFuelTypes();
addItemSetting(canMineAncientDebris);
} }
/** /**
@ -128,6 +131,8 @@ public class IndustrialMiner extends MultiBlockMachine {
return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2)); return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2));
case LAPIS_ORE: case LAPIS_ORE:
return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4));
case ANCIENT_DEBRIS:
return new ItemStack(Material.ANCIENT_DEBRIS);
default: default:
// This includes Iron and Gold ore // This includes Iron and Gold ore
return new ItemStack(ore); return new ItemStack(ore);
@ -207,7 +212,7 @@ public class IndustrialMiner extends MultiBlockMachine {
* @return Whether this {@link IndustrialMiner} is capable of mining this {@link Material} * @return Whether this {@link IndustrialMiner} is capable of mining this {@link Material}
*/ */
public boolean canMine(Material type) { public boolean canMine(Material type) {
return type.name().endsWith("_ORE"); return type.name().endsWith("_ORE") || (type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue());
} }
} }