forked from shedaniel/LightOverlay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
262 additions
and
58 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Mon Feb 04 22:40:37 HKT 2019 | ||
#Thu Apr 16 21:43:39 HKT 2020 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip | ||
zipStoreBase=GRADLE_USER_HOME |
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
249 changes: 200 additions & 49 deletions
249
src/main/java/me/shedaniel/lightoverlay/LightOverlayClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,40 @@ | ||
var Opcodes = Java.type("org.objectweb.asm.Opcodes"); | ||
var FieldNode = Java.type("org.objectweb.asm.tree.FieldNode"); | ||
var InsnNode = Java.type("org.objectweb.asm.tree.InsnNode"); | ||
var JumpInsnNode = Java.type("org.objectweb.asm.tree.JumpInsnNode"); | ||
var LabelNode = Java.type("org.objectweb.asm.tree.LabelNode"); | ||
var VarInsnNode = Java.type("org.objectweb.asm.tree.VarInsnNode"); | ||
var MethodInsnNode = Java.type("org.objectweb.asm.tree.MethodInsnNode"); | ||
var ASMAPI = Java.type("net.minecraftforge.coremod.api.ASMAPI"); | ||
|
||
function initializeCoreMod() { | ||
return { | ||
"smooth-scrolling-everywhere": { | ||
'target': { | ||
'type': 'CLASS', | ||
'name': 'net.minecraft.network.NetworkManager' | ||
}, | ||
'transformer': function (classNode) { | ||
var processPacket = ASMAPI.mapMethod("func_197664_a"); | ||
for (i in classNode.methods) { | ||
var method = classNode.methods[i]; | ||
if (method.name === processPacket) { | ||
var instructions = method.instructions; | ||
var insnArray = instructions.toArray(); | ||
for (j in insnArray) { | ||
var instruction = insnArray[j]; | ||
if (instruction instanceof LabelNode) { | ||
instructions.insertBefore(instruction, new LabelNode()); | ||
instructions.insertBefore(instruction, new VarInsnNode(Opcodes.ALOAD, 0)); | ||
instructions.insertBefore(instruction, new MethodInsnNode(Opcodes.INVOKESTATIC, "me/shedaniel/lightoverlay/LightOverlay", "processPacket", "(Lnet/minecraft/network/IPacket;)V", false)); | ||
break; | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
return classNode; | ||
} | ||
} | ||
} | ||
} |
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,3 @@ | ||
{ | ||
"NetworkManager": "META-INF/NetworkManager.js" | ||
} |