Compare commits

...

2 Commits

3 changed files with 35 additions and 22 deletions

View File

@ -1,3 +1,10 @@
Version 2.2.032
Blast Mining no longer drops infested block variants
Reduced bonus drops on Blast Mining and randomized results (see notes)
NOTES:
A balance pass for Blast Mining is coming, but for now, I've reduced the total bonus drops and clamped the yield ceiling as Blast Mining is a bit too good.
Version 2.2.031 Version 2.2.031
Fixed potential NPE when player or blockstate is null for Inventory events on Furnaces Fixed potential NPE when player or blockstate is null for Inventory events on Furnaces
Fixed bug where en_us locale was being set system-wide (thanks BlvckBytes) Fixed bug where en_us locale was being set system-wide (thanks BlvckBytes)

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.2.031</version> <version>2.2.032-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>

View File

@ -28,17 +28,20 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import static com.gmail.nossr50.util.ItemUtils.isPickaxe; 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 = Set.of(Material.SPAWNER); public static final Collection<Material> BLAST_MINING_BLACKLIST = Set.of(Material.SPAWNER,
Material.INFESTED_COBBLESTONE, Material.INFESTED_DEEPSLATE, Material.INFESTED_STONE,
Material.INFESTED_STONE_BRICKS, Material.INFESTED_CRACKED_STONE_BRICKS,
Material.INFESTED_CHISELED_STONE_BRICKS, Material.INFESTED_MOSSY_STONE_BRICKS);
private final static Set<String> INFESTED_BLOCKS = Set.of("infested_stone", "infested_cobblestone",
"infested_stone_bricks", "infested_cracked_stone_bricks", "infested_mossy_stone_bricks",
"infested_chiseled_stone_bricks", "infested_deepslate");
public MiningManager(@NotNull McMMOPlayer mcMMOPlayer) { public MiningManager(@NotNull McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.MINING); super(mcMMOPlayer, PrimarySkillType.MINING);
@ -158,15 +161,11 @@ public class MiningManager extends SkillManager {
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class); TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
//SkillUtils.sendSkillMessage(player, SuperAbilityType.BLAST_MINING.getAbilityPlayer(player));
NotificationManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom"); NotificationManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom");
//player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
tnt.setMetadata(MetadataConstants.METADATA_KEY_TRACKED_TNT, mmoPlayer.getPlayerMetadata()); tnt.setMetadata(MetadataConstants.METADATA_KEY_TRACKED_TNT, mmoPlayer.getPlayerMetadata());
tnt.setFuseTicks(0); tnt.setFuseTicks(0);
if (mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 16, 4)) { tnt.setSource(player);
tnt.setSource(player);
}
targetBlock.setType(Material.AIR); targetBlock.setType(Material.AIR);
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis()); mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
@ -174,6 +173,10 @@ public class MiningManager extends SkillManager {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR); mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
} }
private boolean isInfestedBlock(String material) {
return INFESTED_BLOCKS.contains(material.toLowerCase(Locale.ENGLISH));
}
/** /**
* Handler for explosion drops and XP gain. * Handler for explosion drops and XP gain.
* *
@ -209,7 +212,7 @@ public class MiningManager extends SkillManager {
if (isDropIllegal(block.getType())) if (isDropIllegal(block.getType()))
continue; continue;
if (block.getType().isItem() && Probability.ofPercent(50).evaluate()) { if (block.getType().isItem() && Probability.ofPercent(10).evaluate()) {
ItemUtils.spawnItem(getPlayer(), ItemUtils.spawnItem(getPlayer(),
Misc.getBlockCenter(block), Misc.getBlockCenter(block),
new ItemStack(block.getType()), new ItemStack(block.getType()),
@ -218,7 +221,7 @@ public class MiningManager extends SkillManager {
} }
for (Block block : ores) { for (Block block : ores) {
// currentOreYield only used for drop calculations for ores // currentOreYield only used for drop calculations for ores
float currentOreYield = increasedYieldFromBonuses; float currentOreYield = Math.min(increasedYieldFromBonuses, 3F);
if (isDropIllegal(block.getType())) { if (isDropIllegal(block.getType())) {
continue; continue;
@ -235,12 +238,14 @@ public class MiningManager extends SkillManager {
oreDrops, BLAST_MINING_BLACKLIST, 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++) { if (Probability.ofValue(0.5F).evaluate()) {
ItemUtils.spawnItems(getPlayer(), for (int i = 1; i < dropMultiplier; i++) {
Misc.getBlockCenter(block), ItemUtils.spawnItems(getPlayer(),
oreDrops, Misc.getBlockCenter(block),
BLAST_MINING_BLACKLIST, oreDrops,
ItemSpawnReason.BLAST_MINING_ORES_BONUS_DROP); BLAST_MINING_BLACKLIST,
ItemSpawnReason.BLAST_MINING_ORES_BONUS_DROP);
}
} }
} }
} }
@ -255,13 +260,14 @@ public class MiningManager extends SkillManager {
/** /**
* Checks if it would be illegal (in vanilla) to obtain the block * Checks if it would be illegal (in vanilla) to obtain the block
* Certain things should never drop ( such as budding_amethyst ) * Certain things should never drop (such as budding_amethyst and infested blocks)
* *
* @param material target material * @param material target material
* @return true if it's not legal to obtain the block through normal gameplay * @return true if it's not legal to get the block through normal gameplay
*/ */
public boolean isDropIllegal(@NotNull Material material) { public boolean isDropIllegal(@NotNull Material material) {
return material.getKey().getKey().equalsIgnoreCase(BUDDING_AMETHYST); return isInfestedBlock(material.getKey().getKey())
|| material.getKey().getKey().equalsIgnoreCase(BUDDING_AMETHYST);
} }
/** /**