diff options
| author | Daniel She <shekwancheung0528@gmail.com> | 2019-05-12 10:55:21 +0800 |
|---|---|---|
| committer | Daniel She <shekwancheung0528@gmail.com> | 2019-05-12 10:55:21 +0800 |
| commit | f51e5af85e26f588cbe2eba2eef728e783201bc8 (patch) | |
| tree | e490afcfe8974af8a6c65954667bf822505224d4 /src/main/java/me/shedaniel/rei/api/ItemRegistry.java | |
| parent | 64c240a5a5eb6b4312b86e24ddbaaa70ada49359 (diff) | |
| parent | b99108611ea89dc0eda6c433447ce398a98ad4ad (diff) | |
| download | RoughlyEnoughItems-f51e5af85e26f588cbe2eba2eef728e783201bc8.tar.gz RoughlyEnoughItems-f51e5af85e26f588cbe2eba2eef728e783201bc8.tar.bz2 RoughlyEnoughItems-f51e5af85e26f588cbe2eba2eef728e783201bc8.zip | |
Merge branch '1.14-dev' into 1.14
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api/ItemRegistry.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/api/ItemRegistry.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java index 1b3b0218b..8751da416 100644 --- a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java @@ -1,3 +1,8 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei.api; import net.minecraft.item.Item; @@ -7,12 +12,29 @@ import java.util.List; public interface ItemRegistry { + /** + * Gets the current unmodifiable item list + * + * @return an unmodifiable item list + */ List<ItemStack> getItemList(); + /** + * Gets the current modifiable item list + * + * @return an modifiable item list + */ + @Deprecated List<ItemStack> getModifiableItemList(); ItemStack[] getAllStacksFromItem(Item item); + /** + * Registers an new stack to the item list + * + * @param afterItem + * @param stack the stack to register + */ void registerItemStack(Item afterItem, ItemStack stack); default void registerItemStack(Item afterItem, ItemStack... stacks) { @@ -27,6 +49,12 @@ public interface ItemRegistry { registerItemStack(null, stack); } + /** + * Checks if a stack is already registered + * + * @param stack the stack to check + * @return whether the stack has been registered + */ default boolean alreadyContain(ItemStack stack) { return getItemList().stream().anyMatch(stack1 -> ItemStack.areEqual(stack, stack1)); } |
