diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-05-28 20:28:48 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-05-28 20:28:48 +0800 |
| commit | 0bde3511d83e54b990c3840573523d643cc843e9 (patch) | |
| tree | fed3512555478e521fb69edc717f6ac791c26b72 /api | |
| parent | df1c72250631fb89ffde9ecca7f47c1bdc44620a (diff) | |
| download | RoughlyEnoughItems-0bde3511d83e54b990c3840573523d643cc843e9.tar.gz RoughlyEnoughItems-0bde3511d83e54b990c3840573523d643cc843e9.tar.bz2 RoughlyEnoughItems-0bde3511d83e54b990c3840573523d643cc843e9.zip | |
Fix #540
Diffstat (limited to 'api')
8 files changed, 36 insertions, 27 deletions
diff --git a/api/build.gradle b/api/build.gradle index 40ea8f83d..8a5f988f3 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,4 +1,4 @@ -archivesBaseName = rootProject.name + "-" + project.name +archivesBaseName = rootProject.name + "-" + project.name dependencies { modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}") diff --git a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java index 20bfdd767..571b6022a 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java @@ -58,10 +58,6 @@ public interface ConfigObject { boolean isGrabbingItems(); - boolean isConfigScreenAnimated(); - - boolean isCreditsScreenAnimated(); - boolean isFavoritesAnimated(); boolean isToastDisplayedOnCopyIdentifier(); @@ -92,8 +88,6 @@ public interface ConfigObject { int getMaxRecipePerPage(); - boolean doesShowUtilsButtons(); - boolean doesDisableRecipeBook(); boolean doesFixTabCloseContainer(); diff --git a/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java b/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java index 6ddd1b416..7280c4e6a 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java @@ -38,8 +38,7 @@ public interface Views extends Reloadable<REIClientPlugin> { /** * Returns all craftable items from materials. * - * @param inventoryItems the materials * @return the list of craftable entries */ - Collection<EntryStack<?>> findCraftableEntriesByMaterials(Iterable<? extends EntryStack<?>> inventoryItems); + Collection<EntryStack<?>> findCraftableEntriesByMaterials(); } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/display/DisplaySerializerRegistry.java b/api/src/main/java/me/shedaniel/rei/api/common/display/DisplaySerializerRegistry.java index 8b2c8c0e1..e1d62beb7 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/display/DisplaySerializerRegistry.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/display/DisplaySerializerRegistry.java @@ -27,8 +27,13 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.plugins.PluginManager; import me.shedaniel.rei.api.common.plugins.REIPlugin; import me.shedaniel.rei.api.common.registry.Reloadable; +import me.shedaniel.rei.api.common.transfer.info.MenuSerializationContext; import net.minecraft.nbt.CompoundTag; +/** + * The display serializer used for display transfers. + * This is mostly a fallback system for {@link me.shedaniel.rei.api.common.transfer.info.MenuInfo#save(MenuSerializationContext, Display)}. + */ public interface DisplaySerializerRegistry extends Reloadable<REIPlugin<?>> { static DisplaySerializerRegistry getInstance() { return PluginManager.getInstance().get(DisplaySerializerRegistry.class); @@ -37,9 +42,6 @@ public interface DisplaySerializerRegistry extends Reloadable<REIPlugin<?>> { /** * Registers a {@link DisplaySerializer} for serializing a {@link Display} for syncing across server-client, and * for serializing displays to disk for favorites. - * <p> - * Since REI 6, all {@link me.shedaniel.rei.api.client.registry.display.DisplayCategory} are required to register their serializers, - * or mark themselves as unavailable for serialization. * * @param categoryId the category identifier of the display * @param serializer the serializer of the display @@ -50,20 +52,15 @@ public interface DisplaySerializerRegistry extends Reloadable<REIPlugin<?>> { /** * Marks a {@link Display} as unavailable to sync across server-client, and * for serializing displays to disk for favorites. - * <p> - * Since REI 6, all {@link me.shedaniel.rei.api.client.registry.display.DisplayCategory} are required to register their serializers, - * or mark themselves as unavailable for serialization. * * @param categoryId the category identifier of the display * @param <D> the type of the display */ <D extends Display> void registerNotSerializable(CategoryIdentifier<D> categoryId); - <D extends Display> boolean hasRegistered(CategoryIdentifier<D> categoryId); - <D extends Display> boolean hasSerializer(CategoryIdentifier<D> categoryId); - <D extends Display> CompoundTag save(CategoryIdentifier<? extends D> categoryId, D display, CompoundTag tag); + <D extends Display> CompoundTag save(D display, CompoundTag tag); <D extends Display> D read(CategoryIdentifier<? extends D> categoryId, CompoundTag tag); } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPlugin.java b/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPlugin.java index 44998c914..35394feab 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPlugin.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPlugin.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.api.common.plugins; +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; import me.shedaniel.rei.api.common.entry.comparison.FluidComparatorRegistry; import me.shedaniel.rei.api.common.entry.comparison.ItemComparatorRegistry; @@ -33,21 +34,21 @@ import org.jetbrains.annotations.ApiStatus; import java.util.Collection; import java.util.Collections; +/** + * Base interface for a REI plugin. + * + * @see REIServerPlugin + * @see REIClientPlugin + */ @ApiStatus.OverrideOnly public interface REIPlugin<P extends REIPlugin<?>> extends Comparable<REIPlugin<P>>, REIPluginProvider<P> { /** - * @return the priority of the plugin, the smaller the number, the earlier it is called. + * @return the priority of the plugin, the smaller the priority, the earlier it is called. */ - default int getPriority() { + default double getPriority() { return 0; } - default String getPluginName() { - Class<?> self = getClass(); - String simpleName = self.getSimpleName(); - return simpleName == null ? self.getName() : simpleName; - } - @Override default int compareTo(REIPlugin o) { return Double.compare(getPriority(), o.getPriority()); diff --git a/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPluginProvider.java b/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPluginProvider.java index 4380fb0cb..4f0f6d815 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPluginProvider.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPluginProvider.java @@ -25,6 +25,11 @@ package me.shedaniel.rei.api.common.plugins; import java.util.Collection; +/** + * A provider for {@link REIPlugin}. + * + * @param <P> the type of plugin + */ public interface REIPluginProvider<P extends REIPlugin<?>> { default String getPluginProviderName() { Class<?> self = getClass(); @@ -32,7 +37,18 @@ public interface REIPluginProvider<P extends REIPlugin<?>> { return simpleName == null ? self.getName() : simpleName; } + /** + * Provides the collection of REI plugins, can be dynamic. + * + * @return the collection of REI plugins. + */ Collection<P> provide(); + /** + * Returns the type of plugin this provider provides, + * should be same as {@link P}. + * + * @return the type of plugin this provider provides + */ Class<P> getPluginProviderClass(); } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfo.java b/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfo.java index d65b2b6eb..ca2ff4c41 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfo.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfo.java @@ -134,7 +134,7 @@ public interface MenuInfo<T extends AbstractContainerMenu, D extends Display> ex * @return the {@link CompoundTag} serialized */ default CompoundTag save(MenuSerializationContext<T, ?, D> context, D display) { - return DisplaySerializerRegistry.getInstance().save(display.getCategoryIdentifier(), display, new CompoundTag()); + return DisplaySerializerRegistry.getInstance().save(display, new CompoundTag()); } /** diff --git a/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfoRegistry.java b/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfoRegistry.java index 29942fcc0..44ca628b6 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfoRegistry.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfoRegistry.java @@ -29,6 +29,7 @@ import me.shedaniel.rei.api.common.plugins.PluginManager; import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.api.common.registry.Reloadable; import net.minecraft.world.inventory.AbstractContainerMenu; +import org.jetbrains.annotations.Nullable; import java.util.function.Predicate; @@ -44,6 +45,7 @@ public interface MenuInfoRegistry extends Reloadable<REIServerPlugin> { <D extends Display> void registerGeneric(Predicate<CategoryIdentifier<?>> categoryPredicate, MenuInfoProvider<?, D> menuInfo); + @Nullable <C extends AbstractContainerMenu, D extends Display> MenuInfo<C, D> get(CategoryIdentifier<D> category, Class<C> menuClass); int infoSize(); |
