diff options
| author | AlexIIL <alexj9@me.com> | 2019-12-25 13:01:21 +0000 |
|---|---|---|
| committer | AlexIIL <alexj9@me.com> | 2019-12-25 13:07:28 +0000 |
| commit | 71971a01ca9ff09d220a49970255069a8efe0046 (patch) | |
| tree | 05cdc2eb302dbeddb47199263297296b0f5eb820 /src/main/java/me/shedaniel/rei/plugin | |
| parent | a0237130d56e5dd9261ffab7298909c6670153e0 (diff) | |
| download | RoughlyEnoughItems-71971a01ca9ff09d220a49970255069a8efe0046.tar.gz RoughlyEnoughItems-71971a01ca9ff09d220a49970255069a8efe0046.tar.bz2 RoughlyEnoughItems-71971a01ca9ff09d220a49970255069a8efe0046.zip | |
Optimise EntryRegistryImpl.registerEntries by first checking in a set to see if the given entry already exists before adding it, instead of looping through the whole list to see if any of them match.
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java index feb52f347..c0ccf527b 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java @@ -110,15 +110,17 @@ public class DefaultPlugin implements REIPluginV0 { entryRegistry.registerEntry(EntryStack.create(item)); } EntryStack stack = EntryStack.create(Items.ENCHANTED_BOOK); + List<EntryStack> enchantments = new ArrayList<>(); for (Enchantment enchantment : Registry.ENCHANTMENT) { for (int i = enchantment.getMinimumLevel(); i <= enchantment.getMaximumLevel(); i++) { Map<Enchantment, Integer> map = new HashMap<>(); map.put(enchantment, i); ItemStack itemStack = new ItemStack(Items.ENCHANTED_BOOK); EnchantmentHelper.set(map, itemStack); - entryRegistry.registerEntriesAfter(stack, EntryStack.create(itemStack)); + enchantments.add(EntryStack.create(itemStack)); } } + entryRegistry.registerEntriesAfter(stack, enchantments); for (Fluid fluid : Registry.FLUID) { if (!(fluid instanceof EmptyFluid)) entryRegistry.registerEntry(EntryStack.create(fluid)); |
