Browse Source

Blast Mining can drop deep-slate now fixes #5160

nossr50 1 month ago
parent
commit
99e8ae3722
3 changed files with 29 additions and 11 deletions
  1. 5 3
      Changelog.txt
  2. 7 2
      pom.xml
  3. 17 6
      src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java

+ 5 - 3
Changelog.txt

@@ -1,5 +1,9 @@
 Version 2.2.035
 Version 2.2.035
     Support for new additions from Minecraft 1.21.5
     Support for new additions from Minecraft 1.21.5
+    Fixed bug where Blast Mining would not drop deep slate
+    Swords subskill Stab is now configurable in advanced.yml
+    Added 'Skills.Swords.Stab.Base_Damage' to advanced.yml
+    Added 'Skills.Swords.Stab.Per_Rank_Multiplier' to advanced.yml
     Added 'Bush' to experience.yml for Herbalism
     Added 'Bush' to experience.yml for Herbalism
     Added 'Bush' to config.yml Bonus Drops for Herbalism
     Added 'Bush' to config.yml Bonus Drops for Herbalism
     Added 'Cactus_Flower' to experience.yml for Herbalism
     Added 'Cactus_Flower' to experience.yml for Herbalism
@@ -14,9 +18,7 @@ Version 2.2.035
     Added 'Tall_Dry_Grass' to config.yml Bonus Drops for Herbalism
     Added 'Tall_Dry_Grass' to config.yml Bonus Drops for Herbalism
     Added 'Wildflowers' to experience.yml for Herbalism
     Added 'Wildflowers' to experience.yml for Herbalism
     Added 'Wildflowers' to config.yml Bonus Drops for Herbalism
     Added 'Wildflowers' to config.yml Bonus Drops for Herbalism
-    Swords subskill Stab is now configurable in advanced.yml
-    Added 'Skills.Swords.Stab.Base_Damage' to advanced.yml
-    Added 'Skills.Swords.Stab.Per_Rank_Multiplier' to advanced.yml
+
 
 
     NOTES:
     NOTES:
     The mob variants will use the "base" mob definition for values for now, such a a warm chicken using chicken values from experience.yml
     The mob variants will use the "base" mob definition for values for now, such a a warm chicken using chicken values from experience.yml

+ 7 - 2
pom.xml

@@ -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.035-SNAPSHOT</version>
+    <version>2.2.035</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>
@@ -14,7 +14,7 @@
 
 
     <properties>
     <properties>
 <!--        <spigot.version>1.19-R0.1-SNAPSHOT</spigot.version>-->
 <!--        <spigot.version>1.19-R0.1-SNAPSHOT</spigot.version>-->
-        <spigot.version>1.21.4-R0.1-SNAPSHOT</spigot.version>
+        <spigot.version>1.21.5-R0.1-SNAPSHOT</spigot.version>
         <adventure.version>4.3.5-SNAPSHOT</adventure.version>
         <adventure.version>4.3.5-SNAPSHOT</adventure.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>17</maven.compiler.source>
         <maven.compiler.source>17</maven.compiler.source>
@@ -385,6 +385,11 @@
             <version>3.0.2</version>
             <version>3.0.2</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
+<!--        <dependency>-->
+<!--            <groupId>io.papermc.paper</groupId>-->
+<!--            <artifactId>paper-api</artifactId>-->
+<!--            <version>1.21.5-R0.1-SNAPSHOT</version>-->
+<!--        </dependency>-->
         <dependency>
         <dependency>
             <groupId>org.spigotmc</groupId>
             <groupId>org.spigotmc</groupId>
             <artifactId>spigot-api</artifactId>
             <artifactId>spigot-api</artifactId>

+ 17 - 6
src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java

@@ -58,11 +58,16 @@ public class MiningManager extends SkillManager {
     public boolean canDetonate() {
     public boolean canDetonate() {
         Player player = getPlayer();
         Player player = getPlayer();
 
 
-        return canUseBlastMining() && player.isSneaking()
-                && (isPickaxe(getPlayer().getInventory().getItemInMainHand()) || player.getInventory().getItemInMainHand().getType() == mcMMO.p.getGeneralConfig().getDetonatorItem())
+        return canUseBlastMining()
+                && player.isSneaking()
+                && (isPickaxe(getPlayer().getInventory().getItemInMainHand()) || isDetonatorInHand(player))
                 && Permissions.remoteDetonation(player);
                 && Permissions.remoteDetonation(player);
     }
     }
 
 
+    private static boolean isDetonatorInHand(Player player) {
+        return player.getInventory().getItemInMainHand().getType() == mcMMO.p.getGeneralConfig().getDetonatorItem();
+    }
+
     public boolean canUseBlastMining() {
     public boolean canUseBlastMining() {
         //Not checking permissions?
         //Not checking permissions?
         return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BLAST_MINING);
         return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BLAST_MINING);
@@ -76,7 +81,8 @@ public class MiningManager extends SkillManager {
     }
     }
 
 
     public boolean canDoubleDrop() {
     public boolean canDoubleDrop() {
-        return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS);
+        return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS)
+                && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS);
     }
     }
 
 
     public boolean canMotherLode() {
     public boolean canMotherLode() {
@@ -171,7 +177,9 @@ public class MiningManager extends SkillManager {
 
 
         mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
         mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
         mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
         mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
-        mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
+        mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(mmoPlayer.getPlayer(),
+                new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING),
+                (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
     }
     }
 
 
     private boolean isInfestedBlock(String material) {
     private boolean isInfestedBlock(String material) {
@@ -190,8 +198,8 @@ public class MiningManager extends SkillManager {
 
 
         var increasedYieldFromBonuses = yield + (yield * getOreBonus());
         var increasedYieldFromBonuses = yield + (yield * getOreBonus());
         // Strip out only stuff that gives mining XP
         // Strip out only stuff that gives mining XP
-        List<Block> ores = new ArrayList<>();
-        List<Block> notOres = new ArrayList<>();
+        final List<Block> ores = new ArrayList<>();
+        final List<Block> notOres = new ArrayList<>();
         for (Block targetBlock : event.blockList()) {
         for (Block targetBlock : event.blockList()) {
 
 
             if(mcMMO.getUserBlockTracker().isIneligible(targetBlock))
             if(mcMMO.getUserBlockTracker().isIneligible(targetBlock))
@@ -200,6 +208,8 @@ public class MiningManager extends SkillManager {
             if (ExperienceConfig.getInstance().getXp(PrimarySkillType.MINING, targetBlock) != 0) {
             if (ExperienceConfig.getInstance().getXp(PrimarySkillType.MINING, targetBlock) != 0) {
                 if (BlockUtils.isOre(targetBlock) && !(targetBlock instanceof Container)) {
                 if (BlockUtils.isOre(targetBlock) && !(targetBlock instanceof Container)) {
                     ores.add(targetBlock);
                     ores.add(targetBlock);
+                } else {
+                    notOres.add(targetBlock);
                 }
                 }
             } else {
             } else {
                 notOres.add(targetBlock);
                 notOres.add(targetBlock);
@@ -220,6 +230,7 @@ public class MiningManager extends SkillManager {
                         ItemSpawnReason.BLAST_MINING_DEBRIS_NON_ORES); // Initial block that would have been dropped
                         ItemSpawnReason.BLAST_MINING_DEBRIS_NON_ORES); // Initial block that would have been dropped
             }
             }
         }
         }
+
         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 = Math.min(increasedYieldFromBonuses, 3F);
             float currentOreYield = Math.min(increasedYieldFromBonuses, 3F);