-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data-driven addition of enum constants (#148)
- Loading branch information
Showing
17 changed files
with
1,130 additions
and
222 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
loader/src/main/java/net/neoforged/fml/common/asm/ListGeneratorAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.fml.common.asm; | ||
|
||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.commons.GeneratorAdapter; | ||
import org.objectweb.asm.tree.InsnList; | ||
import org.objectweb.asm.tree.MethodNode; | ||
|
||
public class ListGeneratorAdapter extends GeneratorAdapter { | ||
public final InsnList insnList; | ||
|
||
public ListGeneratorAdapter(InsnList insnList) { | ||
super(Opcodes.ASM9, null, 0, "", "()V"); | ||
this.insnList = insnList; | ||
MethodNode method = new MethodNode(); | ||
method.instructions = insnList; | ||
mv = method; | ||
} | ||
} |
220 changes: 0 additions & 220 deletions
220
loader/src/main/java/net/neoforged/fml/common/asm/RuntimeEnumExtender.java
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
loader/src/main/java/net/neoforged/fml/common/asm/enumextension/EnumParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.fml.common.asm.enumextension; | ||
|
||
import java.util.List; | ||
import org.objectweb.asm.Type; | ||
|
||
sealed interface EnumParameters { | ||
record Constant(List<Object> params) implements EnumParameters {} | ||
|
||
record FieldReference(Type owner, String fieldName) implements EnumParameters {} | ||
|
||
record MethodReference(Type owner, String methodName) implements EnumParameters {} | ||
} |
Oops, something went wrong.