Skip to content

Commit

Permalink
Distinguished heating/cooling held items properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Forstride committed Dec 31, 2023
1 parent 19798a2 commit ef78ed1
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// 1.20.4 2023-12-25T10:07:37.6385032 Tags for minecraft:item mod id toughasnails
// 1.20.4 2023-12-31T06:07:30.3349516 Tags for minecraft:item mod id toughasnails
f05342856fe99891fa5e94bbe8db82a4f75ac41e data/toughasnails/tags/items/cooling_armor.json
7c304628a9c17ca3ba6cd13e199fcf73ad9c974f data/toughasnails/tags/items/cooling_items.json
7c304628a9c17ca3ba6cd13e199fcf73ad9c974f data/toughasnails/tags/items/cooling_held_items.json
d7e37bc0c1468593bf2403c8bab7e97c17edde8e data/toughasnails/tags/items/drinks.json
eb101cb126ebd917a2c240ff53e1e6e16ba3bf83 data/toughasnails/tags/items/heating_armor.json
efe9e0caf089100a228c46379f3aa70d7f602ddc data/toughasnails/tags/items/heating_items.json
efe9e0caf089100a228c46379f3aa70d7f602ddc data/toughasnails/tags/items/heating_held_items.json
35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/hydration/100_hydration_drinks.json
9c0dc65d9f036f654b10088e08368b1a58a41237 data/toughasnails/tags/items/hydration/10_hydration_drinks.json
80da436d00c60f0926a75bfc6452ef3e03d0e4cf data/toughasnails/tags/items/hydration/20_hydration_drinks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ public static void onTooltip(ItemTooltipEvent event)
Block block = Block.byItem(stack.getItem());
BlockState state = block.defaultBlockState();

if (stack.is(ModTags.Items.HEATING_ITEMS) || stack.is(ModTags.Items.HEATING_ARMOR) || state.is(ModTags.Blocks.HEATING_BLOCKS))
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));
}

if (stack.is(ModTags.Items.COOLING_ITEMS) || stack.is(ModTags.Items.COOLING_ARMOR) || state.is(ModTags.Blocks.COOLING_BLOCKS))
if (state.is(ModTags.Blocks.COOLING_BLOCKS) || stack.is(ModTags.Items.COOLING_ARMOR))
{
event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling")).withStyle(ChatFormatting.AQUA));
}

if (stack.is(ModTags.Items.HEATING_HELD_ITEMS))
{
event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating_held")).withStyle(ChatFormatting.GOLD));
}

if (stack.is(ModTags.Items.COOLING_HELD_ITEMS))
{
event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling_held")).withStyle(ChatFormatting.AQUA));
}
}

public static void onRenderTooltip(RenderTooltipEvent event)
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/toughasnails/init/ModTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ private static void init() {}

public static final TagKey<Item> COOLING_ARMOR = create(new ResourceLocation(TANAPI.MOD_ID, "cooling_armor"));
public static final TagKey<Item> HEATING_ARMOR = create(new ResourceLocation(TANAPI.MOD_ID, "heating_armor"));
public static final TagKey<Item> COOLING_ITEMS = create(new ResourceLocation(TANAPI.MOD_ID, "cooling_items"));
public static final TagKey<Item> HEATING_ITEMS = create(new ResourceLocation(TANAPI.MOD_ID, "heating_items"));
public static final TagKey<Item> COOLING_HELD_ITEMS = create(new ResourceLocation(TANAPI.MOD_ID, "cooling_held_items"));
public static final TagKey<Item> HEATING_HELD_ITEMS = create(new ResourceLocation(TANAPI.MOD_ID, "heating_held_items"));

public static final TagKey<Item> ONE_THIRST_DRINKS = create(new ResourceLocation(TANAPI.MOD_ID, "thirst/1_thirst_drinks"));
public static final TagKey<Item> TWO_THIRST_DRINKS = create(new ResourceLocation(TANAPI.MOD_ID, "thirst/2_thirst_drinks"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ protected static TemperatureLevel handheldModifier(Player player, TemperatureLev
AtomicInteger heatingItems = new AtomicInteger();

player.getHandSlots().forEach((stack -> {
if (stack.is(ModTags.Items.COOLING_ITEMS)) coolingItems.getAndIncrement();
if (stack.is(ModTags.Items.HEATING_ITEMS)) heatingItems.getAndIncrement();
if (stack.is(ModTags.Items.COOLING_HELD_ITEMS)) coolingItems.getAndIncrement();
if (stack.is(ModTags.Items.HEATING_HELD_ITEMS)) heatingItems.getAndIncrement();
}));

return current.increment(heatingItems.get() - coolingItems.get());
Expand Down
4 changes: 4 additions & 0 deletions common/src/main/resources/assets/toughasnails/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"death.attack.toughasnails.hyperthermia.player": "%1$s overheated to death while trying to escape %2$s",
"desc.toughasnails.heating": "Heating",
"desc.toughasnails.cooling": "Cooling",
"desc.toughasnails.heating_held": "Heating (Held)",
"desc.toughasnails.cooling_held": "Cooling (Held)",
"desc.toughasnails.heating_consumed": "Heating (Consumed)",
"desc.toughasnails.cooling_consumed": "Cooling (Consumed)",

"effect.toughasnails.climate_clemency": "Climate Clemency",
"effect.toughasnails.climate_clemency.description": "Neutralizes body temperature for the duration. Only granted temporarily when creating a new world (Or when respawning if enabled in the config).",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ protected void addTags(HolderLookup.Provider provider)
this.tag(ModTags.Items.HEATING_ARMOR).add(TANItems.WOOL_HELMET, TANItems.WOOL_CHESTPLATE, TANItems.WOOL_LEGGINGS, TANItems.WOOL_BOOTS);

// Temperature items
this.tag(ModTags.Items.COOLING_ITEMS).add(Items.POWDER_SNOW_BUCKET);
this.tag(ModTags.Items.HEATING_ITEMS).add(Items.LAVA_BUCKET);
this.tag(ModTags.Items.COOLING_HELD_ITEMS).add(Items.POWDER_SNOW_BUCKET);
this.tag(ModTags.Items.HEATING_HELD_ITEMS).add(Items.LAVA_BUCKET);

// Drinks
this.tag(ModTags.Items.DRINKS).addTags(
Expand Down

0 comments on commit ef78ed1

Please sign in to comment.