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
fcca93b
commit 183fb83
Showing
11 changed files
with
146 additions
and
4 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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/com/cleanroommc/fugue/mixin/subaquatic/IBubbleColumnMixin.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,35 @@ | ||
package com.cleanroommc.fugue.mixin.subaquatic; | ||
|
||
import git.jbredwards.subaquatic.mod.common.capability.IBubbleColumn; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
|
||
@Mixin(value = IBubbleColumn.class, remap = false) | ||
public interface IBubbleColumnMixin { | ||
@Shadow @Final @Nonnull public static Map<Class<?>, Supplier<IBubbleColumn>> BUBBLE_COLUMN_FACTORY = null; | ||
|
||
@Shadow | ||
public static Supplier<IBubbleColumn> getHandlerForClass(@Nonnull Class<?> clazzIn) { | ||
return null; | ||
} | ||
|
||
@Inject(method = "getHandlerForClass", at = @At("HEAD"), cancellable = true) | ||
private static void fixCME(@Nonnull Class<?> clazzIn, CallbackInfoReturnable<Supplier<IBubbleColumn>> cir) { | ||
if(clazzIn == Object.class) throw new IllegalArgumentException("Class has no bubble column handler, this should never happen!"); | ||
cir.setReturnValue(() -> { | ||
if(BUBBLE_COLUMN_FACTORY.containsKey(clazzIn)) { | ||
return BUBBLE_COLUMN_FACTORY.get(clazzIn).get(); | ||
} else { | ||
return getHandlerForClass(clazzIn.getSuperclass()).get(); | ||
} | ||
}); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/cleanroommc/fugue/transformer/SubaquaticIMTransformer.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,42 @@ | ||
package com.cleanroommc.fugue.transformer; | ||
|
||
import org.objectweb.asm.ClassReader; | ||
import org.objectweb.asm.ClassWriter; | ||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.tree.*; | ||
import top.outlands.foundation.IExplicitTransformer; | ||
|
||
public class SubaquaticIMTransformer implements IExplicitTransformer { | ||
@Override | ||
public byte[] transform(byte[] bytes) { | ||
ClassNode classNode = new ClassNode(); | ||
ClassReader classReader = new ClassReader(bytes); | ||
classReader.accept(classNode, 0); | ||
if (classNode.methods != null) | ||
{ | ||
for (MethodNode methodNode : classNode.methods) | ||
{ | ||
if (methodNode.name.equals("func_151618_b")) { | ||
InsnList instructions = methodNode.instructions; | ||
if (instructions != null) | ||
{ | ||
for (AbstractInsnNode insnNode : instructions) | ||
{ | ||
if (insnNode.getOpcode() == Opcodes.INVOKESTATIC && insnNode instanceof MethodInsnNode methodInsnNode) | ||
{ | ||
if (methodInsnNode.owner.equals("git/jbredwards/subaquatic/api/biome/IOceanBiome") && (methodInsnNode.name.equals("isOcean"))) | ||
{ | ||
methodInsnNode.itf = true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
ClassWriter classWriter = new ClassWriter(0); | ||
|
||
classNode.accept(classWriter); | ||
return classWriter.toByteArray(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/cleanroommc/fugue/transformer/subaquatic/PluginEntityTransformer.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,35 @@ | ||
package com.cleanroommc.fugue.transformer.subaquatic; | ||
|
||
import com.cleanroommc.fugue.common.Fugue; | ||
import javassist.CannotCompileException; | ||
import javassist.ClassPool; | ||
import javassist.CtClass; | ||
import javassist.expr.ExprEditor; | ||
import javassist.expr.NewExpr; | ||
import top.outlands.foundation.IExplicitTransformer; | ||
|
||
import java.io.ByteArrayInputStream; | ||
|
||
public class PluginEntityTransformer implements IExplicitTransformer { | ||
@Override | ||
public byte[] transform(byte[] bytes) { | ||
try { | ||
CtClass cc = ClassPool.getDefault().makeClass(new ByteArrayInputStream(bytes)); | ||
cc.getDeclaredMethod("transform").instrument(new ExprEditor() { | ||
@Override | ||
public void edit(NewExpr e) throws CannotCompileException { | ||
if (e.getLineNumber() == 58 && e.getClassName().equals("org.objectweb.asm.tree.VarInsnNode")) { | ||
e.replace( | ||
""" | ||
$_ = $proceed(25, 26); | ||
"""); | ||
} | ||
} | ||
}); | ||
bytes = cc.toBytecode(); | ||
} catch (Throwable t) { | ||
Fugue.LOGGER.error(t); | ||
} | ||
return bytes; | ||
} | ||
} |
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