Repository navigation
Ambience
satisfy edited this page Oct 7, 2026
·
1 revision
Every block in the tag foundation:attracts_fireflies gets fireflies at night – outdoors, no rain, and only while lit
(if the block has a lit property, or luminance for a LampBlock).
Turn it on (client init). Pass your config switch – Foundation has none:
FireflyAmbience.init(MyConfig::fireflies);Several mods may call init; fireflies show when all passed switches are on.
Add your blocks – data/foundation/tags/block/attracts_fireflies.json in your mod:
{
"replace": false,
"values": ["mymod:paper_lantern"]
}Vanilla lanterns and #c:lanterns are already in.
@Override
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) {
if (random.nextInt(12) == 0 && MyConfig.fireflies() && Fireflies.isActive(level, pos)) {
Fireflies.spawn(level, pos, random, 0.5, 0.6); // spread, height above the block
}
}