Changed light level config to affect getLightEmission instead of registry since we can't use config options during registry.
This commit is contained in:
@ -8,6 +8,7 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.BonemealableBlock;
|
||||
@ -24,6 +25,11 @@ public class FireflyBushBlock extends BushBlock implements BonemealableBlock {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) {
|
||||
return Config.Client.bushFireflyLightLevel.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public void animateTick(BlockState blockState, Level level, BlockPos blockPos, RandomSource randomSource) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package dev.micle.firefly_bush_backport.block;
|
||||
|
||||
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
||||
import dev.micle.firefly_bush_backport.config.Config;
|
||||
import dev.micle.firefly_bush_backport.item.ModItems;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
@ -24,7 +23,7 @@ public class ModBlocks {
|
||||
() -> new FireflyBushBlock(BlockBehaviour.Properties.of()
|
||||
.mapColor(MapColor.PLANT)
|
||||
.ignitedByLava()
|
||||
.lightLevel(blockState -> Config.Client.bushFireflyLightLevel.get())
|
||||
.lightLevel(blockState -> 2)
|
||||
.noCollission()
|
||||
.instabreak()
|
||||
.sound(SoundType.SWEET_BERRY_BUSH)
|
||||
|
@ -76,7 +76,7 @@ public final class Config {
|
||||
bushFireflyAmbientSoundPitch = builder
|
||||
.defineInRange("bushFireflyAmbientSoundPitch", 1.0, 0, Double.MAX_VALUE);
|
||||
bushFireflyLightLevel = builder
|
||||
.comment("NOTE: This option requires a restart!")
|
||||
.comment("NOTE: This option requires blocks to be replaced!")
|
||||
.defineInRange("bushFireflyLightLevel", 2, 0, Level.MAX_BRIGHTNESS);
|
||||
builder.pop();
|
||||
}
|
||||
|
Reference in New Issue
Block a user