Skip to content

Commit

Permalink
Disable thirst/temperature tooltips if their respective features are …
Browse files Browse the repository at this point in the history
…disabled
  • Loading branch information
Adubbz committed Dec 31, 2023
1 parent 2dfc56f commit 193a6fd
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import toughasnails.core.ToughAsNails;
import toughasnails.init.ModConfig;
import toughasnails.init.ModTags;
import toughasnails.thirst.ThirstOverlayRenderer;

Expand All @@ -27,6 +28,10 @@ public static void onTooltip(ItemTooltipEvent event)
Block block = Block.byItem(stack.getItem());
BlockState state = block.defaultBlockState();

// Don't display heating or cooling tooltips if temperature is disabled
if (!ModConfig.temperature.enableTemperature)
return;

if (state.is(ModTags.Blocks.HEATING_BLOCKS) || stack.is(ModTags.Items.HEATING_ARMOR))
{
event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating")).withStyle(ChatFormatting.GOLD));
Expand All @@ -52,6 +57,10 @@ public static void onRenderTooltip(RenderTooltipEvent event)
{
ItemStack stack = event.getStack();

// Don't display thirst tooltips if thirst is disabled
if (!ModConfig.thirst.enableThirst)
return;

if (stack.is(ModTags.Items.DRINKS))
{
event.getComponents().add(new ThirstClientTooltipComponent(ModTags.Items.getThirstRestored(stack)));
Expand Down

0 comments on commit 193a6fd

Please sign in to comment.