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/api/EntryRegistry.java | |
| 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/api/EntryRegistry.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/api/EntryRegistry.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java index 1a8c5f157..a7765036d 100644 --- a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java @@ -10,6 +10,7 @@ import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import java.util.Collection; import java.util.List; public interface EntryRegistry { @@ -75,6 +76,16 @@ public interface EntryRegistry { /** * Registers multiple stacks to the item list * + * @param afterStack the stack to put after + * @param stacks the stacks to register + */ + default void registerEntriesAfter(EntryStack afterStack, Collection<? extends EntryStack> stacks) { + registerEntriesAfter(afterStack, stacks.toArray(new EntryStack[0])); + } + + /** + * Registers multiple stacks to the item list + * * @param stacks the stacks to register */ default void registerEntries(EntryStack... stacks) { |
