Skip to content

Commit

Permalink
Merge pull request #73 from Noogear/master
Browse files Browse the repository at this point in the history
修复自己提交的错误,感谢依神的指导
  • Loading branch information
YufiriaMazenta authored Aug 21, 2024
2 parents c54555d + 99a45b1 commit 8282e13
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public CraftingRecipeCreator(@NotNull Player player, RecipeType recipeType, @Not
ConfigWrapper recipeConfig = createRecipeConfig(recipeName);
switch (recipeType()) {
case SHAPED:
Map<String, Character> itemRepeatMap = new HashMap<>();
Map<String, Character> itemRepeatMap = new LinkedHashMap<>();
List<String> shape = new ArrayList<>();
Map<Character, String> itemNameMap = new HashMap<>();
Map<Character, String> itemNameMap = new LinkedHashMap<>();
char[] tmp = " ".toCharArray(); //9个空格
char c = 'a';
for(int i = 0; i < sourceList.size(); i++){
Expand All @@ -88,19 +88,15 @@ public CraftingRecipeCreator(@NotNull Player player, RecipeType recipeType, @Not
continue;
}
if (!itemRepeatMap.containsKey(sourceItem)){
itemRepeatMap.put(sourceList.get(i),c);
itemRepeatMap.put(sourceItem,c);
c++;
}
tmp[i] = itemRepeatMap.get(sourceItem);
}
for (int i = 0; i < 9; i += 3) {
shape.add(new String(tmp,i,3));
}
c = 'a';
for (String key : itemRepeatMap.keySet()){
itemNameMap.put(c,key);
c++;
}
itemRepeatMap.forEach((k,v)->itemNameMap.put(v,k));
shape.removeIf(s -> s.trim().isEmpty());
removeEmptyColumn(shape);

Expand Down

0 comments on commit 8282e13

Please sign in to comment.