Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
05069aa
WIP Module
shedaniel Jul 27, 2022
acc7a8e
Add logging module, remove build files
shedaniel Jul 27, 2022
c85b3d4
Remove .gradle
shedaniel Jul 27, 2022
9954713
More work on config module
shedaniel Jul 27, 2022
8f5d3ef
Add reload all to the api
shedaniel Jul 31, 2022
8c13c01
More work
shedaniel Aug 4, 2022
d3bfd79
More work okay
shedaniel Aug 6, 2022
a690053
It compiles now
shedaniel Aug 26, 2022
066205c
Make it run
shedaniel Aug 26, 2022
59c644c
Bump to REI 8.4
shedaniel Aug 26, 2022
1ba613d
Fix double entry
shedaniel Aug 26, 2022
03b0adc
Refactors to overlays and reiruntime
shedaniel Aug 27, 2022
f5061d0
Run on macOS for more memory
shedaniel Aug 27, 2022
94e323f
Separate EntryListWidget and FavoritesListWidget more
shedaniel Aug 28, 2022
fb91ed9
More internal changes
shedaniel Aug 28, 2022
229b1fe
Improve Overlay Menus
shedaniel Sep 10, 2022
d70b835
Obfuscate REI Internals
shedaniel Sep 12, 2022
22e1bf5
Merge remote-tracking branch 'origin/8.x-1.18.2' into modularity
shedaniel Oct 21, 2022
bb7920e
Fix merge conflicts
shedaniel Oct 21, 2022
0ef0f8b
Make it not crash
shedaniel Oct 21, 2022
0be6613
Merge commit '46d2c64c4303bc007055268075ea9be4e9852e5e' into modularity
shedaniel Nov 7, 2022
c57bc7f
Merge commit '8def1ea25b93966d507d24033e6286b8ea008644' into modularity
shedaniel Nov 7, 2022
9a6370e
Merge commit '46d2c64c4303bc007055268075ea9be4e9852e5e' into modularity
shedaniel Nov 7, 2022
7f85089
Merge commit '0eb6bc9279238ba2eadb1c185042dc1270aae7d5' into modularity
shedaniel Nov 7, 2022
85a0ae5
Merge commit '41180dd40ac5214da245cfa7956dc662c4d95bea' into modularity
shedaniel Nov 7, 2022
17c5d7f
Merge commit '4cfd0bcabaab7482c3053c8b51869f5228ba586b' into modularity
shedaniel Nov 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/curseforge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
Expand Down
58 changes: 0 additions & 58 deletions api/build.gradle

This file was deleted.

19 changes: 15 additions & 4 deletions api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
package me.shedaniel.rei.api.client;

import me.shedaniel.rei.api.client.config.ConfigManager;
import me.shedaniel.rei.api.client.config.ConfigObject;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.view.ViewSearchBuilder;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.networking.NetworkModule;
import me.shedaniel.rei.api.common.networking.NetworkingHelper;
import me.shedaniel.rei.api.common.util.FormattingUtils;
import me.shedaniel.rei.impl.ClientInternals;
import me.shedaniel.rei.impl.client.ClientInternals;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -56,15 +59,20 @@ static ClientHelper getInstance() {
*
* @return whether cheating is enabled
*/
boolean isCheating();
default boolean isCheating() {
return ConfigObject.getInstance().isCheating();
}

/**
* Sets current cheating mode
* Automatically calls {@link ConfigManager#saveConfig()}.
*
* @param cheating the new cheating mode
*/
void setCheating(boolean cheating);
default void setCheating(boolean cheating) {
ConfigObject.getInstance().setCheating(cheating);
ConfigManager.getInstance().saveConfig();
}

/**
* Tries to cheat stack using either packets or commands.
Expand Down Expand Up @@ -200,5 +208,8 @@ default String getModFromIdentifier(ResourceLocation identifier) {
*
* @return whether the client can use move items packets
*/
boolean canUseMovePackets();
@Deprecated(forRemoval = true)
default boolean canUseMovePackets() {
return NetworkingHelper.getInstance().canUse(NetworkModule.TRANSFER);
}
}
35 changes: 28 additions & 7 deletions api/src/main/java/me/shedaniel/rei/api/client/REIRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
package me.shedaniel.rei.api.client;

import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.config.ConfigManager;
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.gui.widgets.TooltipQueue;
import me.shedaniel.rei.api.client.overlay.ScreenOverlay;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.common.plugins.PluginManager;
Expand Down Expand Up @@ -60,12 +62,17 @@ static REIRuntime getInstance() {
*
* @return whether the overlay is visible
*/
boolean isOverlayVisible();
default boolean isOverlayVisible() {
return ConfigObject.getInstance().isOverlayVisible();
}

/**
* Toggles the visibility of the overlay.
*/
void toggleOverlayVisible();
default void toggleOverlayVisible() {
ConfigObject.getInstance().setOverlayVisible(!ConfigObject.getInstance().isOverlayVisible());
ConfigManager.getInstance().saveConfig();
}

/**
* Returns the screen overlay of REI, if available and constructed.
Expand Down Expand Up @@ -126,23 +133,31 @@ default Optional<ScreenOverlay> getOverlay(boolean reset) {
* @return whether dark mode is enabled
* @see ConfigObject#isUsingDarkTheme()
*/
boolean isDarkThemeEnabled();
default boolean isDarkThemeEnabled() {
return ConfigObject.getInstance().isUsingDarkTheme();
}

/**
* Returns the text field used for searching, if constructed.
*
* @return the text field used for searching, or {@code null} if none
*/
@Nullable
TextField getSearchTextField();
default TextField getSearchTextField() {
return getOverlay().map(ScreenOverlay::getSearchField).orElse(null);
}

/**
* Queues a tooltip to be displayed.
*
* @param tooltip the tooltip to display, or {@code null}
* @see Tooltip#queue()
*/
void queueTooltip(@Nullable Tooltip tooltip);
default void queueTooltip(@Nullable Tooltip tooltip) {
if (getOverlay(false, false).isEmpty()) {
TooltipQueue.getInstance().queue(tooltip);
}
}

/**
* Clear all queued tooltips.
Expand All @@ -151,7 +166,11 @@ default Optional<ScreenOverlay> getOverlay(boolean reset) {
* @since 8.3
*/
@ApiStatus.Experimental
void clearTooltips();
default void clearTooltips() {
if (getOverlay(false, false).isEmpty()) {
TooltipQueue.getInstance().clear();
}
}

/**
* Returns the texture location of the default display background.
Expand All @@ -160,7 +179,9 @@ default Optional<ScreenOverlay> getOverlay(boolean reset) {
*
* @return the texture location of the default display background
*/
ResourceLocation getDefaultDisplayTexture();
default ResourceLocation getDefaultDisplayTexture() {
return getDefaultDisplayTexture(isDarkThemeEnabled());
}

/**
* Returns the texture location of the default display background.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
package me.shedaniel.rei.api.client.entry.filtering;

import me.shedaniel.rei.api.common.entry.EntryStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.jetbrains.annotations.ApiStatus;

import java.util.Collection;

@Environment(EnvType.CLIENT)
@ApiStatus.Experimental
public interface FilteringResult {
FilteringResult hide(EntryStack<?> stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ default Cache prepareCache(boolean async) {
* @return the result of the processing
*/
FilteringResult processFilteredStacks(FilteringContext context, FilteringResultFactory resultFactory, Cache cache, boolean async);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
package me.shedaniel.rei.api.client.entry.filtering;

import me.shedaniel.rei.api.client.entry.filtering.base.BasicFilteringRule;
import me.shedaniel.rei.impl.ClientInternals;
import me.shedaniel.rei.impl.client.ClientInternals;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.resources.ResourceLocation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.impl.ClientInternals;
import me.shedaniel.rei.api.common.entry.type.BuiltinEntryTypes;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.jetbrains.annotations.ApiStatus;
Expand All @@ -46,7 +46,7 @@
@Environment(EnvType.CLIENT)
public interface EntryRenderer<T> extends EntryRendererProvider<T> {
static <T> EntryRenderer<T> empty() {
return ClientInternals.getEmptyEntryRenderer();
return (EntryRenderer<T>) BuiltinEntryTypes.EMPTY.getDefinition().getRenderer();
}

@Environment(EnvType.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.util.ClientEntryStacks;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.impl.ClientInternals;
import me.shedaniel.rei.impl.client.ClientInternals;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.nbt.CompoundTag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ interface Section {
default void add(FavoriteEntry... entries) {
add(false, entries);
}

@ApiStatus.Experimental
void add(boolean defaultFavorited, FavoriteEntry... entries);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ protected SimpleDisplayRenderer(List<EntryIngredient> input, List<EntryIngredien
protected Slot createSlot(EntryIngredient ingredient) {
return Widgets.createSlot(new Point(0, 0))
.entries(CollectionUtils.filterToList(ingredient, stack -> !stack.isEmpty()))
.disableBackground()
.disableHighlight()
.disableTooltips();
.noBackground()
.noHighlight()
.noTooltips();
}

public static List<EntryIngredient> simplify(List<EntryIngredient> original) {
Expand Down Expand Up @@ -123,10 +123,10 @@ public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY,
int xx = bounds.x + 4, yy = bounds.y + 2;
int j = 0;
int itemsPerLine = getItemsPerLine();
for (Slot entryWidget : inputWidgets) {
entryWidget.setZ(getZ() + 50);
entryWidget.getBounds().setLocation(xx, yy);
entryWidget.render(matrices, mouseX, mouseY, delta);
for (Slot slot : inputWidgets) {
slot.setZ(getZ() + 50);
slot.getBounds().setLocation(xx, yy);
slot.render(matrices, mouseX, mouseY, delta);
xx += 18;
j++;
if (j >= getItemsPerLine() - 2) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
* Copyright (c) 2018, 2019, 2020, 2021, 2022 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.widgets;

import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.commons.lang3.mutable.MutableLong;

import java.util.Collection;
import java.util.List;

public abstract class BatchedSlots extends Widget implements List<Slot> {
public abstract void addUnbatched(Slot slot);

public abstract void addAllUnbatched(Collection<? extends Slot> slots);

public abstract boolean isBatched();

public abstract void addDebugger(MutableInt size, MutableLong time);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public DelegateWidget(Widget widget) {
this.widget = widget;
}

public DelegateWidget() {
this(Widgets.noOp());
}

protected Widget delegate() {
return widget;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public DelegateWidgetWithBounds(Widget widget, Supplier<Rectangle> bounds) {
this.bounds = bounds;
}

public DelegateWidgetWithBounds(Supplier<Rectangle> bounds) {
this(Widgets.noOp(), bounds);
}

public DelegateWidgetWithBounds(Rectangle bounds) {
this(Widgets.noOp(), () -> bounds);
}

public DelegateWidgetWithBounds() {
this(new Rectangle());
}

@Override
public Rectangle getBounds() {
return bounds.get();
Expand Down
Loading