Skip to content

Commit 967d827

Browse files
committed
feat: Change is_torch rule to consider all light-emitting block items instead of a hardcoded list of torches #133
1 parent 4c7775d commit 967d827

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

common/src/main/java/net/blay09/mods/clienttweaks/ClientTweaksRules.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import net.blay09.mods.shogi.ShogiValue;
55
import net.blay09.mods.shogi.scope.ShogiScope;
66
import net.minecraft.core.component.DataComponents;
7+
import net.minecraft.world.item.BlockItem;
78
import net.minecraft.world.item.ItemStack;
8-
import net.minecraft.world.item.Items;
99
import net.minecraft.world.level.block.Blocks;
1010
import net.minecraft.world.level.block.state.BlockState;
1111

@@ -15,10 +15,7 @@ public final class ClientTweaksRules {
1515
public static final ShogiScope SCOPE = Shogi.scope(ClientTweaks.id("rules"), scope -> scope.setDefaultNamespaces(List.of("clienttweaks", "shogi")));
1616

1717
public static final ShogiValue<ItemStack, Boolean> isTorch = SCOPE.booleanValue(ClientTweaks.id("is_torch"), itemStack ->
18-
itemStack.is(Items.TORCH)
19-
|| itemStack.is(Items.COPPER_TORCH)
20-
|| itemStack.is(Items.REDSTONE_TORCH)
21-
|| itemStack.is(Items.SOUL_TORCH));
18+
itemStack.getItem() instanceof BlockItem blockItem && blockItem.getBlock().defaultBlockState().getLightEmission() > 0);
2219
public static final ShogiValue<ItemStack, Boolean> isTool = SCOPE.booleanValue(ClientTweaks.id("is_tool"), itemStack ->
2320
itemStack.has(DataComponents.TOOL));
2421
public static final ShogiValue<ItemStack, Boolean> isFood = SCOPE.booleanValue(ClientTweaks.id("is_food"), itemStack ->

0 commit comments

Comments
 (0)