Fix bug where no XP was granted when Flux Mining

Fixes #2359
This commit is contained in:
TfT_02 2014-12-22 17:25:55 +01:00
parent 3ea845cfd9
commit 522b085499
3 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Key:
Version 1.5.02-dev Version 1.5.02-dev
+ Added option to config.yml for Chimaera Wings to stop using bed spawn points + Added option to config.yml for Chimaera Wings to stop using bed spawn points
= Fixed bug where no Mining XP was granted when Flux Mining was successful
! Changed Flux Mining mechanics. In order to use the ability, you need to infuse a pickaxe with furnace powers first. ! Changed Flux Mining mechanics. In order to use the ability, you need to infuse a pickaxe with furnace powers first.
Version 1.5.01 Version 1.5.01

View File

@ -17,7 +17,7 @@ public class Mining {
* *
* @param blockState The {@link BlockState} to check ability activation for * @param blockState The {@link BlockState} to check ability activation for
*/ */
protected static int getBlockXp(BlockState blockState) { public static int getBlockXp(BlockState blockState) {
Material blockType = blockState.getType(); Material blockType = blockState.getType();
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE); int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE);

View File

@ -22,6 +22,7 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.mining.Mining;
import com.gmail.nossr50.skills.smelting.Smelting.Tier; import com.gmail.nossr50.skills.smelting.Smelting.Tier;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@ -73,6 +74,9 @@ public class SmeltingManager extends SkillManager {
return false; return false;
} }
// We need to distribute Mining XP here, because the block break event gets cancelled
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage()); SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1); Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1);