diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-06-18 16:38:49 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-06-18 16:38:49 +0800 |
| commit | 4d0b2d3f50bf56b83498a3b787ac08afaeb85eff (patch) | |
| tree | 77c206a271fb6f5b6ae1dbe3d24d794420cf1841 /src/main/java/me/shedaniel/rei/api | |
| parent | 69a531030df74768d86025cd5668e0418a3c1f07 (diff) | |
| download | RoughlyEnoughItems-4d0b2d3f50bf56b83498a3b787ac08afaeb85eff.tar.gz RoughlyEnoughItems-4d0b2d3f50bf56b83498a3b787ac08afaeb85eff.tar.bz2 RoughlyEnoughItems-4d0b2d3f50bf56b83498a3b787ac08afaeb85eff.zip | |
up to 4x faster search
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api')
12 files changed, 53 insertions, 93 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java b/src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java new file mode 100644 index 000000000..ec378ac89 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java @@ -0,0 +1,16 @@ +package me.shedaniel.rei.api; + +import me.shedaniel.rei.gui.ContainerScreenOverlay; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; + +public interface AutoCraftingHandler { + + default double getPriority() { + return 0d; + } + + boolean handle(MinecraftClient minecraft, Screen recipeViewingScreen, AbstractContainerScreen<?> parentScreen, ContainerScreenOverlay overlay); + +} diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java index 5cabf4ad1..755ca84b3 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java +++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java @@ -60,7 +60,7 @@ public interface DisplayHelper { * * @return the base class */ - Class getBaseSupportedClass(); + Class<?> getBaseSupportedClass(); /** * Gets the left bounds of the overlay diff --git a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java index ddf1f3a75..36fa1634b 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java +++ b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java @@ -13,7 +13,7 @@ public interface DisplaySettings<T extends RecipeDisplay> { * @param category the category of the display * @return the height */ - int getDisplayHeight(RecipeCategory category); + int getDisplayHeight(RecipeCategory<?> category); /** * Gets the recipe display width @@ -22,17 +22,19 @@ public interface DisplaySettings<T extends RecipeDisplay> { * @param display the display of the recipe * @return the width */ - int getDisplayWidth(RecipeCategory category, T display); + int getDisplayWidth(RecipeCategory<?> category, T display); /** * Gets the maximum amount of recipe displays of the category displayed at the same time. + * * @param category the category of the displays * @return the maximum amount */ - int getMaximumRecipePerPage(RecipeCategory category); + int getMaximumRecipePerPage(RecipeCategory<?> category); /** * Gets the fixed amount of recipes per page. + * * @return the amount of recipes, returns -1 if not fixed */ default int getFixedRecipesPerPage() { diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java deleted file mode 100644 index 0bfdb024c..000000000 --- a/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api; - -public enum DisplayVisibility { - ALWAYS_VISIBLE, - @Deprecated CONFIG_OPTIONAL, - NEVER_VISIBLE, - PASS -} diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java index 429306ff2..f29ca9129 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java +++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java @@ -5,6 +5,8 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.gui.config.DisplayVisibility; + public interface DisplayVisibilityHandler { /** @@ -26,6 +28,6 @@ public interface DisplayVisibilityHandler { * @param display the display of the recipe * @return the visibility */ - DisplayVisibility handleDisplay(RecipeCategory category, RecipeDisplay display); + DisplayVisibility handleDisplay(RecipeCategory<?> category, RecipeDisplay display); } diff --git a/src/main/java/me/shedaniel/rei/api/ItemCheatingMode.java b/src/main/java/me/shedaniel/rei/api/ItemCheatingMode.java deleted file mode 100644 index 56c97027e..000000000 --- a/src/main/java/me/shedaniel/rei/api/ItemCheatingMode.java +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api; - -public enum ItemCheatingMode { - REI_LIKE, - JEI_LIKE; -} diff --git a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java index 0f39b7205..64c53c300 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java @@ -104,20 +104,20 @@ public interface RecipeCategory<T extends RecipeDisplay> { * * @return the display settings */ - default DisplaySettings getDisplaySettings() { + default DisplaySettings<T> getDisplaySettings() { return new DisplaySettings<T>() { @Override - public int getDisplayHeight(RecipeCategory category) { + public int getDisplayHeight(RecipeCategory<?> category) { return 66; } @Override - public int getDisplayWidth(RecipeCategory category, T display) { + public int getDisplayWidth(RecipeCategory<?> category, T display) { return 150; } @Override - public int getMaximumRecipePerPage(RecipeCategory category) { + public int getMaximumRecipePerPage(RecipeCategory<?> category) { return 99; } }; diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java index 302667efd..a2dac34f4 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java @@ -13,7 +13,7 @@ import net.minecraft.util.Identifier; import java.util.List; import java.util.Optional; -public interface RecipeDisplay<T extends Recipe> { +public interface RecipeDisplay { /** * @return a list of items @@ -50,11 +50,4 @@ public interface RecipeDisplay<T extends Recipe> { return Optional.empty(); } - /** - * @return the optional recipe - * @deprecated stop - */ - @Deprecated - default Optional<? extends Recipe> getRecipe() {return null;} - } diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java index 19d411cfd..18c074121 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java @@ -26,6 +26,10 @@ public interface RecipeHelper { return RoughlyEnoughItemsCore.getRecipeHelper(); } + AutoCraftingHandler registerAutoCraftingHandler(AutoCraftingHandler handler); + + List<AutoCraftingHandler> getSortedAutoCraftingHandler(); + /** * Gets the total recipe count registered * @@ -204,7 +208,7 @@ public interface RecipeHelper { * @param liveRecipeGenerator the generator to register * @apiNote Still work in progress */ - void registerLiveRecipeGenerator(LiveRecipeGenerator liveRecipeGenerator); + void registerLiveRecipeGenerator(LiveRecipeGenerator<?> liveRecipeGenerator); <T extends Recipe<?>> void registerRecipes(Identifier category, Class<T> recipeClass, Function<T, RecipeDisplay> mappingFunction); diff --git a/src/main/java/me/shedaniel/rei/api/RelativePoint.java b/src/main/java/me/shedaniel/rei/api/RelativePoint.java deleted file mode 100644 index 0d54e866e..000000000 --- a/src/main/java/me/shedaniel/rei/api/RelativePoint.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api; - -public class RelativePoint { - - private double relativeX, relativeY; - - public RelativePoint(double relativeX, double relativeY) { - this.relativeX = relativeX; - this.relativeY = relativeY; - } - - public double getRelativeX() { - return relativeX; - } - - public double getRelativeY() { - return relativeY; - } - - public double getX(double width) { - return width * relativeX; - } - - public double getY(double height) { - return height * relativeY; - } - -} diff --git a/src/main/java/me/shedaniel/rei/api/Renderable.java b/src/main/java/me/shedaniel/rei/api/Renderable.java index 75d9161be..2d4c258ca 100644 --- a/src/main/java/me/shedaniel/rei/api/Renderable.java +++ b/src/main/java/me/shedaniel/rei/api/Renderable.java @@ -17,7 +17,7 @@ import java.util.function.Supplier; /** * The base class for renderables */ -public interface Renderable { +public class Renderable { /** * Gets an item stack renderer by an item stack supplier @@ -25,7 +25,7 @@ public interface Renderable { * @param supplier the supplier for getting the item stack * @return the item stack renderer */ - static ItemStackRenderer fromItemStackSupplier(Supplier<ItemStack> supplier) { + public static ItemStackRenderer fromItemStackSupplier(Supplier<ItemStack> supplier) { return new ItemStackRenderer() { @Override public ItemStack getItemStack() { @@ -40,7 +40,7 @@ public interface Renderable { * @param stack the item stack to be displayed * @return the item stack renderer */ - static ItemStackRenderer fromItemStack(ItemStack stack) { + public static ItemStackRenderer fromItemStack(ItemStack stack) { return fromItemStackSupplier(() -> stack); } @@ -49,7 +49,7 @@ public interface Renderable { * * @return an empty renderer */ - static EmptyRenderer empty() { + public static EmptyRenderer empty() { return EmptyRenderer.INSTANCE; } @@ -60,11 +60,11 @@ public interface Renderable { * @param output the list of output items * @return the recipe renderer */ - static SimpleRecipeRenderer fromRecipe(Supplier<List<List<ItemStack>>> input, Supplier<List<ItemStack>> output) { + public static SimpleRecipeRenderer fromRecipe(Supplier<List<List<ItemStack>>> input, Supplier<List<ItemStack>> output) { return new SimpleRecipeRenderer(input, output); } - static ItemStackRenderer fromItemStacks(List<ItemStack> stacks) { + public static ItemStackRenderer fromItemStacks(List<ItemStack> stacks) { return new ItemStackRenderer() { @Override public ItemStack getItemStack() { @@ -74,15 +74,4 @@ public interface Renderable { } }; } - - /** - * Renders of the renderable - * - * @param x the x coordinate of the renderable - * @param y the y coordinate of the renderable - * @param mouseX the x coordinate of the mouse - * @param mouseY the y coordinate of the mouse - * @param delta the delta - */ - void render(int x, int y, double mouseX, double mouseY, float delta); } diff --git a/src/main/java/me/shedaniel/rei/api/Renderer.java b/src/main/java/me/shedaniel/rei/api/Renderer.java index aada00b8a..d3ddab934 100644 --- a/src/main/java/me/shedaniel/rei/api/Renderer.java +++ b/src/main/java/me/shedaniel/rei/api/Renderer.java @@ -7,7 +7,7 @@ package me.shedaniel.rei.api; import net.minecraft.client.gui.DrawableHelper; -public abstract class Renderer extends DrawableHelper implements Renderable { +public abstract class Renderer extends DrawableHelper { /** * Gets the current blit offset * @@ -25,4 +25,15 @@ public abstract class Renderer extends DrawableHelper implements Renderable { public void setBlitOffset(int offset) { this.blitOffset = offset; } + + /** + * Renders of the renderable + * + * @param x the x coordinate of the renderable + * @param y the y coordinate of the renderable + * @param mouseX the x coordinate of the mouse + * @param mouseY the y coordinate of the mouse + * @param delta the delta + */ + public abstract void render(int x, int y, double mouseX, double mouseY, float delta); } |
