File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
codebook-lvt/src/main/java/io/papermc/codebook/lvt/suggestion/numbers Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -41,20 +41,23 @@ public class RandomSourceSuggester implements LvtSuggester {
4141
4242 static final JvmType RANDOM_SOURCE_TYPE = new ClassType ("net/minecraft/util/RandomSource" );
4343
44- private final ClassData randomSourceClass ;
44+ private final @ Nullable ClassData randomSourceClass ;
4545
4646 @ Inject
4747 RandomSourceSuggester (final HypoContext hypoContext ) throws IOException {
48- final @ Nullable ClassData random = hypoContext .getContextProvider ().findClass (RANDOM_SOURCE_TYPE );
49- if (random == null ) {
50- throw new IllegalStateException ( "Cannot find " + RANDOM_SOURCE_TYPE + " on the classpath. " );
48+ this . randomSourceClass = hypoContext .getContextProvider ().findClass (RANDOM_SOURCE_TYPE );
49+ if (this . randomSourceClass == null ) {
50+ System . err . println ( "Failed to find RandomSource class, disabling RandomSourceSuggester " );
5151 }
52- this .randomSourceClass = random ;
5352 }
5453
5554 @ Override
5655 public @ Nullable String suggestFromMethod (
5756 final MethodCallContext call , final MethodInsnContext insn , final ContainerContext container ) {
57+ if (this .randomSourceClass == null ) {
58+ return null ;
59+ }
60+
5861 final String methodName = call .data ().name ();
5962 ClassData ownerClass = insn .owner ();
6063 if (ownerClass .doesExtendOrImplement (this .randomSourceClass )) {
Original file line number Diff line number Diff line change 11group = io.papermc.codebook
2- version = 1.0.7
2+ version = 1.0.8
You can’t perform that action at this time.
0 commit comments