Commits
md_5 authored e9f972d6744
13 13 | .put(CreativeModeTab.TAB_REDSTONE, CreativeCategory.REDSTONE) |
14 14 | .put(CreativeModeTab.TAB_TRANSPORTATION, CreativeCategory.TRANSPORTATION) |
15 15 | .put(CreativeModeTab.TAB_MISC, CreativeCategory.MISC) // Interchangeable with TAB_MATERIALS, same instance |
16 16 | .put(CreativeModeTab.TAB_FOOD, CreativeCategory.FOOD) |
17 17 | .put(CreativeModeTab.TAB_TOOLS, CreativeCategory.TOOLS) |
18 18 | .put(CreativeModeTab.TAB_COMBAT, CreativeCategory.COMBAT) |
19 19 | .put(CreativeModeTab.TAB_BREWING, CreativeCategory.BREWING) |
20 20 | .build(); |
21 21 | |
22 22 | public static CreativeCategory fromNMS(CreativeModeTab tab) { |
23 - | if (!NMS_TO_BUKKIT.containsKey(tab)) { |
23 + | if (tab == null) { |
24 + | return null; |
25 + | } |
26 + | |
27 + | CreativeCategory bukkit = NMS_TO_BUKKIT.get(tab); |
28 + | if (bukkit == null) { |
24 29 | throw new UnsupportedOperationException("Item is not present in any known CreativeModeTab. This is a bug."); |
25 30 | } |
26 31 | |
27 - | return (tab != null) ? NMS_TO_BUKKIT.get(tab) : null; |
32 + | return bukkit; |
28 33 | } |
29 34 | } |