aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-runtime/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'RoughlyEnoughItems-runtime/src/main/java')
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java11
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/FluidEntryDefinition.java23
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/ItemEntryDefinition.java23
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java2
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java84
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java31
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java25
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/IssuesDetector.java23
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java2
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/TypedEntryStack.java23
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/entry/EmptyEntryDefinition.java31
11 files changed, 236 insertions, 42 deletions
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java
index 6e15e230c..fc0e911a6 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java
@@ -30,17 +30,22 @@ import me.shedaniel.architectury.utils.Fraction;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.*;
-import me.shedaniel.rei.api.entry.*;
+import me.shedaniel.rei.api.entry.ComparisonContext;
+import me.shedaniel.rei.api.entry.EntryStacks;
+import me.shedaniel.rei.api.entry.EntryTypeRegistry;
+import me.shedaniel.rei.api.entry.VanillaEntryTypes;
import me.shedaniel.rei.api.favorites.FavoriteEntry;
import me.shedaniel.rei.api.favorites.FavoriteEntryType;
import me.shedaniel.rei.api.fluid.FluidSupportProvider;
import me.shedaniel.rei.api.plugins.REIPluginV0;
import me.shedaniel.rei.api.widgets.Panel;
import me.shedaniel.rei.api.widgets.Tooltip;
+import me.shedaniel.rei.gui.ContainerScreenOverlay;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
import me.shedaniel.rei.gui.plugin.entry.FluidEntryDefinition;
import me.shedaniel.rei.gui.plugin.entry.ItemEntryDefinition;
+import me.shedaniel.rei.gui.widget.FavoritesListWidget;
import me.shedaniel.rei.impl.ClientHelperImpl;
import me.shedaniel.rei.impl.RenderingEntry;
import me.shedaniel.rei.plugin.autocrafting.DefaultCategoryHandler;
@@ -119,14 +124,14 @@ public class DefaultRuntimePlugin implements REIPluginV0 {
return Collections.emptyList();
return Collections.singletonList(widget.getBounds().clone());
});
- /*baseBoundsHandler.registerExclusionZones(Screen.class, () -> {
+ baseBoundsHandler.registerExclusionZones(Screen.class, () -> {
FavoritesListWidget widget = ContainerScreenOverlay.getFavoritesListWidget();
if (widget != null) {
if (widget.favoritePanelButton.isVisible())
return Collections.singletonList(widget.favoritePanelButton.bounds);
}
return Collections.emptyList();
- });*/
+ });
displayHelper.registerProvider(new DisplayHelper.DisplayBoundsProvider<RecipeViewingScreen>() {
@Override
public Rectangle getScreenBounds(RecipeViewingScreen screen) {
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/FluidEntryDefinition.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/FluidEntryDefinition.java
index de4658b36..9c7941985 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/FluidEntryDefinition.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/FluidEntryDefinition.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.gui.plugin.entry;
import com.google.common.collect.Lists;
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/ItemEntryDefinition.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/ItemEntryDefinition.java
index a1b8d6b38..4407563f3 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/ItemEntryDefinition.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/ItemEntryDefinition.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.gui.plugin.entry;
import com.google.common.collect.Lists;
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
index e345be523..6b236dfe7 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
@@ -283,7 +283,7 @@ public class EntryWidget extends Slot {
}
protected void drawCurrentEntry(PoseStack matrices, int mouseX, int mouseY, float delta) {
- EntryStack entry = getCurrentEntry();
+ EntryStack<?> entry = getCurrentEntry();
entry.setZ(100);
entry.render(matrices, getInnerBounds(), mouseX, mouseY, delta);
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
index fea93b2d5..04365980f 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
@@ -26,9 +26,11 @@ package me.shedaniel.rei.gui.widget;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
+import com.mojang.blaze3d.vertex.Tesselator;
import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import me.shedaniel.clothconfig2.ClothConfigInitializer;
+import me.shedaniel.clothconfig2.api.LazyResettable;
import me.shedaniel.clothconfig2.api.ScissorsHandler;
import me.shedaniel.clothconfig2.api.ScrollingContainer;
import me.shedaniel.clothconfig2.gui.widget.DynamicNewSmoothScrollingEntryListWidget;
@@ -39,6 +41,7 @@ import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.api.*;
import me.shedaniel.rei.api.entry.BatchEntryRenderer;
import me.shedaniel.rei.api.favorites.FavoriteEntry;
+import me.shedaniel.rei.api.favorites.FavoriteEntryType;
import me.shedaniel.rei.api.favorites.FavoriteMenuEntry;
import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.gui.ContainerScreenOverlay;
@@ -46,9 +49,14 @@ import me.shedaniel.rei.gui.modules.Menu;
import me.shedaniel.rei.gui.modules.MenuEntry;
import me.shedaniel.rei.impl.*;
import me.shedaniel.rei.utils.CollectionUtils;
+import me.shedaniel.rei.utils.ImmutableLiteralText;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.components.events.AbstractContainerEventHandler;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.client.renderer.MultiBufferSource;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Mth;
import net.minecraft.util.Tuple;
import org.jetbrains.annotations.ApiStatus;
@@ -91,9 +99,9 @@ public class FavoritesListWidget extends WidgetWithBounds {
private List<EntryListEntry> entriesList = Lists.newArrayList();
private List<Widget> children = Lists.newArrayList();
private Entry lastTouchedEntry = null;
-
-// public final AddFavoritePanel favoritePanel = new AddFavoritePanel(this);
-// public final ToggleAddFavoritePanelButton favoritePanelButton = new ToggleAddFavoritePanelButton(this);
+
+ public final AddFavoritePanel favoritePanel = new AddFavoritePanel(this);
+ public final ToggleAddFavoritePanelButton favoritePanelButton = new ToggleAddFavoritePanelButton(this);
private static Rectangle updateInnerBounds(Rectangle bounds) {
int entrySize = entrySize();
@@ -114,9 +122,9 @@ public class FavoritesListWidget extends WidgetWithBounds {
return true;
}
} else {
-// if (favoritePanel.mouseScrolled(double_1, double_2, double_3)) {
-// return true;
-// }
+ if (favoritePanel.mouseScrolled(double_1, double_2, double_3)) {
+ return true;
+ }
scrolling.offset(ClothConfigInitializer.getScrollStep() * -double_3, true);
return true;
}
@@ -191,8 +199,8 @@ public class FavoritesListWidget extends WidgetWithBounds {
}
private void renderAddFavorite(PoseStack matrices, int mouseX, int mouseY, float delta) {
-// this.favoritePanel.render(matrices, mouseX, mouseY, delta);
-// this.favoritePanelButton.render(matrices, mouseX, mouseY, delta);
+ this.favoritePanel.render(matrices, mouseX, mouseY, delta);
+ this.favoritePanelButton.render(matrices, mouseX, mouseY, delta);
}
@Override
@@ -278,15 +286,17 @@ public class FavoritesListWidget extends WidgetWithBounds {
this.entriesList = Stream.concat(entries.values().stream().map(Entry::getWidget), removedEntries.values().stream().map(Entry::getWidget)).collect(Collectors.toList());
this.children = Stream.<Stream<Widget>>of(
entries.values().stream().map(Entry::getWidget),
- removedEntries.values().stream().map(Entry::getWidget)
-// Stream.of(favoritePanelButton, favoritePanel)
+ removedEntries.values().stream().map(Entry::getWidget),
+ Stream.of(favoritePanelButton, favoritePanel)
).flatMap(Function.identity()).collect(Collectors.toList());
}
public void updateEntriesPosition(Predicate<Entry> animated) {
int entrySize = entrySize();
this.blockedCount = 0;
- this.currentBounds.setBounds(this.fullBounds);
+ if (favoritePanel.getBounds().height > 20)
+ this.currentBounds.setBounds(this.fullBounds.x, this.fullBounds.y, this.fullBounds.width, this.fullBounds.height - (this.fullBounds.getMaxY() - this.favoritePanel.bounds.y) - 4);
+ else this.currentBounds.setBounds(this.fullBounds);
this.innerBounds = updateInnerBounds(currentBounds);
int width = innerBounds.width / entrySize;
int currentX = 0;
@@ -456,7 +466,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
break;
}
}
- } /*else if (favoritePanel.bounds.contains(mouseX, mouseY)) {
+ } else if (favoritePanel.bounds.contains(mouseX, mouseY)) {
back:
for (AddFavoritePanel.Row row : favoritePanel.rows.get()) {
if (row instanceof AddFavoritePanel.SectionEntriesRow) {
@@ -476,7 +486,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
}
}
}
- }*/
+ }
for (Widget widget : children())
if (widget.mouseClicked(mouseX, mouseY, int_1))
return true;
@@ -561,6 +571,23 @@ public class FavoritesListWidget extends WidgetWithBounds {
}
}
+ private static EntryStack<?> wrapRendererInStack(Renderer renderer) {
+ if (renderer instanceof EntryStack) {
+ return (EntryStack<?>) renderer;
+ }
+ return new RenderingEntry() {
+ @Override
+ public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
+ renderer.render(matrices, bounds, mouseX, mouseY, delta);
+ }
+
+ @Override
+ public @Nullable Tooltip getTooltip(Point mouse) {
+ return renderer.getTooltip(mouse);
+ }
+ };
+ }
+
private class EntryListEntry extends EntryListEntryWidget {
private final Entry entry;
private final FavoriteEntry favoriteEntry;
@@ -569,18 +596,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
super(new Point(x, y), entrySize);
this.entry = entry;
this.favoriteEntry = favoriteEntry;
- Renderer renderer = this.favoriteEntry.getRenderer(false);
- this.clearEntries().entry(new RenderingEntry() {
- @Override
- public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
- renderer.render(matrices, bounds, mouseX, mouseY, delta);
- }
-
- @Override
- public @Nullable Tooltip getTooltip(Point mouse) {
- return renderer.getTooltip(mouse);
- }
- });
+ this.clearEntries().entry(wrapRendererInStack(this.favoriteEntry.getRenderer(false)));
}
@Override
@@ -683,7 +699,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
}
}
- /*public static class ToggleAddFavoritePanelButton extends WidgetWithBounds {
+ public static class ToggleAddFavoritePanelButton extends WidgetWithBounds {
private final FavoritesListWidget widget;
public boolean wasClicked = false;
public final Animator alpha = new Animator(0);
@@ -895,7 +911,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
@Override
public int getRowHeight() {
- return Mth.ceil((entries.size() + blockedCount) / (scrollBounds.width / (float) entrySize())) * entrySize();
+ return Mth.ceil((entries.size() + blockedCount) / (scrollBounds.width / (float) entrySize())) * entrySize() + 5;
}
@Override
@@ -929,7 +945,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
protected SectionFavoriteWidget(Point point, int entrySize, FavoriteEntry entry) {
super(point, entrySize);
this.entry = entry;
- entry(entry.getWidget(true));
+ entry(wrapRendererInStack(entry.getRenderer(true)));
noBackground();
}
@@ -952,6 +968,16 @@ public class FavoritesListWidget extends WidgetWithBounds {
this.getBounds().x = (int) Math.round(x.doubleValue() + offsetSize);
this.getBounds().y = (int) Math.round(y.doubleValue() + offsetSize) - (int) scroller.scrollAmount;
}
+
+ @Override
+ public @Nullable Tooltip getCurrentTooltip(Point point) {
+ Tooltip tooltip = super.getCurrentTooltip(point);
+ if (tooltip != null) {
+ tooltip.getText().add(ImmutableLiteralText.EMPTY);
+ tooltip.getText().add(new TranslatableComponent("tooltip.rei.drag_to_add_favorites"));
+ }
+ return tooltip;
+ }
}
public void updateEntriesPosition(Predicate<SectionFavoriteWidget> animated) {
@@ -983,5 +1009,5 @@ public class FavoritesListWidget extends WidgetWithBounds {
}
}
}
- }*/
+ }
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java
index 61e34042f..8a9153bf3 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.impl;
import me.shedaniel.rei.api.entry.EntryDefinition;
@@ -13,7 +36,7 @@ import java.util.concurrent.atomic.AtomicReference;
@ApiStatus.Internal
public class EntryTypeDeferred<T> implements EntryType<T> {
private final ResourceLocation id;
- private AtomicReference<WeakReference<EntryDefinition<T>>> value = new AtomicReference<>();
+ private WeakReference<EntryDefinition<T>> reference;
public EntryTypeDeferred(ResourceLocation id) {
this.id = id;
@@ -26,7 +49,6 @@ public class EntryTypeDeferred<T> implements EntryType<T> {
@Override
public @NotNull EntryDefinition<T> getDefinition() {
- WeakReference<EntryDefinition<T>> reference = value.get();
if (reference != null) {
EntryDefinition<T> definition = reference.get();
if (definition != null) {
@@ -34,10 +56,11 @@ public class EntryTypeDeferred<T> implements EntryType<T> {
}
}
EntryDefinition<?> d = EntryTypeRegistry.getInstance().get(id);
- if (d == null)
+ if (d == null) {
throw new NullPointerException("Entry type " + id + " doesn't exist!");
+ }
EntryDefinition<T> definition = d.cast();
- value.set(new WeakReference<>(definition));
+ reference = new WeakReference<>(definition);
return definition;
}
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java
index c336c03f7..c7dec1540 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.impl;
import com.google.common.collect.BiMap;
@@ -10,6 +33,7 @@ import me.shedaniel.rei.api.entry.EntryTypeBridge;
import me.shedaniel.rei.api.entry.EntryTypeRegistry;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
@@ -45,6 +69,7 @@ public class EntryTypeRegistryImpl implements EntryTypeRegistry {
}
@Override
+ @NotNull
public <A, B> Iterable<EntryTypeBridge<A, B>> getBridgesFor(EntryType<A> original, EntryType<B> destination) {
List<? extends EntryTypeBridge<?, ?>> list = this.typeBridges.get(original.getId(), destination.getId());
if (list == null) {
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/IssuesDetector.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/IssuesDetector.java
index b6b8e64fb..326425a93 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/IssuesDetector.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/IssuesDetector.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.impl;
import me.shedaniel.rei.RoughlyEnoughItemsState;
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
index 6a15f25c8..d48fcec02 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
@@ -206,7 +206,7 @@ public class RecipeHelperImpl implements RecipeHelper {
}
for (EntryStack<?> stack : usagesFor) {
if (isStackWorkStationOfCategory(categoryId, stack)) {
- set.addAll(allRecipesFromCategory);
+ set.addAll(CollectionUtils.filter(allRecipesFromCategory, this::isDisplayVisible));
break;
}
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/TypedEntryStack.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/TypedEntryStack.java
index a4336580d..bda1f2b42 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/TypedEntryStack.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/TypedEntryStack.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.impl;
import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/entry/EmptyEntryDefinition.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/entry/EmptyEntryDefinition.java
index 98b8d8b9c..a4daa0b3e 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/entry/EmptyEntryDefinition.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/entry/EmptyEntryDefinition.java
@@ -1,3 +1,26 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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.impl.entry;
import com.mojang.blaze3d.vertex.PoseStack;
@@ -73,7 +96,7 @@ public enum EmptyEntryDefinition implements EntryDefinition<Unit> {
@Override
public int hash(EntryStack<Unit> entry, Unit value, ComparisonContext context) {
- return 0;
+ return ordinal();
}
@Override
@@ -98,12 +121,12 @@ public enum EmptyEntryDefinition implements EntryDefinition<Unit> {
private enum EmptyRenderer implements EntryRenderer<Unit> {
INSTANCE;
-
+
@Override
public void render(EntryStack<Unit> entry, PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
-
+
}
-
+
@Override
public @Nullable Tooltip getTooltip(EntryStack<Unit> entry, Point mouse) {
return null;