Blast Mining debris yield bugfix

This commit is contained in:
nossr50 2020-05-05 20:15:46 -07:00
parent 4a0d6bf2b7
commit ede5b3fd31
2 changed files with 20 additions and 6 deletions

View File

@ -1,6 +1,7 @@
Version 2.1.128
The first rank of Iron Arm for Unarmed now only gives 1.5 bonus damage instead of 4 (other ranks are the same as before)
Blast Mining nerf reverted
Fixed a bug where debris were not reduced from Blast Mining skills
Fixed a few locale errors with commands
(API) Added ExperienceAPI::addCombatXP for adding combat XP to players, signature may change so its deprecated for now
mcMMO now logs whether or not its using FlatFile or SQL database on load

View File

@ -18,6 +18,7 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@ -161,33 +162,45 @@ public class MiningManager extends SkillManager {
List<BlockState> ores = new ArrayList<BlockState>();
// List<Block> notOres = new ArrayList<>();
List<BlockState> notOres = new ArrayList<>();
for (Block targetBlock : event.blockList()) {
BlockState blockState = targetBlock.getState();
//Containers usually have 0 XP unless someone edited their config in a very strange way
if (ExperienceConfig.getInstance().getXp(PrimarySkillType.MINING, targetBlock) != 0
&& !(targetBlock instanceof Container)
&& !mcMMO.getPlaceStore().isTrue(targetBlock)) {
ores.add(targetBlock.getState());
if(BlockUtils.isOre(blockState)) {
ores.add(blockState);
} else {
notOres.add(blockState);
}
}
}
int xp = 0;
// float oreBonus = (float) (getOreBonus() / 100);
float oreBonus = (float) (getOreBonus() / 100);
//TODO: Pretty sure something is fucked with debrisReduction stuff
// float debrisReduction = (float) (getDebrisReduction() / 100);
float debrisReduction = (float) (getDebrisReduction() / 100);
int dropMultiplier = getDropMultiplier();
float debrisYield = yield - debrisReduction;
// float debrisYield = yield - debrisReduction;
//Drop "debris" based on skill modifiers
for(BlockState blockState : notOres) {
if(RandomUtils.nextFloat() < debrisYield) {
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
}
}
for (BlockState blockState : ores) {
if (RandomUtils.nextFloat() < (yield + getOreBonus())) {
if (RandomUtils.nextFloat() < (yield + oreBonus)) {
xp += Mining.getBlockXp(blockState);
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
if (!mcMMO.getPlaceStore().isTrue(blockState)) {
for (int i = 1; i < dropMultiplier; i++) {
// Bukkit.broadcastMessage("Bonus Drop on Ore: "+blockState.getType().toString());
Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items
}
}