How to block light with a custom 3D block

Started by gwagwa77777 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to block light with a custom 3D block

hi!! I know that custom 3D models for blocks allows light through by default, but is there any way to disable this? My custom block is being used for the ground layer of a biome and I don't want caves underneath to have light coming through when there shouldn't be. 

I've tried changing the transparency types and light opacity levels, it didn't make a difference.

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nevermind all i had to do…
Sat, 11/04/2023 - 01:55

nevermind all i had to do was set the light opacity to 15 LOL

i guess if anyone else is having this issue, set it to 15 instead of 255 like i did 

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
....nevermind again, every…
Sat, 11/04/2023 - 05:10

....nevermind again, every time i set it to 15 it just forces itself back to 0.

any ideas on what to do here?

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
maybe you'll need to lock…
Thu, 11/09/2023 - 23:20

maybe you'll need to lock the block, et in the files, and in one of them (which is a .json) you should find light opacity, put it back to 15

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Have you saved the block?…
Sat, 11/18/2023 - 11:49

Have you saved the block? Pretty sure X'ing out of the block without pressing the save button doesn't save your block.

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it doesnt work for custom…
Sun, 11/09/2025 - 15:49

it doesnt work for custom models blocks, the opacity resets to 0 its even described on the 'transparent parts' checkbox and the checkbox is locked if the model is custom, this is very annoying tbh, and makes you have to lock the code to change for your custom windows for example.. i wonder why its made like this

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i cant find any 'opacity'…
Sun, 11/09/2025 - 16:03

i cant find any 'opacity' reference on any of the files of the block, very frustating not even manually i can create windows that actually block light?

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
these 2 lines u can change: …
Sun, 11/09/2025 - 16:48

these 2 lines u can change:

@Override
public int getLightBlock(BlockState state, BlockGetter world, BlockPos pos) {
   return 15; // full light block
}

@Override
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) {
   return false;
}

 

this will make the custom block block the light BUT if u have another source of light near the block will turn pitch black ugly bugged unfortunly