diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-02-05 10:08:44 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-02-05 10:08:44 +0800 |
| commit | ea634e7ba29146d4ebc2c05b61257fa6c3b0642e (patch) | |
| tree | cd6caf4e9b77e13b21d1c890bf38604109fd93f2 /api/src/main/java/me/shedaniel | |
| parent | f5b59076cece9e95e76158b17b64fec27616b68b (diff) | |
| download | RoughlyEnoughItems-ea634e7ba29146d4ebc2c05b61257fa6c3b0642e.tar.gz RoughlyEnoughItems-ea634e7ba29146d4ebc2c05b61257fa6c3b0642e.tar.bz2 RoughlyEnoughItems-ea634e7ba29146d4ebc2c05b61257fa6c3b0642e.zip | |
More relocation
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'api/src/main/java/me/shedaniel')
60 files changed, 400 insertions, 376 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java b/api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java index 743538410..d4c29fcea 100644 --- a/api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java +++ b/api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java @@ -37,7 +37,7 @@ import org.jetbrains.annotations.Nullable; import java.util.function.Supplier; @Environment(EnvType.CLIENT) -public interface AutoTransferHandler { +public interface AutoTransferHandler extends Comparable<AutoTransferHandler> { /** * @return the priority of this handler, higher priorities will be called first. @@ -49,6 +49,11 @@ public interface AutoTransferHandler { @NotNull Result handle(@NotNull Context context); + @Override + default int compareTo(@NotNull AutoTransferHandler o) { + return Double.compare(getPriority(), o.getPriority()); + } + @ApiStatus.NonExtendable interface Result { /** @@ -90,7 +95,7 @@ public interface AutoTransferHandler { * Creates a passing result, further handlers will be called. * * @param errorKey The error itself - * @param redSlots A list of slots to be marked as red. Will be passed to {@link TransferRecipeCategory}. + * @param redSlots A list of slots to be marked as red. Will be passed to {@link TransferDisplayCategory}. */ static Result createFailed(String errorKey, IntList redSlots) { return new ResultImpl(errorKey, redSlots, 1744764928); @@ -102,7 +107,7 @@ public interface AutoTransferHandler { * * @param errorKey The error itself * @param color A special color for the button - * @param redSlots A list of slots to be marked as red. Will be passed to {@link TransferRecipeCategory}. + * @param redSlots A list of slots to be marked as red. Will be passed to {@link TransferDisplayCategory}. */ static Result createFailedCustomButtonColor(String errorKey, IntList redSlots, int color) { return new ResultImpl(errorKey, redSlots, color); @@ -155,15 +160,15 @@ public interface AutoTransferHandler { String getErrorKey(); /** - * @return a list of slots to be marked as red. Will be passed to {@link TransferRecipeCategory}. + * @return a list of slots to be marked as red. Will be passed to {@link TransferDisplayCategory}. */ IntList getIntegers(); } @ApiStatus.NonExtendable interface Context { - static Context create(boolean actuallyCrafting, AbstractContainerScreen<?> containerScreen, RecipeDisplay recipeDisplay) { - return new ContextImpl(actuallyCrafting, containerScreen, () -> recipeDisplay); + static Context create(boolean actuallyCrafting, AbstractContainerScreen<?> containerScreen, Display display) { + return new ContextImpl(actuallyCrafting, containerScreen, () -> display); } default Minecraft getMinecraft() { @@ -175,7 +180,7 @@ public interface AutoTransferHandler { @Nullable AbstractContainerScreen<?> getContainerScreen(); - RecipeDisplay getRecipe(); + Display getRecipe(); @Nullable default AbstractContainerMenu getContainer() { @@ -259,9 +264,9 @@ public interface AutoTransferHandler { final class ContextImpl implements Context { private boolean actuallyCrafting; private AbstractContainerScreen<?> containerScreen; - private Supplier<RecipeDisplay> recipeDisplaySupplier; + private Supplier<Display> recipeDisplaySupplier; - private ContextImpl(boolean actuallyCrafting, AbstractContainerScreen<?> containerScreen, Supplier<RecipeDisplay> recipeDisplaySupplier) { + private ContextImpl(boolean actuallyCrafting, AbstractContainerScreen<?> containerScreen, Supplier<Display> recipeDisplaySupplier) { this.actuallyCrafting = actuallyCrafting; this.containerScreen = containerScreen; this.recipeDisplaySupplier = recipeDisplaySupplier; @@ -278,7 +283,7 @@ public interface AutoTransferHandler { } @Override - public RecipeDisplay getRecipe() { + public Display getRecipe() { return recipeDisplaySupplier.get(); } } diff --git a/api/src/main/java/me/shedaniel/rei/api/BuiltinPlugin.java b/api/src/main/java/me/shedaniel/rei/api/BuiltinPlugin.java index f0d3b112a..852a43476 100644 --- a/api/src/main/java/me/shedaniel/rei/api/BuiltinPlugin.java +++ b/api/src/main/java/me/shedaniel/rei/api/BuiltinPlugin.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.impl.Internals; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -42,7 +43,6 @@ public interface BuiltinPlugin { ResourceLocation STONE_CUTTING = new ResourceLocation("minecraft", "plugins/stone_cutting"); ResourceLocation STRIPPING = new ResourceLocation("minecraft", "plugins/stripping"); ResourceLocation BREWING = new ResourceLocation("minecraft", "plugins/brewing"); - ResourceLocation PLUGIN = new ResourceLocation("roughlyenoughitems", "default_plugin"); ResourceLocation COMPOSTING = new ResourceLocation("minecraft", "plugins/composting"); ResourceLocation FUEL = new ResourceLocation("minecraft", "plugins/fuel"); ResourceLocation SMITHING = new ResourceLocation("minecraft", "plugins/smithing"); diff --git a/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java b/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java index df6214642..64e4b27e8 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java +++ b/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java @@ -46,5 +46,4 @@ public interface ButtonAreaSupplier { default String getButtonText() { return "+"; } - } diff --git a/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java index 36b61033a..34f5c2213 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java +++ b/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java @@ -23,6 +23,8 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.registry.category.DisplayCategory; import me.shedaniel.rei.impl.Internals; import me.shedaniel.rei.utils.CollectionUtils; import me.shedaniel.rei.utils.FormattingUtils; @@ -180,7 +182,7 @@ public interface ClientHelper { ViewSearchBuilder addCategories(Collection<ResourceLocation> categories); default ViewSearchBuilder addAllCategories() { - return addCategories(CollectionUtils.map(RecipeHelper.getInstance().getAllCategories(), RecipeCategory::getIdentifier)); + return addCategories(CollectionUtils.map(RecipeRegistry.getInstance().getAllCategories(), DisplayCategory::getIdentifier)); } @NotNull Set<ResourceLocation> getCategories(); @@ -211,6 +213,6 @@ public interface ClientHelper { EntryStack<?> getOutputNotice(); @NotNull - Map<RecipeCategory<?>, List<RecipeDisplay>> buildMap(); + Map<DisplayCategory<?>, List<Display>> buildMap(); } } diff --git a/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java index c84075e79..1eec1243c 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -25,6 +25,7 @@ package me.shedaniel.rei.api; import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.rei.api.favorites.FavoriteEntry; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.gui.config.*; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/api/src/main/java/me/shedaniel/rei/api/Display.java index 582fd09da..a99a1797c 100644 --- a/api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java +++ b/api/src/main/java/me/shedaniel/rei/api/Display.java @@ -23,35 +23,31 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.api.ingredient.EntryIngredient; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.NotNull; -import java.util.Collections; import java.util.List; import java.util.Optional; -public interface RecipeDisplay { +public interface Display { /** * @return a list of inputs */ - @NotNull - List<? extends List<? extends EntryStack<?>>> getInputEntries(); + List<EntryIngredient> getInputEntries(); /** * @return a list of outputs */ - @NotNull - List<? extends List<? extends EntryStack<?>>> getResultingEntries(); + List<EntryIngredient> getResultingEntries(); /** * Gets the required items used in craftable filters * * @return the list of required items */ - @NotNull - default List<? extends List<? extends EntryStack<?>>> getRequiredEntries() { - return Collections.emptyList(); + default List<EntryIngredient> getRequiredEntries() { + return getInputEntries(); } /** @@ -59,7 +55,6 @@ public interface RecipeDisplay { * * @return the identifier of the category */ - @NotNull ResourceLocation getRecipeCategory(); /** @@ -67,7 +62,6 @@ public interface RecipeDisplay { * * @return the recipe location */ - @NotNull default Optional<ResourceLocation> getRecipeLocation() { return Optional.empty(); } diff --git a/api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/api/src/main/java/me/shedaniel/rei/api/DisplayBoundsRegistry.java index d63896203..070fc4460 100644 --- a/api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java +++ b/api/src/main/java/me/shedaniel/rei/api/DisplayBoundsRegistry.java @@ -34,13 +34,13 @@ import org.jetbrains.annotations.NotNull; import java.util.List; @Environment(EnvType.CLIENT) -public interface DisplayHelper { +public interface DisplayBoundsRegistry { /** - * @return the instance of {@link me.shedaniel.rei.api.DisplayHelper} + * @return the instance of {@link DisplayBoundsRegistry} */ @NotNull - static DisplayHelper getInstance() { + static DisplayBoundsRegistry getInstance() { return Internals.getDisplayHelper(); } @@ -75,8 +75,7 @@ public interface DisplayHelper { @ApiStatus.Experimental void resetCache(); - @ApiStatus.Internal - BaseBoundsHandler getBaseBoundsHandler(); + ExclusionZones exclusionZones(); interface DisplayBoundsProvider<T> extends OverlayDecider { /** diff --git a/api/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/api/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java index 82d5c901f..8dcb57197 100644 --- a/api/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java +++ b/api/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java @@ -23,9 +23,11 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.api.registry.category.DisplayCategory; import net.minecraft.world.InteractionResult; +import org.jetbrains.annotations.NotNull; -public interface DisplayVisibilityHandler { +public interface DisplayVisibilityHandler extends Comparable<DisplayVisibilityHandler> { /** * Gets the priority of the handler, the higher the priority, the earlier this is called. @@ -46,6 +48,10 @@ public interface DisplayVisibilityHandler { * @param display the display of the recipe * @return the visibility */ - InteractionResult handleDisplay(RecipeCategory<?> category, RecipeDisplay display); + InteractionResult handleDisplay(DisplayCategory<?> category, Display display); + @Override + default int compareTo(@NotNull DisplayVisibilityHandler o) { + return Double.compare(getPriority(), o.getPriority()); + } } diff --git a/api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java index d93701e09..bdf2ef97b 100644 --- a/api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java +++ b/api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.impl.Internals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/api/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java b/api/src/main/java/me/shedaniel/rei/api/ExclusionZones.java index 0448bc297..244437991 100644 --- a/api/sr |
