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

Conflicts:
	CHANGELOG.md
This commit is contained in:
TheBusyBiscuit 2020-08-02 23:15:05 +02:00
commit 1aeba31a96
3 changed files with 10 additions and 3 deletions

View File

@ -24,7 +24,9 @@
## Release Candidate 16 (TBD)
#### Additions
* Added BlockPlacerPlaceEvent
* Added an option for Industrial Miners to mine Ancient Debris
* (API) Added BlockPlacerPlaceEvent
* (API) Added ToolUseHandler
#### Changes
* Performance improvement for Programmable Android rotations

View File

@ -330,7 +330,7 @@
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.8.07</version>
<version>3.9.00</version>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Material;
@ -47,6 +48,7 @@ public class IndustrialMiner extends MultiBlockMachine {
private final int range;
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) {
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;
registerDefaultFuelTypes();
addItemSetting(canMineAncientDebris);
}
/**
@ -128,6 +131,8 @@ public class IndustrialMiner extends MultiBlockMachine {
return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2));
case LAPIS_ORE:
return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4));
case ANCIENT_DEBRIS:
return new ItemStack(Material.ANCIENT_DEBRIS);
default:
// This includes Iron and Gold 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}
*/
public boolean canMine(Material type) {
return type.name().endsWith("_ORE");
return type.name().endsWith("_ORE") || (type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue());
}
}