-
Notifications
You must be signed in to change notification settings - Fork 30
Mixin #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
examples/runConfig.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be changed?
@@ -19,6 +19,9 @@ public class GroovyScriptTransformer implements IClassTransformer { | |||
@Override | |||
public byte[] transform(String name, String transformedName, byte[] bytes) { | |||
if (bytes == null) return null; | |||
if (transformedName.contains("PlayerLoggedInEvent") || transformedName.endsWith("PlayerList") || transformedName.endsWith("EntityPlayerMP") || transformedName.endsWith("NetworkManager") || transformedName.endsWith("NetHandlerPlayServer") || transformedName.endsWith("TextComponentString")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is debug code
src/main/java/com/cleanroommc/groovyscript/sandbox/MixinSandbox.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this stay in here? feels like test code
IMixinConfig config = Config.create(cfgName, MixinEnvironment.getDefaultEnvironment()).getConfig(); | ||
List<String> mixinClasses; | ||
try { | ||
Class<?> mixinConfigClass = Class.forName("org.spongepowered.asm.mixin.transformer.MixinConfig"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add mixinClasses by reflection? mixin has an API to add mixin class dynamically. IMixinConfigPlugin#getMixins
return new ScriptEngine(SandboxData.getRootUrls(), SandboxData.getMixinScriptCachePath(), SandboxData.getScriptFile(), config) | ||
.onClassLoaded(cc -> { | ||
GroovyLog.get().info(" - loaded mixin class {} from cache", cc.getName()); | ||
resourceCache.put(cc.getName(), cc.getData()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can not just put bytecodes to the cache. Some optimization mods (VintageFix & Loliasm) would set the cache to guava's cache that its content would be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should i handle this instead? That where mixin finds the mixin class bytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.