diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-09-12 23:05:35 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-09-18 02:09:37 +0800 |
| commit | d70b8353a6db5fc5d835af5d662372952703d2fd (patch) | |
| tree | 3240993c382a2ae27f6d328a8852261ce6c619d7 /api/src/main/java/me | |
| parent | 229b1fecdac427d3debe68f52ed7276e54a11cd0 (diff) | |
| download | RoughlyEnoughItems-d70b8353a6db5fc5d835af5d662372952703d2fd.tar.gz RoughlyEnoughItems-d70b8353a6db5fc5d835af5d662372952703d2fd.tar.bz2 RoughlyEnoughItems-d70b8353a6db5fc5d835af5d662372952703d2fd.zip | |
Obfuscate REI Internals
Diffstat (limited to 'api/src/main/java/me')
3 files changed, 53 insertions, 2 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java b/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java index 496fb72d9..55f63b1b7 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java @@ -143,6 +143,23 @@ public abstract class ScreenOverlay extends WidgetWithBounds { */ public abstract boolean isHighlighting(); + /** + * Submits a display to the overlay history. + * + * @param display the display to submit + * @param fromBounds the bounds of the display + * @return whether the display was submitted + */ @ApiStatus.Experimental public abstract boolean submitDisplayHistory(Display display, @Nullable Rectangle fromBounds); + + /** + * Renders the late widgets. + * + * @param matrices the matrices transform + * @param mouseX the x-coordinate of the mouse + * @param mouseY the y-coordinate of the mouse + * @param delta the tick delta + */ + public abstract void lateRender(PoseStack matrices, int mouseX, int mouseY, float delta); } diff --git a/api/src/main/java/me/shedaniel/rei/impl/client/ClientInternals.java b/api/src/main/java/me/shedaniel/rei/impl/client/ClientInternals.java index 22c64a606..c2b2ad0ea 100644 --- a/api/src/main/java/me/shedaniel/rei/impl/client/ClientInternals.java +++ b/api/src/main/java/me/shedaniel/rei/impl/client/ClientInternals.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client; -import com.google.common.base.Suppliers; import com.mojang.serialization.DataResult; import me.shedaniel.math.Point; import me.shedaniel.rei.api.client.ClientHelper; @@ -50,6 +49,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; import java.util.Collection; import java.util.List; import java.util.function.*; @@ -94,7 +94,18 @@ public final class ClientInternals { @ApiStatus.Internal public static <T> void attachInstance(T instance, Class<T> clazz) { - attachInstanceSupplier(instance, clazz.getSimpleName()); + try { + for (Field field : ClientInternals.class.getDeclaredFields()) { + if (field.getGenericType() instanceof ParameterizedType && ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0] == clazz) { + field.setAccessible(true); + field.set(null, (Supplier<T>) () -> instance); + return; + } + } + throw new RuntimeException("Failed to attach " + instance + " with field type: " + clazz); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } } @ApiStatus.Internal diff --git a/api/src/main/java/me/shedaniel/rei/impl/client/provider/OverlayProvider.java b/api/src/main/java/me/shedaniel/rei/impl/client/provider/OverlayProvider.java index c3688626a..4d06bd4bd 100644 --- a/api/src/main/java/me/shedaniel/rei/impl/client/provider/OverlayProvider.java +++ b/api/src/main/java/me/shedaniel/rei/impl/client/provider/OverlayProvider.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.provider; import me.shedaniel.rei.api.client.overlay.ScreenOverlay; |
