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.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.BonemealableBlock;
|
import net.minecraft.world.level.block.BonemealableBlock;
|
||||||
@ -24,6 +25,11 @@ public class FireflyBushBlock extends BushBlock implements BonemealableBlock {
|
|||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) {
|
||||||
|
return Config.Client.bushFireflyLightLevel.get();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public void animateTick(BlockState blockState, Level level, BlockPos blockPos, RandomSource randomSource) {
|
public void animateTick(BlockState blockState, Level level, BlockPos blockPos, RandomSource randomSource) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package dev.micle.firefly_bush_backport.block;
|
package dev.micle.firefly_bush_backport.block;
|
||||||
|
|
||||||
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
||||||
import dev.micle.firefly_bush_backport.config.Config;
|
|
||||||
import dev.micle.firefly_bush_backport.item.ModItems;
|
import dev.micle.firefly_bush_backport.item.ModItems;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
@ -24,7 +23,7 @@ public class ModBlocks {
|
|||||||
() -> new FireflyBushBlock(BlockBehaviour.Properties.of()
|
() -> new FireflyBushBlock(BlockBehaviour.Properties.of()
|
||||||
.mapColor(MapColor.PLANT)
|
.mapColor(MapColor.PLANT)
|
||||||
.ignitedByLava()
|
.ignitedByLava()
|
||||||
.lightLevel(blockState -> Config.Client.bushFireflyLightLevel.get())
|
.lightLevel(blockState -> 2)
|
||||||
.noCollission()
|
.noCollission()
|
||||||
.instabreak()
|
.instabreak()
|
||||||
.sound(SoundType.SWEET_BERRY_BUSH)
|
.sound(SoundType.SWEET_BERRY_BUSH)
|
||||||
|
@ -76,7 +76,7 @@ public final class Config {
|
|||||||
bushFireflyAmbientSoundPitch = builder
|
bushFireflyAmbientSoundPitch = builder
|
||||||
.defineInRange("bushFireflyAmbientSoundPitch", 1.0, 0, Double.MAX_VALUE);
|
.defineInRange("bushFireflyAmbientSoundPitch", 1.0, 0, Double.MAX_VALUE);
|
||||||
bushFireflyLightLevel = builder
|
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);
|
.defineInRange("bushFireflyLightLevel", 2, 0, Level.MAX_BRIGHTNESS);
|
||||||
builder.pop();
|
builder.pop();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user