Sign in to follow this  
joedobo

suggestions on removing fire glow.

Recommended Posts

The glow effect from flame fire (campfire, forges, oven, stills); and especially when you got multiple forges, still, ovens...etc next to each other; is too bright. I tried to remove it by modding the size and color fields of FireEffect class and setting them to 0 and it kinda works but I suspect it's mostly because of 0 color light. The still's fire doesn't seem to be affected at all from changes to FireEffect.

 I don't mind the flame animation, it's the light that is produced which I want to remove. Any changes I make can't affect lanterns or lamp posts.

 

Spoiler

package com.joedobo27.nolightfurnacesmod;


import javassist.*;
import javassist.bytecode.Descriptor;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.interfaces.Configurable;
import org.gotti.wurmunlimited.modloader.interfaces.PreInitable;
import org.gotti.wurmunlimited.modloader.interfaces.WurmClientMod;

import java.util.Objects;
import java.util.Properties;
import java.util.logging.Logger;

public class NoLightFurnacesMod implements WurmClientMod, Configurable, PreInitable{

    private static final Logger logger = Logger.getLogger(NoLightFurnacesMod.class.getName());

    @Override
    public void configure(Properties properties) {

    }

    @Override
    public void preInit() {
        try {
            CtClass FireEffectCt = HookManager.getInstance().getClassPool().get("com.wurmonline.client.renderer.effects.FireEffect");

            CtClass returnType = CtPrimitiveType.booleanType;
            CtClass[] paramTypes = {
                    HookManager.getInstance().getClassPool().get("com.wurmonline.client.renderer.effects.EffectContext")
            };
            CtMethod gameTickCt = FireEffectCt.getMethod("gameTick", Descriptor.ofMethod(returnType, paramTypes));
            gameTickCt.instrument(new ExprEditor(){
                @Override
                public void edit(MethodCall methodCall) throws CannotCompileException{
                    if (Objects.equals("setValue", methodCall.getMethodName()))
                        logger.info("replace on getItemWithTemplateAndMaterial inside Item.AddBulkItem() at line "
                                + methodCall.getLineNumber());
                    methodCall.replace("{ $1 = 0.0f; $proceed($$); }");
                }
            });
        }catch (NotFoundException | CannotCompileException e){
            logger.warning(e.getMessage());
        }
    }
}

 

Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this