Blast Mining shouldn't drop Budding Amethyst

Fixes #4589
This commit is contained in:
nossr50 2021-08-10 13:46:33 -07:00
parent dc94fedee1
commit 6d9a9d165d
2 changed files with 22 additions and 24 deletions

View File

@ -1,4 +1,5 @@
Version 2.1.201
Blast Mining no longer drops Budding Amethyst since its not legal to obtain this item through normal gameplay
Portuguese translation of Woodcutting changed back to Lenhador
Version 2.1.200

View File

@ -26,11 +26,15 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MiningManager extends SkillManager {
public static final String BUDDING_AMETHYST = "budding_amethyst";
public MiningManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.MINING);
}
@ -133,29 +137,6 @@ public class MiningManager extends SkillManager {
* @param event The {@link EntityExplodeEvent}
*/
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
public void blastMiningDropProcessing(float yield, EntityExplodeEvent event) {
if (yield == 0)
return;
@ -181,19 +162,24 @@ public class MiningManager extends SkillManager {
int xp = 0;
float oreBonus = (float) (getOreBonus() / 100);
//TODO: Pretty sure something is fucked with debrisReduction stuff
float debrisReduction = (float) (getDebrisReduction() / 100);
int dropMultiplier = getDropMultiplier();
float debrisYield = yield - debrisReduction;
//Drop "debris" based on skill modifiers
for(BlockState blockState : notOres) {
if(isDropIllegal(blockState.getType()))
continue;
if(RandomUtils.nextFloat() < debrisYield) {
Misc.spawnItem(getPlayer(), Misc.getBlockCenter(blockState), new ItemStack(blockState.getType()), ItemSpawnReason.BLAST_MINING_DEBRIS_NON_ORES); // Initial block that would have been dropped
}
}
for (BlockState blockState : ores) {
if(isDropIllegal(blockState.getType()))
continue;
if (RandomUtils.nextFloat() < (yield + oreBonus)) {
xp += Mining.getBlockXp(blockState);
@ -216,6 +202,17 @@ public class MiningManager extends SkillManager {
applyXpGain(xp, XPGainReason.PVE);
}
/**
* Checks if it would be illegal (in vanilla) to obtain the block
* Certain things should never drop ( such as budding_amethyst )
*
* @param material target material
* @return true if it's not legal to obtain the block through normal gameplay
*/
public boolean isDropIllegal(@NotNull Material material) {
return material.getKey().getKey().equalsIgnoreCase(BUDDING_AMETHYST);
}
/**
* Increases the blast radius of the explosion.
*