aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-runtime/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-08-09 01:10:48 +0800
committershedaniel <daniel@shedaniel.me>2020-08-09 01:10:48 +0800
commita88baa93b687a85a15c0911ee7b15d54b1d45cbb (patch)
tree926ec8287367aac0076b48162235e1e6df601e75 /RoughlyEnoughItems-runtime/src/main/java
parent2489907c41ce77376e1e100acc56aebc6948b115 (diff)
downloadRoughlyEnoughItems-a88baa93b687a85a15c0911ee7b15d54b1d45cbb.tar.gz
RoughlyEnoughItems-a88baa93b687a85a15c0911ee7b15d54b1d45cbb.tar.bz2
RoughlyEnoughItems-a88baa93b687a85a15c0911ee7b15d54b1d45cbb.zip
Fix #395
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-runtime/src/main/java')
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java21
1 files changed, 2 insertions, 19 deletions
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 2bc92aff8..3a28fa405 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -89,6 +89,8 @@ import java.util.concurrent.Executors;
import java.util.function.BiFunction;
import java.util.function.Supplier;
+import static me.shedaniel.rei.impl.Internals.attachInstance;
+
@ApiStatus.Internal
@Environment(EnvType.CLIENT)
public class RoughlyEnoughItemsCore implements ClientModInitializer {
@@ -180,25 +182,6 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
attachInstance((BiFunction<@Nullable Point, Collection<Text>, Tooltip>) QueuedTooltip::create, "tooltipProvider");
}
- public static <T> void attachInstance(T instance, Class<T> clazz) {
- attachInstance((Supplier<T>) () -> instance, clazz.getSimpleName());
- }
-
- public static <T> void attachInstance(T instance, String name) {
- try {
- for (Field field : Internals.class.getDeclaredFields()) {
- if (field.getName().equalsIgnoreCase(name)) {
- field.setAccessible(true);
- field.set(null, instance);
- return;
- }
- }
- throw new RuntimeException("Failed to attach " + instance + " with field name: " + name);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
-
/**
* Registers a REI plugin
*