Mekanism

Mekanism

111M Downloads

[8.0.0] BlockMachine's getLightValue() calling client only code on server.

halvors opened this issue ยท 5 comments

commented

This need to be isolated to only the client, simple fix here would be adding the @SideOnly(Side.CLIENT) macro, but think there should be light value on the server as well, just that it should call client specific code.

I've tested with the @SideOnly(Side.CLIENT), and that works just fine, so this is definitly client code getting called.

Here is the crashlog: http://pastebin.com/faMBRaJm

@Override
    public int getLightValue(IBlockAccess world, int x, int y, int z)
    {
        if(client.enableAmbientLighting)
        {
            TileEntity tileEntity = world.getTileEntity(x, y, z);

            if(tileEntity instanceof IActiveState)
            {
                if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).lightUpdate())
                {
                    return client.ambientLightingLevel;
                }
            }
        }

        return 0;
    }
commented

Fixed!

commented

That's odd, MekanismConfig.client isn't client-side only, and indeed this method runs without issue for me in a development environment. I suspect fastcraft (maybe? or maybe something else) is doing something stupid like stripping anything with the word "client" in it from the server-side.

commented

Hmm. I agree, when looking at the code i actually couldn't find why this shouldn't be able to run on the server as well.

I did run fastcraft, but removed it in my test, but cannot remember if it was before or after, i think it was before the crash i removed it.

commented

Perfect.

commented

That's odd. Anyway, making those methods client-only would have disabled machine lighting altogether, I think, so I've moved the config options to the general config.