aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-02-15 01:44:20 +0800
committershedaniel <daniel@shedaniel.me>2022-02-15 01:44:20 +0800
commitf8e6de6909b4c9b4e725bd79e154374aeb0290f8 (patch)
treedf633e5c082e80d2dc921b70b19c8974e660e5b2 /runtime
parent53da029b48084255103733b3a932948f84f58011 (diff)
downloadRoughlyEnoughItems-f8e6de6909b4c9b4e725bd79e154374aeb0290f8.tar.gz
RoughlyEnoughItems-f8e6de6909b4c9b4e725bd79e154374aeb0290f8.tar.bz2
RoughlyEnoughItems-f8e6de6909b4c9b4e725bd79e154374aeb0290f8.zip
Support JEI API 9.3
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java23
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java19
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java1
3 files changed, 42 insertions, 1 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java
index 1015160f8..74b5e220a 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java
@@ -1,3 +1,26 @@
+/*
+ * 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.impl.client.gui.widget;
import me.shedaniel.rei.api.common.util.ImmutableTextComponent;
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
index c07a29072..df371c961 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
@@ -56,6 +56,7 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.AbstractContainerMenu;
import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.function.Consumer;
@@ -64,7 +65,25 @@ import java.util.stream.Stream;
@ApiStatus.Internal
public class ViewsImpl implements Views {
+ private static final ThreadLocal<ViewSearchBuilder> BUILDER = new ThreadLocal<>();
+
+ @Nullable
+ @Override
+ public ViewSearchBuilder getContext() {
+ return BUILDER.get();
+ }
+
public static Map<DisplayCategory<?>, List<DisplaySpec>> buildMapFor(ViewSearchBuilder builder) {
+ BUILDER.set(builder);
+
+ try {
+ return _buildMapFor(builder);
+ } finally {
+ BUILDER.remove();
+ }
+ }
+
+ private static Map<DisplayCategory<?>, List<DisplaySpec>> _buildMapFor(ViewSearchBuilder builder) {
if (PluginManager.areAnyReloading()) {
RoughlyEnoughItemsCore.LOGGER.info("Cancelled Views buildMap since plugins have not finished reloading.");
return Maps.newLinkedHashMap();
diff --git a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java
index 62ec927db..1515ed6ae 100644
--- a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java
+++ b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java
@@ -298,7 +298,6 @@ public class ItemEntryDefinition implements EntryDefinition<ItemStack>, EntrySer
Minecraft.getInstance().getItemRenderer().render(value, ItemTransforms.TransformType.GUI, false, matrices, immediate,
ITEM_LIGHT, OverlayTexture.NO_OVERLAY, model);
matrices.popPose();
- throw new AssertionError();
/*ItemStack value = entry.getValue();
matrices.pushPose();