aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/REIRuntime.java12
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java18
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java9
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitor.java23
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitorWidget.java25
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggedAcceptorResult.java44
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggingContext.java11
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java19
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java7
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java21
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java40
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java86
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java43
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java84
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DefaultDisplayChoosePageWidget.java22
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListEntryWidget.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListWidget.java37
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryStacksRegionWidget.java51
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/FavoritesListWidget.java9
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/TabWidget.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/RealRegionEntry.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/RegionDraggableStack.java16
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/RegionEntryListEntry.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/RegionListener.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/registry/screen/ExclusionZonesImpl.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java4
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/cs_cz.json3
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/en_gb.json30
-rwxr-xr-xruntime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json6
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json2
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json3
33 files changed, 492 insertions, 169 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/REIRuntime.java b/api/src/main/java/me/shedaniel/rei/api/client/REIRuntime.java
index adc1cb968..1af65d4ad 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/REIRuntime.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/REIRuntime.java
@@ -24,18 +24,22 @@
package me.shedaniel.rei.api.client;
import me.shedaniel.math.Rectangle;
+import me.shedaniel.rei.api.client.config.ConfigObject;
import me.shedaniel.rei.api.client.gui.config.SearchFieldLocation;
import me.shedaniel.rei.api.client.gui.widgets.TextField;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.overlay.ScreenOverlay;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
+import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.registry.Reloadable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.resources.ResourceLocation;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
@@ -80,7 +84,13 @@ public interface REIRuntime extends Reloadable<REIClientPlugin> {
SearchFieldLocation getContextualSearchFieldLocation();
- Rectangle calculateEntryListArea();
+ @ApiStatus.ScheduledForRemoval
+ @Deprecated
+ default Rectangle calculateEntryListArea() {
+ return calculateEntryListArea(ScreenRegistry.getInstance().getOverlayBounds(ConfigObject.getInstance().getDisplayPanelLocation(), Minecraft.getInstance().screen));
+ }
+
+ Rectangle calculateEntryListArea(Rectangle bounds);
Rectangle calculateFavoritesListArea();
}
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 040704236..8d35049c2 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
@@ -89,6 +89,8 @@ public interface ConfigObject {
int getMaxRecipePerPage();
+ int getMaxRecipesPageHeight();
+
boolean doesDisableRecipeBook();
boolean doesFixTabCloseContainer();
@@ -163,10 +165,22 @@ public interface ConfigObject {
boolean isInventoryHighlightingAllowed();
@ApiStatus.Experimental
- double getHorizontalEntriesBoundaries();
+ double getHorizontalEntriesBoundariesPercentage();
+
+ @ApiStatus.Experimental
+ double getVerticalEntriesBoundariesPercentage();
+
+ @ApiStatus.Experimental
+ double getHorizontalEntriesBoundariesColumns();
+
+ @ApiStatus.Experimental
+ double getVerticalEntriesBoundariesRows();
+
+ @ApiStatus.Experimental
+ double getFavoritesHorizontalEntriesBoundariesPercentage();
@ApiStatus.Experimental
- double getVerticalEntriesBoundaries();
+ double getFavoritesHorizontalEntriesBoundariesColumns();
@ApiStatus.Experimental
SyntaxHighlightingMode getSyntaxHighlightingMode();
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java
index 6dfaa9097..b5ccc97f2 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java
@@ -26,13 +26,20 @@ package me.shedaniel.rei.api.client.gui.drag;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.common.entry.EntryStack;
+import org.jetbrains.annotations.ApiStatus;
public interface DraggableStack {
EntryStack<?> getStack();
void drag();
- void release(boolean accepted);
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ default void release(boolean consumed) {}
+
+ default void release(DraggedAcceptorResult result) {
+ release(result != DraggedAcceptorResult.PASS);
+ }
default void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
getStack().render(matrices, bounds, mouseX, mouseY, delta);
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitor.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitor.java
index ae973be16..d893eccd4 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitor.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitor.java
@@ -29,6 +29,7 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.ApiStatus;
+import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.Stream;
@@ -51,14 +52,14 @@ public interface DraggableStackVisitor<T extends Screen> extends Comparable<Drag
}
@Override
- public boolean acceptDraggedStack(DraggingContext<T> context, DraggableStack stack) {
+ public DraggedAcceptorResult acceptDraggedStackWithResult(DraggingContext<T> context, DraggableStack stack) {
for (DraggableStackVisitor<T> visitor : visitors.get()) {
if (visitor.isHandingScreen(context.getScreen())) {
- boolean visited = visitor.acceptDraggedStack(context, stack);
- if (visited) return true;
+ DraggedAcceptorResult result = Objects.requireNonNull(visitor.acceptDraggedStackWithResult(context, stack));
+ if (result != DraggedAcceptorResult.PASS) return result;
}
}
- return false;
+ return DraggedAcceptorResult.PASS;
}
@Override
@@ -84,6 +85,8 @@ public interface DraggableStackVisitor<T extends Screen> extends Comparable<Drag
* @param stack the stack being dragged
* @return whether the stack is accepted by the visitor
*/
+ @ApiStatus.ScheduledForRemoval
+ @Deprecated
default boolean acceptDraggedStack(DraggingContext<T> context, DraggableStack stack) {
Optional<Acceptor> acceptor = visitDraggedStack(context, stack);
if (acceptor.isPresent()) {
@@ -95,6 +98,18 @@ public interface DraggableStackVisitor<T extends Screen> extends Comparable<Drag
}
/**
+ * Accepts a dragged stack, implementations of this function should check if the {@code context} is within
+ * boundaries of the accepting boundaries.
+ *
+ * @param context the context of the current dragged stack on the overlay
+ * @param stack the stack being dragged
+ * @return the result of the visitor
+ */
+ default DraggedAcceptorResult acceptDraggedStackWithResult(DraggingContext<T> context, DraggableStack stack) {
+ return acceptDraggedStack(context, stack) ? DraggedAcceptorResult.CONSUMED : DraggedAcceptorResult.PASS;
+ }
+
+ /**
* Returns the accepting bounds for the dragging stack, this should only be called once on drag.
* The bounds are used to overlay to indicate to the users that the area is accepting entries.
*
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitorWidget.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitorWidget.java
index 7bb813d4d..4234b2b6b 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitorWidget.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitorWidget.java
@@ -39,9 +39,12 @@ public interface DraggableStackVisitorWidget {
static DraggableStackVisitorWidget from(Function<DraggingContext<Screen>, Iterable<DraggableStackVisitorWidget>> providers) {
return new DraggableStackVisitorWidget() {
@Override
- public boolean acceptDraggedStack(DraggingContext<Screen> context, DraggableStack stack) {
+ public DraggedAcceptorResult acceptDraggedStackWithResult(DraggingContext<Screen> context, DraggableStack stack) {
return StreamSupport.stream(providers.apply(context).spliterator(), false)
- .anyMatch(visitor -> visitor.acceptDraggedStack(context, stack));
+ .map(visitor -> visitor.acceptDraggedStackWithResult(context, stack))
+ .filter(result -> result != DraggedAcceptorResult.PASS)
+ .findFirst()
+ .orElse(DraggedAcceptorResult.PASS);
}
@Override
@@ -66,6 +69,8 @@ public interface DraggableStackVisitorWidget {
* @param stack the stack being dragged
* @return whether the stack is accepted by the widget
*/
+ @ApiStatus.ScheduledForRemoval
+ @Deprecated
default boolean acceptDraggedStack(DraggingContext<Screen> context, DraggableStack stack) {
Optional<DraggableStackVisitor.Acceptor> acceptor = visitDraggedStack(context, stack);
if (acceptor.isPresent()) {
@@ -77,6 +82,18 @@ public interface DraggableStackVisitorWidget {
}
/**
+ * Accepts a dragged stack, implementations of this function should check if the {@code context} is within
+ * boundaries of the widget.
+ *
+ * @param context the context of the current dragged stack on the overlay
+ * @param stack the stack being dragged
+ * @return the result of the visitor
+ */
+ default DraggedAcceptorResult acceptDraggedStackWithResult(DraggingContext<Screen> context, DraggableStack stack) {
+ return acceptDraggedStack(context, stack) ? DraggedAcceptorResult.CONSUMED : DraggedAcceptorResult.PASS;
+ }
+
+ /**
* Returns the accepting bounds for the dragging stack, this should only be called once on drag.
* The bounds are used to overlay to indicate to the users that the widget is accepting entries.
*
@@ -95,8 +112,8 @@ public interface DraggableStackVisitorWidget {
static DraggableStackVisitor<Screen> toVisitor(DraggableStackVisitorWidget widget, double priority) {
return new DraggableStackVisitor<>() {
@Override
- public boolean acceptDraggedStack(DraggingContext<Screen> context, DraggableStack stack) {
- return widget.acceptDraggedStack(context, stack);
+ public DraggedAcceptorResult acceptDraggedStackWithResult(DraggingContext<Screen> context, DraggableStack stack) {
+ return widget.acceptDraggedStackWithResult(context, stack);
}
@Override
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggedAcceptorResult.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggedAcceptorResult.java
new file mode 100644
index 000000000..05731ef0c
--- /dev/null
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggedAcceptorResult.java
@@ -0,0 +1,44 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.api.client.gui.drag;
+
+/**
+ * The result of the visitor, this is used to determine if the visitor consumed the stack or not.
+ */
+public enum DraggedAcceptorResult {
+ /**
+ * The visitor consumed the stack, the stack will not be returned to the original stack.
+ */
+ CONSUMED,
+ /**
+ * The visitor did not consume the stack, the stack will be returned to the original stack,
+ * other visitors will not be called.
+ */
+ ACCEPTED,
+ /**
+ * The visitor did not consume the stack, the stack will be passed to the next visitor.
+ */
+ PASS,
+ ;
+} \ No newline at end of file
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggingContext.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggingContext.java
index 626d9aa29..20e2c1fe2 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggingContext.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggingContext.java
@@ -24,6 +24,7 @@
package me.shedaniel.rei.api.client.gui.drag;
import me.shedaniel.math.Point;
+import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.REIRuntime;
import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;
@@ -82,6 +83,16 @@ public interface DraggingContext<S extends Screen> {
*/
void renderBackToPosition(DraggableStack stack, Point initialPosition, Supplier<Point> position);
+ /**
+ * Renders the draggable stack back to the bounds {@code bounds}.
+ * This may be used to animate an unaccepted draggable stack returning to its initial position.
+ *
+ * @param stack the stack to use for render
+ * @param initialPosition the initial bounds of the stack
+ * @param bounds the boundary supplier of the destination
+ */
+ void renderBackToPosition(DraggableStack stack, Rectangle initialPosition, Supplier<Rectangle> bounds);
+
default <T extends Screen> DraggingContext<T> cast() {
return (DraggingContext<T>) this;
}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java b/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java
index 3c3ea6462..9ec3a3a15 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java
@@ -69,7 +69,7 @@ public interface TransferHandler extends Comparable<TransferHandler> {
* Creates a successful result, no further handlers will be called.
*/
static Result createSuccessful() {
- return new ResultImpl();
+ return new ResultImpl().color(0x00000000);
}
/**
@@ -77,7 +77,7 @@ public interface TransferHandler extends Comparable<TransferHandler> {
* This will also mark the handler as not applicable.
*/
static Result createNotApplicable() {
- return new ResultImpl(false);
+ return new ResultImpl(false).color(0x00000000);
}
/**
@@ -86,7 +86,7 @@ public interface TransferHandler extends Comparable<TransferHandler> {
* @param error The error itself
*/
static Result createFailed(Component error) {
- return new ResultImpl(error, new IntArrayList(), 1744764928);
+ return new ResultImpl(error, new IntArrayList(), 0x67ff0000);
}
/**
@@ -107,7 +107,7 @@ public interface TransferHandler extends Comparable<TransferHandler> {
* @param redSlots A list of slots to be marked as red. Will be passed to {@link TransferDisplayCategory}.
*/
static Result createFailed(Component error, IntList redSlots) {
- return new ResultImpl(error, redSlots, 1744764928);
+ return new ResultImpl(error, redSlots, 0x67ff0000);
}
/**
@@ -138,6 +138,11 @@ public interface TransferHandler extends Comparable<TransferHandler> {
* @return the color in which the button should be displayed in.
*/
int getColor();
+
+ /**
+ * Sets the color in which the button should be displayed in.
+ */
+ Result color(int color);
/**
* @return whether this handler has successfully handled the transfer.
@@ -244,6 +249,12 @@ public interface TransferHandler extends Comparable<TransferHandler> {
}
@Override
+ public TransferHandler.Result color(int color) {
+ this.color = color;
+ return this;
+ }
+
+ @Override
public boolean isSuccessful() {
return successful;
}
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
index e6b2390db..8f67f2bff 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
@@ -29,6 +29,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fmllegacy.DatagenModLoader;
import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.forgespi.language.ModFileScanData;
import org.apache.commons.lang3.tuple.ImmutableTriple;
@@ -50,8 +51,10 @@ public class RoughlyEnoughItemsForge {
public static final Logger LOGGER = LogManager.getFormatterLogger("REI");
public RoughlyEnoughItemsForge() {
- RoughlyEnoughItemsInitializer.onInitialize();
- DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> RoughlyEnoughItemsInitializer::onInitializeClient);
+ if (!DatagenModLoader.isRunningDataGen()) {
+ RoughlyEnoughItemsInitializer.onInitialize();
+ DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> RoughlyEnoughItemsInitializer::onInitializeClient);
+ }
}
public static <A, T> void scanAnnotation(Class<A> clazz, Predicate<Class<T>> predicate, TriConsumer<List<String>, Supplier<T>, Class<T>> consumer) {
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java
index b674d0099..d5d89a653 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java
@@ -33,6 +33,7 @@ import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.REIRuntime;
import me.shedaniel.rei.api.client.config.ConfigManager;
import me.shedaniel.rei.api.client.config.ConfigObject;
+import me.shedaniel.rei.api.client.gui.config.DisplayPanelLocation;
import me.shedaniel.rei.api.client.gui.config.SearchFieldLocation;
import me.shedaniel.rei.api.client.gui.screen.DisplayScreen;
import me.shedaniel.rei.api.client.gui.widgets.TextField;
@@ -55,6 +56,8 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
+import static me.shedaniel.rei.impl.client.gui.widget.EntryListWidget.entrySize;
+
@ApiStatus.Internal
@Environment(EnvType.CLIENT)
public class REIRuntimeImpl implements REIRuntime {
@@ -194,8 +197,7 @@ public class REIRuntimeImpl implements REIRuntime {
}
@Override
- public Rectangle calculateEntryListArea() {
- Rectangle bounds = ScreenRegistry.getInstance().getOverlayBounds(ConfigObject.getInstance().getDisplayPanelLocation(), Minecraft.getInstance().screen);
+ public Rectangle calculateEntryListArea(Rectangle bounds) {
SearchFieldLocation searchFieldLocation = getContextualSearchFieldLocation();
int yOffset = 2;
@@ -212,7 +214,20 @@ public class REIRuntimeImpl implements REIRuntime {
int yOffset = 8;
if (!ConfigObject.getInstance().isLowerConfigButton()) yOffset += 25;
- return new Rectangle(bounds.x, bounds.y + yOffset, bounds.width, bounds.height - 3 - yOffset);
+ bounds = new Rectangle(bounds.x, bounds.y + yOffset, bounds.width, bounds.height - 3 - yOffset);
+
+ int widthReduction = (int) Math.round(bounds.width * (1 - ConfigObject.getInstance().getFavoritesHorizontalEntriesBoundariesPercentage()));
+ if (ConfigObject.getInstance().getDisplayPanelLocation() == DisplayPanelLocation.LEFT)
+ bounds.x += widthReduction;
+ bounds.width -= widthReduction;
+ int maxWidth = (int) Math.ceil(entrySize() * ConfigObject.getInstance().getFavoritesHorizontalEntriesBoundariesColumns() + entrySize() * 0.75) + 8;
+ if (bounds.width > maxWidth) {
+ if (ConfigObject.getInstance().getDisplayPanelLocation() == DisplayPanelLocation.LEFT)
+ bounds.x += bounds.width - maxWidth;
+ bounds.width = maxWidth;
+ }
+
+ return bounds;
}
@Override
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
index 096a49e8b..73521ae30 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
@@ -170,6 +170,11 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
}
@Override
+ public int getMaxRecipesPageHeight() {
+ return advanced.layout.maxRecipesPageHeight;
+ }
+
+ @Override
public boolean doesDisableRecipeBook() {
return functionality.disableRecipeBook;
}
@@ -349,16 +354,39 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@ApiStatus.Experimental
@Override
- public double getHorizontalEntriesBoundaries() {
+ public double getHorizontalEntriesBoundariesPercentage() {
return Mth.clamp(appearance.horizontalEntriesBoundaries, 0.1, 1);
}
@ApiStatus.Experimental
@Override
- public double getVerticalEntriesBoundaries() {
+ public double getVerticalEntriesBoundariesPercentage() {
return Mth.clamp(appearance.verticalEntriesBoundaries, 0.1, 1);
}
+ @ApiStatus.Experimental
+ @Override
+ public double getHorizontalEntriesBoundariesColumns() {
+ return Mth.clamp(appearance.horizontalEntriesBoundariesColumns, 1, 1000);
+ }
+
+ @ApiStatus.Experimental
+ @Override
+ public double getVerticalEntriesBoundariesRows() {
+ return Mth.clamp(appearance.verticalEntriesBoundariesRows, 1, 1000);
+ }
+
+ @ApiStatus.Experimental
+ @Override
+ public double getFavoritesHorizontalEntriesBoundariesPercentage() {
+ return Mth.clamp(appearance.favoritesHorizontalEntriesBoundaries, 0.1, 1);
+ }
+
+ @Override
+ public double getFavoritesHorizontalEntriesBoundariesColumns() {
+ return Mth.clamp(appearance.favoritesHorizontalEntriesBoundariesColumns, 1, 1000);
+ }
+
@Override
public SyntaxHighlightingMode getSyntaxHighlightingMode() {
return appearance.syntaxHighlightingMode;
@@ -469,6 +497,10 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") private double horizontalEntriesBoundaries = 1.0;
@UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") private double verticalEntriesBoundaries = 1.0;
+ private int horizontalEntriesBoundariesColumns = 50;
+ private int verticalEntriesBoundariesRows = 1000;
+ @UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") private double favoritesHorizontalEntriesBoundaries = 1.0;
+ private int favoritesHorizontalEntriesBoundariesColumns = 50;
@UseSpecialSearchFilterSyntaxHighlightingScreen private SyntaxHighlightingMode syntaxHighlightingMode = SyntaxHighlightingMode.COLORFUL;
}
@@ -506,7 +538,9 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
private EntryPanelOrderingConfig entryPanelOrdering = EntryPanelOrderingConfig.REGISTRY_ASCENDING;
@Comment("Declares the maximum amount of recipes displayed in a page if possible.") @ConfigEntry.BoundedDiscrete(min = 2, max = 99)
- private int maxRecipesPerPage = 3;
+ private int maxRecipesPerPage = 8;
+ @Comment("Declares the maximum amount of recipes displayed in a page if possible.") @ConfigEntry.BoundedDiscrete(min = 100, max = 1000)
+ private int maxRecipesPageHeight = 300;
@Comment("Declares whether entry rendering time should be debugged.") private boolean debugRenderTimeRequired = false;
@Comment("Merges displays with equal contents under 1 display.") private boolean mergeDisplayUnderOne = true;
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java
index bc53fca48..f95afd48b 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java
@@ -37,10 +37,12 @@ import me.shedaniel.rei.api.client.REIRuntime;