Skip to content

Commit e779f14

Browse files
chore: removed screenposition, removed static_method from click handling
1 parent 0ae31fd commit e779f14

File tree

3 files changed

+3
-93
lines changed

3 files changed

+3
-93
lines changed

common/src/main/java/dev/ftb/mods/ftblibrary/math/ScreenPosition.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

common/src/main/java/dev/ftb/mods/ftblibrary/ui/BaseScreen.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -504,17 +504,6 @@ public final void openGui() {
504504
getMinecraft().setScreen(new ScreenWrapper(this));
505505
}
506506

507-
/**
508-
* This is poorly named, so let's move over to getWindow()
509-
*
510-
* @deprecated use {@link #getWindow()} instead
511-
*/
512-
@Deprecated
513-
@Override
514-
public final Window getScreen() {
515-
return getMinecraft().getWindow();
516-
}
517-
518507
@Override
519508
public Window getWindow() {
520509
return getMinecraft().getWindow();

common/src/main/java/dev/ftb/mods/ftblibrary/util/client/ClientUtils.java

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
import net.minecraft.util.Util;
1818
import org.jetbrains.annotations.Nullable;
1919

20-
import java.lang.invoke.MethodHandle;
21-
import java.lang.invoke.MethodHandles;
22-
import java.lang.invoke.MethodType;
2320
import java.net.URI;
24-
import java.util.*;
21+
import java.util.ArrayList;
22+
import java.util.List;
23+
import java.util.Objects;
2524
import java.util.function.BooleanSupplier;
2625

2726
public class ClientUtils {
2827
public static final BooleanSupplier IS_CLIENT_OP = () -> Minecraft.getInstance().player != null && Minecraft.getInstance().player.permissions().hasPermission(Permissions.COMMANDS_GAMEMASTER);
2928
public static final List<Runnable> RUN_LATER = new ArrayList<>();
30-
private static final MethodType EMPTY_METHOD_TYPE = MethodType.methodType(void.class);
31-
private static final HashMap<String, Optional<MethodHandle>> staticMethodCache = new HashMap<>();
3229

3330
public static void execClientCommand(String command, boolean printChat) {
3431
if (!command.isEmpty() && Minecraft.getInstance().player != null) {
@@ -103,27 +100,6 @@ public static boolean handleClick(String scheme, String path) {
103100
execClientCommand(path, false);
104101
return true;
105102
}
106-
case "static_method" -> {
107-
return staticMethodCache.computeIfAbsent(path, k -> {
108-
var s = path.split(":", 2);
109-
try {
110-
Class<?> cls = Class.forName(s[0]);
111-
return Optional.ofNullable(MethodHandles.publicLookup().findStatic(cls, s[1], EMPTY_METHOD_TYPE));
112-
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException |
113-
ArrayIndexOutOfBoundsException ex) {
114-
logHandleClickFailure(scheme, path, ex);
115-
return Optional.empty();
116-
}
117-
}).map(handle -> {
118-
try {
119-
handle.invoke();
120-
return true;
121-
} catch (Throwable ex) {
122-
logHandleClickFailure(scheme, path, ex);
123-
return false;
124-
}
125-
}).orElse(false);
126-
}
127103
case "custom" -> {
128104
return trySendCustomClickEvent(path);
129105
}

0 commit comments

Comments
 (0)