Search in sources :

Example 1 with MethodTransformer

use of codechicken.lib.asm.ModularASMTransformer.MethodTransformer in project Galacticraft by micdoodle8.

the class TweakTransformer method load.

public static void load() {
    CodeChickenCoreModContainer.loadConfig();
    tweaks = CodeChickenCoreModContainer.config.getTag("tweaks").setComment("Various tweaks that can be applied to game mechanics.").useBraces();
    tweaks.removeTag("persistantLava");
    if (tweaks.getTag("environmentallyFriendlyCreepers").setComment("If set to true, creepers will not destroy landscape. (A version of mobGriefing setting just for creepers)").getBooleanValue(false)) {
        transformer.add(new MethodReplacer(new ObfMapping("net/minecraft/entity/monster/EntityCreeper", "func_146077_cc", "()V"), blocks.get("d_environmentallyFriendlyCreepers"), blocks.get("environmentallyFriendlyCreepers")));
    }
    if (tweaks.getTag("finiteWater").setComment("If set to true two adjacent water source blocks will not generate a third.").getBooleanValue(false)) {
        transformer.add(new MethodTransformer(new ObfMapping("net/minecraft/block/BlockDynamicLiquid", "func_149674_a", "(Lnet/minecraft/world/World;IIILjava/util/Random;)V")) {

            @Override
            public void transform(MethodNode mv) {
                InsnListSection key = findOnce(mv.instructions, blocks.get("finiteWater").list);
                key.setLast(((JumpInsnNode) key.getLast()).label);
                key.remove();
            }
        });
    }
}
Also used : MethodTransformer(codechicken.lib.asm.ModularASMTransformer.MethodTransformer) MethodNode(org.objectweb.asm.tree.MethodNode) MethodReplacer(codechicken.lib.asm.ModularASMTransformer.MethodReplacer) JumpInsnNode(org.objectweb.asm.tree.JumpInsnNode)

Aggregations

MethodReplacer (codechicken.lib.asm.ModularASMTransformer.MethodReplacer)1 MethodTransformer (codechicken.lib.asm.ModularASMTransformer.MethodTransformer)1 JumpInsnNode (org.objectweb.asm.tree.JumpInsnNode)1 MethodNode (org.objectweb.asm.tree.MethodNode)1