mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Mob Spawners no longer drop from Blast Mining Fixes #5052
This commit is contained in:
parent
e886a16388
commit
bda5424a4c
@ -1,9 +1,11 @@
|
|||||||
Version 2.2.018
|
Version 2.2.018
|
||||||
Fixed a probability bug where certain skills would max out in chance to succeed well before they were supposed to (such as Dodge)
|
Fixed a probability bug where certain skills would max out in chance to succeed well before they were supposed to (such as Dodge)
|
||||||
|
Blast Mining will no longer drop mob spawners (see notes)
|
||||||
(Codebase) Added more unit tests for Probability and RNG
|
(Codebase) Added more unit tests for Probability and RNG
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
This probability bug was a big oopsie and showed a gap in unit test coverage, I've added that coverage and a bug like this in theory shouldn't happen again.
|
This probability bug was a big oopsie and showed a gap in unit test coverage, I've added that coverage and a bug like this in theory shouldn't happen again.
|
||||||
|
In a future version I will add configuration for admins to control what blocks are not allowed to be dropped by blast mining.
|
||||||
|
|
||||||
Version 2.2.017
|
Version 2.2.017
|
||||||
Fixed a bug with default Mace permissions (thanks SrBedrock)
|
Fixed a bug with default Mace permissions (thanks SrBedrock)
|
||||||
|
@ -37,6 +37,7 @@ import static com.gmail.nossr50.util.ItemUtils.isPickaxe;
|
|||||||
public class MiningManager extends SkillManager {
|
public class MiningManager extends SkillManager {
|
||||||
|
|
||||||
public static final String BUDDING_AMETHYST = "budding_amethyst";
|
public static final String BUDDING_AMETHYST = "budding_amethyst";
|
||||||
|
public static final Collection<Material> BLAST_MINING_BLACKLIST = List.of(Material.SPAWNER);
|
||||||
|
|
||||||
public MiningManager(@NotNull McMMOPlayer mcMMOPlayer) {
|
public MiningManager(@NotNull McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, PrimarySkillType.MINING);
|
super(mcMMOPlayer, PrimarySkillType.MINING);
|
||||||
@ -225,13 +226,14 @@ public class MiningManager extends SkillManager {
|
|||||||
? blockState.getBlock().getDrops(mmoPlayer.getPlayer().getInventory().getItemInMainHand())
|
? blockState.getBlock().getDrops(mmoPlayer.getPlayer().getInventory().getItemInMainHand())
|
||||||
: List.of(new ItemStack(blockState.getType()));
|
: List.of(new ItemStack(blockState.getType()));
|
||||||
ItemUtils.spawnItems(getPlayer(), Misc.getBlockCenter(blockState),
|
ItemUtils.spawnItems(getPlayer(), Misc.getBlockCenter(blockState),
|
||||||
oreDrops, ItemSpawnReason.BLAST_MINING_ORES);
|
oreDrops, BLAST_MINING_BLACKLIST, ItemSpawnReason.BLAST_MINING_ORES);
|
||||||
|
|
||||||
if (mcMMO.p.getAdvancedConfig().isBlastMiningBonusDropsEnabled()) {
|
if (mcMMO.p.getAdvancedConfig().isBlastMiningBonusDropsEnabled()) {
|
||||||
for (int i = 1; i < dropMultiplier; i++) {
|
for (int i = 1; i < dropMultiplier; i++) {
|
||||||
ItemUtils.spawnItems(getPlayer(),
|
ItemUtils.spawnItems(getPlayer(),
|
||||||
Misc.getBlockCenter(blockState),
|
Misc.getBlockCenter(blockState),
|
||||||
oreDrops,
|
oreDrops,
|
||||||
|
BLAST_MINING_BLACKLIST,
|
||||||
ItemSpawnReason.BLAST_MINING_ORES_BONUS_DROP);
|
ItemSpawnReason.BLAST_MINING_ORES_BONUS_DROP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,6 +696,29 @@ public final class ItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop items at a given location.
|
||||||
|
*
|
||||||
|
* @param player player to drop the items for
|
||||||
|
* @param location The location to drop the items at
|
||||||
|
* @param itemStacks The items to drop
|
||||||
|
* @param blackList The items to skip
|
||||||
|
* @param itemSpawnReason the reason for the item drop
|
||||||
|
*/
|
||||||
|
public static void spawnItems(@Nullable Player player,
|
||||||
|
@NotNull Location location,
|
||||||
|
@NotNull Collection<ItemStack> itemStacks,
|
||||||
|
@NotNull Collection<Material> blackList,
|
||||||
|
@NotNull ItemSpawnReason itemSpawnReason) {
|
||||||
|
for (ItemStack is : itemStacks) {
|
||||||
|
// Skip blacklisted items
|
||||||
|
if(blackList.contains(is.getType())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
spawnItem(player, location, is, itemSpawnReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drop items at a given location.
|
* Drop items at a given location.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user