generated from kappa-maintainer/1.12.2-FG6-Template
-
Notifications
You must be signed in to change notification settings - Fork 11
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
1 parent
83a8695
commit e3539e6
Showing
11 changed files
with
157 additions
and
8 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
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,80 @@ | ||
package com.cleanroommc; | ||
|
||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper; | ||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.tree.*; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class PostApplyMixinPlugin implements IMixinConfigPlugin { | ||
private static boolean hit = false; | ||
@Override | ||
public void onLoad(String mixinPackage) { | ||
|
||
} | ||
|
||
@Override | ||
public String getRefMapperConfig() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) { | ||
|
||
} | ||
|
||
@Override | ||
public List<String> getMixins() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { | ||
|
||
} | ||
|
||
@Override | ||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { | ||
if (hit || !targetClassName.equals("net.minecraft.client.renderer.BlockFluidRenderer")) { | ||
return; | ||
} | ||
for (MethodNode methodNode : targetClass.methods) { | ||
if (methodNode != null) { | ||
InsnList insnList = methodNode.instructions; | ||
if (insnList != null) | ||
for (AbstractInsnNode abstractInsnNode : insnList) { | ||
if (abstractInsnNode instanceof MethodInsnNode methodInsnNode) { | ||
if (methodInsnNode.owner.startsWith("org/spongepowered/asm/synthetic/args/Args$")) { | ||
if (methodInsnNode.name.equals("of")) { | ||
methodInsnNode.owner = "com/cleanroommc/helper/ArgsHelper"; | ||
methodInsnNode.desc = "(FFFF)Lcom/cleanroommc/helper/ArgsHelper;"; | ||
} | ||
if (methodInsnNode.name.startsWith("$")) { | ||
int index = Integer.parseInt(methodInsnNode.name.substring(1)); | ||
if (index < 6) { | ||
insnList.insertBefore(methodInsnNode, new InsnNode(Opcodes.ICONST_0 + index)); | ||
} else { | ||
insnList.insertBefore(methodInsnNode, new LdcInsnNode(index)); | ||
} | ||
insnList.insert(methodInsnNode, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F")); | ||
insnList.insert(methodInsnNode, new TypeInsnNode(Opcodes.CHECKCAST, "java/lang/Float")); | ||
methodInsnNode.owner = "com/cleanroommc/helper/ArgsHelper"; | ||
methodInsnNode.desc = "(I)Ljava/lang/Object;"; | ||
methodInsnNode.name = "get"; | ||
hit = true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,41 @@ | ||
package com.cleanroommc.helper; | ||
|
||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args; | ||
|
||
public class ArgsHelper extends Args { | ||
private Object[] args; | ||
/** | ||
* Ctor. | ||
* | ||
* @param values argument values | ||
*/ | ||
protected ArgsHelper(Object[] values) { | ||
super(values); | ||
args = values; | ||
} | ||
|
||
@Override | ||
public <T> void set(int index, T value) { | ||
args[index] = value; | ||
} | ||
|
||
@Override | ||
public void setAll(Object... values) { | ||
args = values; | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return this.args.length; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public <T> T get(int index) { | ||
return (T)this.args[index]; | ||
} | ||
|
||
public static ArgsHelper of(float a, float b, float c, float d) { | ||
return new ArgsHelper(new Object[]{a,b,c,d}); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...main/java/com/cleanroommc/HookHelper.java → ...va/com/cleanroommc/helper/HookHelper.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.cleanroommc; | ||
package com.cleanroommc.helper; | ||
|
||
import scala.tools.asm.Opcodes; | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
src/main/java/com/cleanroommc/mixin/aquaacrobatics/BlockFluidRendererMixin.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,8 @@ | ||
package com.cleanroommc.mixin.aquaacrobatics; | ||
|
||
import net.minecraft.client.renderer.BlockFluidRenderer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(value = BlockFluidRenderer.class, priority = 0) | ||
public class BlockFluidRendererMixin { | ||
} |
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
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,13 @@ | ||
{ | ||
"required": true, | ||
"package": "com.cleanroommc.mixin.aquaacrobatics", | ||
"compatibilityLevel": "JAVA_8", | ||
"refmap": "fugue.mixin.refmap.json", | ||
"plugin": "com.cleanroommc.PostApplyMixinPlugin", | ||
"mixins": [ | ||
"BlockFluidRendererMixin" | ||
], | ||
"client": [ | ||
], | ||
"minVersion": "0.8" | ||
} |