Parcourir la source

Fixed bug relating to "empty" ItemStacks. Fixes #807

GJ il y a 12 ans
Parent
commit
bd45fff1b4

+ 2 - 0
Changelog.txt

@@ -9,6 +9,8 @@ Key:
 
 Version 1.4.03-dev
  + Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
+ = Fixed bug with Blast Mining not dropping blocks correctly
+ = Fixed bug with custom blocks not working
  = Fixed bug where triple drops would award twice the amount of experience in Herbalism and Mining
  = Fixed bug where Green Thumb would consume wheat instead of seeds
  = Fixed bug where Green Terra would consume twice the amount of seed when used on crops

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

@@ -72,7 +72,7 @@ public class Mining {
 
             default:
                 if (ModUtils.isCustomMiningBlock(blockState)) {
-                    Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack());
+                    Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
                 }
                 return;
         }

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

@@ -142,7 +142,7 @@ public class MiningManager extends SkillManager{
                     xp += Mining.getBlockXp(blockState);
                 }
 
-                Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack()); // Initial block that would have been dropped
+                Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1)); // Initial block that would have been dropped
 
                 if (!mcMMO.placeStore.isTrue(blockState)) {
                     for (int i = 1; i < dropMultiplier; i++) {
@@ -156,7 +156,7 @@ public class MiningManager extends SkillManager{
         if (debrisYield > 0) {
             for (BlockState blockState : debris) {
                 if (Misc.getRandom().nextFloat() < debrisYield) {
-                    Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack());
+                    Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
                 }
             }
         }

+ 9 - 9
src/main/java/com/gmail/nossr50/util/ModUtils.java

@@ -52,7 +52,7 @@ public final class ModUtils {
      */
     public static CustomBlock getCustomBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customItems.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -88,7 +88,7 @@ public final class ModUtils {
      */
     public static boolean isCustomWoodcuttingBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -110,7 +110,7 @@ public final class ModUtils {
      */
     public static boolean isCustomAbilityBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customAbilityBlocks.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -132,7 +132,7 @@ public final class ModUtils {
      */
     public static boolean isCustomMiningBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customMiningBlocks.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -154,7 +154,7 @@ public final class ModUtils {
      */
     public static boolean isCustomExcavationBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customExcavationBlocks.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -176,7 +176,7 @@ public final class ModUtils {
      */
     public static boolean isCustomHerbalismBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customHerbalismBlocks.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -198,7 +198,7 @@ public final class ModUtils {
      */
     public static boolean isCustomLeafBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customLeaves.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -220,7 +220,7 @@ public final class ModUtils {
      */
     public static boolean isCustomLogBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customLogs.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@@ -242,7 +242,7 @@ public final class ModUtils {
      */
     public static boolean isCustomOreBlock(BlockState blockState) {
         if (customBlocksEnabled) {
-            ItemStack item = blockState.getData().toItemStack();
+            ItemStack item = blockState.getData().toItemStack(1);
 
             if (CustomBlockConfig.getInstance().customOres.contains(item)) {
                 for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {