Răsfoiți Sursa

Fix bug where no XP was granted when Flux Mining

Fixes #2359
TfT_02 10 ani în urmă
părinte
comite
522b085499

+ 1 - 0
Changelog.txt

@@ -9,6 +9,7 @@ Key:
 
 Version 1.5.02-dev
  + 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.
 
 Version 1.5.01

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/mining/Mining.java

@@ -17,7 +17,7 @@ public class Mining {
      *
      * @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();
         int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE);
 

+ 4 - 0
src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java

@@ -22,6 +22,7 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason;
 import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
 import com.gmail.nossr50.locale.LocaleLoader;
 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.util.BlockUtils;
 import com.gmail.nossr50.util.Misc;
@@ -73,6 +74,9 @@ public class SmeltingManager extends SkillManager {
                 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());
 
             Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1);