1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Hercules' Pickaxe now supports 1.17 deepslate ores and copper

This commit is contained in:
ybw0014 2021-09-14 02:16:55 +08:00
parent 79c6c139c6
commit cc0add1137
No known key found for this signature in database
GPG Key ID: EC1F0076F4158D9C

View File

@ -3,6 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.tools;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -25,12 +27,32 @@ public class HerculesPickaxe extends SimpleSlimefunItem<ToolUseHandler> {
@Override @Override
public @Nonnull ToolUseHandler getItemHandler() { public @Nonnull ToolUseHandler getItemHandler() {
return (e, tool, fortune, drops) -> { return (e, tool, fortune, drops) -> {
if (SlimefunTag.ORES.isTagged(e.getBlock().getType())) { Material mat = e.getBlock().getType();
if (e.getBlock().getType() == Material.IRON_ORE) {
if (SlimefunTag.ORES.isTagged(mat)) {
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) {
switch(mat) {
case DEEPSLATE_IRON_ORE:
drops.add(new CustomItemStack(SlimefunItems.IRON_DUST, 2)); drops.add(new CustomItemStack(SlimefunItems.IRON_DUST, 2));
} else if (e.getBlock().getType() == Material.GOLD_ORE) { break;
case DEEPSLATE_GOLD_ORE:
drops.add(new CustomItemStack(SlimefunItems.GOLD_DUST, 2)); drops.add(new CustomItemStack(SlimefunItems.GOLD_DUST, 2));
} else { break;
case COPPER_ORE:
case DEEPSLATE_COPPER_ORE:
drops.add(new CustomItemStack(SlimefunItems.COPPER_DUST, 2));
break;
}
}
switch(mat) {
case IRON_ORE:
drops.add(new CustomItemStack(SlimefunItems.IRON_DUST, 2));
break;
case GOLD_ORE:
drops.add(new CustomItemStack(SlimefunItems.GOLD_DUST, 2));
break;
default:
for (ItemStack drop : e.getBlock().getDrops(tool)) { for (ItemStack drop : e.getBlock().getDrops(tool)) {
drops.add(new CustomItemStack(drop, drop.getAmount() * 2)); drops.add(new CustomItemStack(drop, drop.getAmount() * 2));
} }