Mrbysco / EnchantableBlocks

Enchantable Blocks is a mod that allows you to enchant certain blocks with different enchantments
https://www.curseforge.com/minecraft/mc-mods/enchantable-blocks
MIT License
1 stars 2 forks source link

Fix solar radiance not working in void worlds #10

Closed sciwhiz12 closed 4 days ago

sciwhiz12 commented 4 days ago

This PR fixes #6 by adjusting the solar radiance check in AbstractEnchantedFurnaceBlockEntity to check against the sky darkness directly for dimensions with fixed time, as does the void world from the Just Another Void Dimension mod.

Void worlds may have the dimension set to fixed time, in which case Level#isDay() will always return false. To workaround that, we check against the sky darkness (the same as what Level#isDay() does) for dimensions with fixed time.

The original Level#isDay() check is kept in case it is overridden by some mod for a custom implementation of Level.

Note that the concept of fixed time used by Level#isDay() is from the dimension type; it is separate from the concept of 'having fixed time' due to disabling the daylight cycle through the gamerule. In the latter case, the level daytime is not fixed, but frozen since it is not updated (and the daytime can still be moved about, which isn't possible for fixed-time dimension types).

Post-merge edit: Here's a screenshot of the fix:

A furnace enchanted with Solar Radiance I cooking charcoal in a void dimension

sciwhiz12 commented 4 days ago

Apologies for the wrong PR title. I based off the PR on the 1.21.1 branch, but GitHub targeted the default branch 1.21, so the PR title came from the first commit in 1.21.1 that wasn't in the default branch.