diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-08-09 01:10:48 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-08-09 01:10:48 +0800 |
| commit | a88baa93b687a85a15c0911ee7b15d54b1d45cbb (patch) | |
| tree | 926ec8287367aac0076b48162235e1e6df601e75 /RoughlyEnoughItems-runtime/src/main/java | |
| parent | 2489907c41ce77376e1e100acc56aebc6948b115 (diff) | |
| download | RoughlyEnoughItems-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.java | 21 |
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 * |
