Shimmer

Shimmer

6.6k Downloads

No colored light visible when using java API LightManager.INSTANCE.registerBlockLight from the wiki, custom block

Lothrazar opened this issue ยท 4 comments

commented

Minecraft Version

1.18.2

Shimmer version

2:0.1.10

Modpack info or mod list

making a new mod

The latest.log file

https://pastebin.com/9k0as8Ee

optifine , Rubidium , flywheel or any rendering related mods. mod versrion is required.

Nope no other rendering mods, only forge 40.1.71 and my new custom mod. and JEI

Issue description

Im using the JAVA api from the wiki, and i wanted to give light to colored blocks.

However the light looks no different with or without the renderBlockLight call, i dont see anything. no colored light appears. i have a light block that changes color based on block state.

My code

    if (ModList.get().isLoaded("shimmer")) {
      LightManager.INSTANCE.registerBlockLight(LightBulbRegistry.BULB.get(), (state, pos) -> {
        if (state.hasProperty(BlockFlib.COLOUR)) {
          DyeColor colour = state.getValue(BlockFlib.COLOUR);
          System.out.println("LightManager.INSTANCE.registerBlockLight!colour" + colour.getMaterialColor().col);
          return new ColorPointLight.Template(16, colour.getMaterialColor().col);
        }
        return null;
      });

Which i targeted inside of FMLClientSetupEvent -> enqueueWork as said here
https://github.com/Low-Drag-MC/Shimmer/wiki/Coloured-Lights

Steps to reproduce

i did not touch the configs at all, i simply added the mod with gradle.

Then i added only the call to LightManager.INSTANCE.registerBlockLight( for my block

Other information

Screenshot
no show

commented

are you sure that the code in LightWrapper.init be executed

commented

btw, the color should be 0xAARRGGBB, I suppose your color is 0x00RRGGBB

commented

int color = DyeColor.color | 0xff000000.

besides, light radius is better be set as the light value of the block (no more than 15)

commented

it works! thank you for that last tip. i had to mask the color just like you said , i guess the first two 'ff's add an alpha or something similar

I dont see a visual difference when i change that first value. but yeah my light Level on the block is hardcoded at 15 so this works

        DyeColor colour = state.getValue(BlockFlib.COLOUR);
        int col = colour.getMaterialColor().col | 0xff000000;
        return new ColorPointLight.Template(14, col);

works