瀏覽代碼

Fixed bug with repairing using materials with byte metadata

GJ 12 年之前
父節點
當前提交
5f4e269efa
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 1 0
      Changelog.txt
  2. 6 2
      src/main/java/com/gmail/nossr50/skills/repair/Repair.java

+ 1 - 0
Changelog.txt

@@ -9,6 +9,7 @@ Key:
 
 Version 1.4.03-dev
  = Fixed bug where players were unable to salvage leather armor
+ = Fixed bug with repairing using materials with byte metadata
 
 Version 1.4.02
  + Added API to get the skill and power level caps.

+ 6 - 2
src/main/java/com/gmail/nossr50/skills/repair/Repair.java

@@ -82,13 +82,17 @@ public class Repair {
     protected static int findInInventory(PlayerInventory inventory, int itemId, byte metadata) {
         int location = -1;
 
-        for (ItemStack item : inventory.getContents()) {
+        ItemStack[] contents = inventory.getContents();
+
+        for (int i = 0; i < contents.length; i++) {
+            ItemStack item = contents[i];
+
             if (item == null) {
                 continue;
             }
 
             if (item.getTypeId() == itemId && item.getData().getData() == metadata) {
-                return location;
+                return i;
             }
         }