aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-06-26 04:10:01 +0800
committershedaniel <daniel@shedaniel.me>2022-06-28 03:21:12 +0800
commit87ccf96bf8a7705da7844dce9b94364b2e3d1b25 (patch)
tree14e1189dbb7e214ccc787dff6334b393b664acc1
parent091c92b90421c13bcde0f80909170fde0e317d39 (diff)
downloadRoughlyEnoughItems-87ccf96bf8a7705da7844dce9b94364b2e3d1b25.tar.gz
RoughlyEnoughItems-87ccf96bf8a7705da7844dce9b94364b2e3d1b25.tar.bz2
RoughlyEnoughItems-87ccf96bf8a7705da7844dce9b94364b2e3d1b25.zip
Change page buttons texture
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java26
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_left.pngbin0 -> 117 bytes
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_right.pngbin0 -> 104 bytes
3 files changed, 24 insertions, 2 deletions
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 aa8a33b49..986c6a93e 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
@@ -79,6 +79,7 @@ import me.shedaniel.rei.impl.client.gui.widget.search.OverlaySearchField;
import me.shedaniel.rei.impl.common.util.Weather;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.chat.NarratorChatListener;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
@@ -106,6 +107,8 @@ import static me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget.
@ApiStatus.Internal
public class ScreenOverlayImpl extends ScreenOverlay {
private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png");
+ private static final ResourceLocation ARROW_LEFT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left.png");
+ private static final ResourceLocation ARROW_RIGHT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right.png");
private static final List<Tooltip> TOOLTIPS = Lists.newArrayList();
private static final List<Runnable> AFTER_RENDER = Lists.newArrayList();
private static EntryListWidget entryListWidget = null;
@@ -276,7 +279,7 @@ public class ScreenOverlayImpl extends ScreenOverlay {
this.widgets.add(REIRuntimeImpl.getSearchField());
REIRuntimeImpl.getSearchField().setResponder(s -> getEntryListWidget().updateSearch(s, false));
if (!ConfigObject.getInstance().isEntryListWidgetScrolled()) {
- widgets.add(leftButton = Widgets.createButton(new Rectangle(bounds.x, bounds.y + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16), Component.translatable("text.rei.left_arrow"))
+ widgets.add(leftButton = Widgets.createButton(new Rectangle(bounds.x, bounds.y + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16), Component.literal(""))
.onClick(button -> {
getEntryListWidget().previousPage();
if (getEntryListWidget().getPage() < 0)
@@ -286,6 +289,15 @@ public class ScreenOverlayImpl extends ScreenOverlay {
.containsMousePredicate((button, point) -> button.getBounds().contains(point) && isNotInExclusionZones(point.x, point.y))
.tooltipLine(Component.translatable("text.rei.previous_page"))
.focusable(false));
+ widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> {
+ helper.setBlitOffset(helper.getBlitOffset() + 1);
+ RenderSystem.setShaderTexture(0, ARROW_LEFT_TEXTURE);
+ Rectangle bounds = leftButton.getBounds();
+ matrices.pushPose();
+ blit(matrices, bounds.x + 4, bounds.y + 4, 0, 0, 9, 9, 9, 9);
+ matrices.popPose();
+ helper.setBlitOffset(helper.getBlitOffset() - 1);
+ }));
Button changelogButton;
widgets.add(changelogButton = Widgets.createButton(new Rectangle(bounds.x + bounds.width - 18 - 18, bounds.y + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16), Component.translatable(""))
.onClick(button -> {
@@ -304,7 +316,7 @@ public class ScreenOverlayImpl extends ScreenOverlay {
matrices.popPose();
helper.setBlitOffset(helper.getBlitOffset() - 1);
}));
- widgets.add(rightButton = Widgets.createButton(new Rectangle(bounds.x + bounds.width - 18, bounds.y + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16), Component.translatable("text.rei.right_arrow"))
+ widgets.add(rightButton = Widgets.createButton(new Rectangle(bounds.x + bounds.width - 18, bounds.y + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16), Component.literal(""))
.onClick(button -> {
getEntryListWidget().nextPage();
if (getEntryListWidget().getPage() >= getEntryListWidget().getTotalPages())
@@ -314,6 +326,16 @@ public class ScreenOverlayImpl extends ScreenOverlay {
.containsMousePredicate((button, point) -> button.getBounds().contains(point) && isNotInExclusionZones(point.x, point.y))
.tooltipLine(Component.translatable("text.rei.next_page"))
.focusable(false));
+ widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> {
+ helper.setBlitOffset(helper.getBlitOffset() + 1);
+ RenderSystem.setShaderTexture(0, ARROW_RIGHT_TEXTURE);
+ Rectangle bounds = rightButton.getBounds();
+ matrices.pushPose();
+ matrices.translate(-0.5, 0, 0);
+ blit(matrices, bounds.x + 4, bounds.y + 4, 0, 0, 9, 9, 9, 9);
+ matrices.popPose();
+ helper.setBlitOffset(helper.getBlitOffset() - 1);
+ }));
}
final Rectangle configButtonArea = getConfigButtonArea();
diff --git a/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_left.png b/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_left.png
new file mode 100644
index 000000000..912d3784f
--- /dev/null
+++ b/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_left.png
Binary files differ
diff --git a/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_right.png b/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_right.png
new file mode 100644
index 000000000..46b33d08e
--- /dev/null
+++ b/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/arrow_right.png
Binary files differ