Skip to content

Commit

Permalink
use method presence instead of class presence
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolij committed Apr 5, 2024
1 parent 9cd9718 commit 4812f54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ public boolean isZoomOutPressed() {
MethodHandle thirdPersonView = null;

try {
Class.forName(
ObfuscationReflectionHelper.remapName(
INameMappingService.Domain.CLASS, "net/minecraft/client/CameraType")
.replace('/', '.'));

final String getCameraTypeName = ObfuscationReflectionHelper.remapName(
INameMappingService.Domain.METHOD, "func_243230_g");

Expand All @@ -85,14 +80,14 @@ public boolean isZoomOutPressed() {

ordinal = lookup.unreflect(Enum.class.getMethod("ordinal"))
.asType(MethodType.methodType(int.class, Enum.class));
} catch (ClassNotFoundException ignored) {
} catch (NoSuchMethodException ignored) {
try {
//noinspection JavaLangInvokeHandleSignature
thirdPersonView = lookup.findGetter(Options.class, "field_74320_O", int.class);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new AssertionError(e);
}
} catch (IllegalAccessException | NoSuchMethodException e) {
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}

Expand Down
6 changes: 2 additions & 4 deletions modern/src/main/java/dev/nolij/zume/modern/ModernZume.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ public boolean isZoomOutPressed() {
MethodHandle perspective = null;

try {
Class.forName(mappingResolver.mapClassName("intermediary", "net.minecraft.class_5498"));

final String getPerspectiveName = mappingResolver.mapMethodName("intermediary",
"net.minecraft.class_315", "method_31044", "()Lnet/minecraft/class_5498;");

Expand All @@ -70,14 +68,14 @@ public boolean isZoomOutPressed() {

ordinal = lookup.unreflect(Enum.class.getMethod("ordinal"))
.asType(MethodType.methodType(int.class, Enum.class));
} catch (ClassNotFoundException ignored) {
} catch (NoSuchMethodException ignored) {
try {
//noinspection JavaLangInvokeHandleSignature
perspective = lookup.findGetter(GameOptions.class, "field_1850", int.class);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new AssertionError(e);
}
} catch (IllegalAccessException | NoSuchMethodException e) {
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}

Expand Down

0 comments on commit 4812f54

Please sign in to comment.