Skip to content

Commit

Permalink
fix: spirit campfire provides light even when off
Browse files Browse the repository at this point in the history
Closes #1040
  • Loading branch information
klikli-dev committed Jan 24, 2024
1 parent dcc0158 commit fbdc276
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.AABB;
Expand All @@ -51,6 +52,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
import java.util.function.ToIntFunction;

public class OccultismBlocks {

Expand Down Expand Up @@ -249,7 +251,8 @@ public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSou
public static final DeferredBlock<Block> SPIRIT_CAMPFIRE = register("spirit_campfire",
() -> new CampfireBlock(false, 2, BlockBehaviour.Properties.of()
.mapColor(MapColor.PODZOL)
.strength(2.0F).sound(SoundType.WOOD).lightLevel((state) -> 10).noOcclusion()));
.strength(2.0F).sound(SoundType.WOOD).lightLevel(
litBlockEmission(10)).noOcclusion()));

public static final DeferredBlock<Block> SPIRIT_TORCH = register("spirit_torch",
() -> new SpiritTorchBlock(
Expand Down Expand Up @@ -285,6 +288,13 @@ public static <I extends Block> DeferredBlock<I> register(final String name, fin
return object;
}

private static ToIntFunction<BlockState> litBlockEmission(int pLightValue) {
return (p_50763_) -> {
return p_50763_.getValue(BlockStateProperties.LIT) ? pLightValue : 0;
};
}


public enum LootTableType {
EMPTY,
DROP_SELF,
Expand Down

0 comments on commit fbdc276

Please sign in to comment.