From 3d5488a9883e65269cd7af4bde049ed0da3c883c Mon Sep 17 00:00:00 2001 From: Forstride Date: Wed, 3 Jan 2024 10:04:20 -0500 Subject: [PATCH] Added damage source for dying of thirst, tweaked hydration values for various drinks, reorganized TAN creative tab --- .../103d9f3f36b01595f1aa5172191e60eff02e6924 | 3 +- .../9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 | 14 +++---- .../d5932a16d3f0544ba1e8cda3b77d0d46f353493b | 5 ++- .../tags/damage_type/bypasses_armor.json | 3 +- .../tags/damage_type/bypasses_effects.json | 5 +++ .../data/toughasnails/damage_type/thirst.json | 5 +++ .../items/hydration/100_hydration_drinks.json | 4 +- .../items/hydration/30_hydration_drinks.json | 3 +- .../items/hydration/40_hydration_drinks.json | 4 +- .../items/hydration/50_hydration_drinks.json | 8 +--- .../items/hydration/60_hydration_drinks.json | 1 - .../items/hydration/80_hydration_drinks.json | 8 +++- .../api/damagesource/TANDamageTypes.java | 1 + .../java/toughasnails/api/item/TANItems.java | 41 ++++++++++--------- .../client/handler/TooltipHandler.java | 26 ++++++------ .../main/java/toughasnails/init/ModItems.java | 41 ++++++++++--------- .../toughasnails/thirst/ThirstHandler.java | 3 +- .../java/toughasnails/thirst/ThirstHooks.java | 4 +- .../assets/toughasnails/lang/en_us.json | 2 + .../forge/datagen/ModDamageTypes.java | 1 + .../provider/TANDamageTypeTagsProvider.java | 3 +- .../datagen/provider/TANItemTagsProvider.java | 12 +++--- 22 files changed, 109 insertions(+), 88 deletions(-) create mode 100644 common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_effects.json create mode 100644 common/src/generated/resources/data/toughasnails/damage_type/thirst.json diff --git a/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 b/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 index c9dc301a..48f6f18a 100644 --- a/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 +++ b/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 @@ -1,2 +1,3 @@ -// 1.20.4 2023-12-31T23:39:17.4498631 Registries +// 1.20.4 2024-01-03T09:43:41.1956977 Registries 55b6780cec82f4d4f609e750902d114649d4a8ad data/toughasnails/damage_type/hyperthermia.json +eae6d7bc6de6b808206268351a4eb97746f013bf data/toughasnails/damage_type/thirst.json diff --git a/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 b/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 index 5efb758e..a7ecb231 100644 --- a/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 +++ b/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 @@ -1,4 +1,4 @@ -// 1.20.4 2024-01-02T09:16:41.432941 Tags for minecraft:item mod id toughasnails +// 1.20.4 2024-01-03T09:51:56.6789232 Tags for minecraft:item mod id toughasnails f05342856fe99891fa5e94bbe8db82a4f75ac41e data/toughasnails/tags/items/cooling_armor.json 572f6d0748095755aeef0ca7d602f4ebba9bfd76 data/toughasnails/tags/items/cooling_consumed_items.json 7c304628a9c17ca3ba6cd13e199fcf73ad9c974f data/toughasnails/tags/items/cooling_held_items.json @@ -6,15 +6,15 @@ d7e37bc0c1468593bf2403c8bab7e97c17edde8e data/toughasnails/tags/items/drinks.jso eb101cb126ebd917a2c240ff53e1e6e16ba3bf83 data/toughasnails/tags/items/heating_armor.json cf863878a8af4a7e610b91efb2c1d7846d13868b data/toughasnails/tags/items/heating_consumed_items.json efe9e0caf089100a228c46379f3aa70d7f602ddc data/toughasnails/tags/items/heating_held_items.json -35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/hydration/100_hydration_drinks.json +d7b753d45aecdc84f69d294a00dc5271088c2abc data/toughasnails/tags/items/hydration/100_hydration_drinks.json 67139859406093c4ec7fb2563184a349cd422c65 data/toughasnails/tags/items/hydration/10_hydration_drinks.json afb65ee4d43ae8f9cb63112f16629e0e59db5e3d data/toughasnails/tags/items/hydration/20_hydration_drinks.json -c3717474b5903bcc644087abd9758494594dc09b data/toughasnails/tags/items/hydration/30_hydration_drinks.json -35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/hydration/40_hydration_drinks.json -7fd9471261d08e940601fdecd379217eb90622d1 data/toughasnails/tags/items/hydration/50_hydration_drinks.json -a485e913b63b0237e95ef2af66ed886ba820154a data/toughasnails/tags/items/hydration/60_hydration_drinks.json +edb5947f84984a39ab47c98c6fb0b3c3a9a8cc39 data/toughasnails/tags/items/hydration/30_hydration_drinks.json +ce37a9edf9fd513131ff36c4478e629a45057d38 data/toughasnails/tags/items/hydration/40_hydration_drinks.json +a8d4693f32c2dabe2f0ff10cb6ccae93882c8530 data/toughasnails/tags/items/hydration/50_hydration_drinks.json +4f7422a225cdc6c2f193883f99997942060a44fb data/toughasnails/tags/items/hydration/60_hydration_drinks.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/hydration/70_hydration_drinks.json -d7b753d45aecdc84f69d294a00dc5271088c2abc data/toughasnails/tags/items/hydration/80_hydration_drinks.json +7fd9471261d08e940601fdecd379217eb90622d1 data/toughasnails/tags/items/hydration/80_hydration_drinks.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/hydration/90_hydration_drinks.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/poison_chance/100_poison_chance_drinks.json f87a1c4dc42b16f1628cfca591895d987e5dc6ca data/toughasnails/tags/items/poison_chance/25_poison_chance_drinks.json diff --git a/common/src/generated/resources/.cache/d5932a16d3f0544ba1e8cda3b77d0d46f353493b b/common/src/generated/resources/.cache/d5932a16d3f0544ba1e8cda3b77d0d46f353493b index f39be594..8aa78d83 100644 --- a/common/src/generated/resources/.cache/d5932a16d3f0544ba1e8cda3b77d0d46f353493b +++ b/common/src/generated/resources/.cache/d5932a16d3f0544ba1e8cda3b77d0d46f353493b @@ -1,2 +1,3 @@ -// 1.20.4 2023-12-25T10:07:37.6385032 Tags for minecraft:damage_type mod id toughasnails -38c38aa2296b3985a81eeeb8cfc6a4a99b2f142d data/minecraft/tags/damage_type/bypasses_armor.json +// 1.20.4 2024-01-03T09:43:41.1966981 Tags for minecraft:damage_type mod id toughasnails +114a24c8e8dfc4dca5477ef3ceb9cdce6f35c49d data/minecraft/tags/damage_type/bypasses_armor.json +7bc5233723c7bfc14215cd1f26c7fd14f2da6c81 data/minecraft/tags/damage_type/bypasses_effects.json diff --git a/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_armor.json b/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_armor.json index 024c4d3a..b8c7e916 100644 --- a/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_armor.json +++ b/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_armor.json @@ -1,5 +1,6 @@ { "values": [ - "toughasnails:hyperthermia" + "toughasnails:hyperthermia", + "toughasnails:thirst" ] } \ No newline at end of file diff --git a/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_effects.json b/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_effects.json new file mode 100644 index 00000000..46059ac0 --- /dev/null +++ b/common/src/generated/resources/data/minecraft/tags/damage_type/bypasses_effects.json @@ -0,0 +1,5 @@ +{ + "values": [ + "toughasnails:thirst" + ] +} \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/damage_type/thirst.json b/common/src/generated/resources/data/toughasnails/damage_type/thirst.json new file mode 100644 index 00000000..997a6672 --- /dev/null +++ b/common/src/generated/resources/data/toughasnails/damage_type/thirst.json @@ -0,0 +1,5 @@ +{ + "exhaustion": 0.0, + "message_id": "toughasnails.thirst", + "scaling": "when_caused_by_living_non_player" +} \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/tags/items/hydration/100_hydration_drinks.json b/common/src/generated/resources/data/toughasnails/tags/items/hydration/100_hydration_drinks.json index f72d209d..2d08f049 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/hydration/100_hydration_drinks.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/hydration/100_hydration_drinks.json @@ -1,3 +1,5 @@ { - "values": [] + "values": [ + "toughasnails:cactus_juice" + ] } \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/tags/items/hydration/30_hydration_drinks.json b/common/src/generated/resources/data/toughasnails/tags/items/hydration/30_hydration_drinks.json index 0bac6000..899451cb 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/hydration/30_hydration_drinks.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/hydration/30_hydration_drinks.json @@ -1,6 +1,5 @@ { "values": [ - "minecraft:milk_bucket", - "toughasnails:pumpkin_juice" + "minecraft:milk_bucket" ] } \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/tags/items/hydration/40_hydration_drinks.json b/common/src/generated/resources/data/toughasnails/tags/items/hydration/40_hydration_drinks.json index f72d209d..cba40072 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/hydration/40_hydration_drinks.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/hydration/40_hydration_drinks.json @@ -1,3 +1,5 @@ { - "values": [] + "values": [ + "toughasnails:pumpkin_juice" + ] } \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/tags/items/hydration/50_hydration_drinks.json b/common/src/generated/resources/data/toughasnails/tags/items/hydration/50_hydration_drinks.json index bd8dcd0d..d50fa3a0 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/hydration/50_hydration_drinks.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/hydration/50_hydration_drinks.json @@ -1,11 +1,5 @@ { "values": [ - "toughasnails:purified_water_bottle", - "toughasnails:leather_purified_water_canteen", - "toughasnails:copper_purified_water_canteen", - "toughasnails:iron_purified_water_canteen", - "toughasnails:gold_purified_water_canteen", - "toughasnails:diamond_purified_water_canteen", - "toughasnails:netherite_purified_water_canteen" + "toughasnails:apple_juice" ] } \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/tags/items/hydration/60_hydration_drinks.json b/common/src/generated/resources/data/toughasnails/tags/items/hydration/60_hydration_drinks.json index f29f189b..90ce0550 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/hydration/60_hydration_drinks.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/hydration/60_hydration_drinks.json @@ -1,6 +1,5 @@ { "values": [ - "toughasnails:apple_juice", "toughasnails:melon_juice" ] } \ No newline at end of file diff --git a/common/src/generated/resources/data/toughasnails/tags/items/hydration/80_hydration_drinks.json b/common/src/generated/resources/data/toughasnails/tags/items/hydration/80_hydration_drinks.json index 2d08f049..bd8dcd0d 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/hydration/80_hydration_drinks.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/hydration/80_hydration_drinks.json @@ -1,5 +1,11 @@ { "values": [ - "toughasnails:cactus_juice" + "toughasnails:purified_water_bottle", + "toughasnails:leather_purified_water_canteen", + "toughasnails:copper_purified_water_canteen", + "toughasnails:iron_purified_water_canteen", + "toughasnails:gold_purified_water_canteen", + "toughasnails:diamond_purified_water_canteen", + "toughasnails:netherite_purified_water_canteen" ] } \ No newline at end of file diff --git a/common/src/main/java/toughasnails/api/damagesource/TANDamageTypes.java b/common/src/main/java/toughasnails/api/damagesource/TANDamageTypes.java index 297beec3..04a40414 100644 --- a/common/src/main/java/toughasnails/api/damagesource/TANDamageTypes.java +++ b/common/src/main/java/toughasnails/api/damagesource/TANDamageTypes.java @@ -13,6 +13,7 @@ public class TANDamageTypes { public static final ResourceKey HYPERTHERMIA = register("hyperthermia"); + public static final ResourceKey THIRST = register("thirst"); private static ResourceKey register(String name) { diff --git a/common/src/main/java/toughasnails/api/item/TANItems.java b/common/src/main/java/toughasnails/api/item/TANItems.java index ca516601..7aa58924 100644 --- a/common/src/main/java/toughasnails/api/item/TANItems.java +++ b/common/src/main/java/toughasnails/api/item/TANItems.java @@ -9,6 +9,27 @@ public class TANItems { + // Block Items + public static Item TEMPERATURE_GAUGE; + public static Item RAIN_COLLECTOR; + public static Item WATER_PURIFIER; + + // Items + public static Item THERMOMETER; + + public static Item LEAF_HELMET; + public static Item LEAF_CHESTPLATE; + public static Item LEAF_LEGGINGS; + public static Item LEAF_BOOTS; + + public static Item WOOL_HELMET; + public static Item WOOL_CHESTPLATE; + public static Item WOOL_LEGGINGS; + public static Item WOOL_BOOTS; + + public static Item ICE_CREAM; + public static Item CHARC_0S; + public static Item EMPTY_LEATHER_CANTEEN; public static Item LEATHER_DIRTY_WATER_CANTEEN; public static Item LEATHER_WATER_CANTEEN; @@ -50,25 +71,5 @@ public class TANItems public static Item PUMPKIN_JUICE; public static Item SWEET_BERRY_JUICE; - public static Item ICE_CREAM; - public static Item CHARC_0S; - - public static Item LEAF_HELMET; - public static Item LEAF_CHESTPLATE; - public static Item LEAF_LEGGINGS; - public static Item LEAF_BOOTS; - - public static Item WOOL_HELMET; - public static Item WOOL_CHESTPLATE; - public static Item WOOL_LEGGINGS; - public static Item WOOL_BOOTS; - - public static Item THERMOMETER; - public static Item TAN_ICON; - - // Block items - public static Item TEMPERATURE_GAUGE; - public static Item RAIN_COLLECTOR; - public static Item WATER_PURIFIER; } diff --git a/common/src/main/java/toughasnails/client/handler/TooltipHandler.java b/common/src/main/java/toughasnails/client/handler/TooltipHandler.java index 60085dc2..befd566a 100644 --- a/common/src/main/java/toughasnails/client/handler/TooltipHandler.java +++ b/common/src/main/java/toughasnails/client/handler/TooltipHandler.java @@ -49,46 +49,44 @@ public static void onTooltip(ItemTooltipEvent event) Optional trim = ArmorTrim.getTrim(registryAccess, stack, true); Optional> trimMaterial = TrimMaterials.getFromIngredient(registryAccess, stack); + // Heating/Cooling Blocks and Armor/Trimmed Armor if (state.is(ModTags.Blocks.HEATING_BLOCKS) || stack.is(ModTags.Items.HEATING_ARMOR) || (trim.isPresent() && trim.get().material().is(ModTags.Trims.HEATING_TRIMS))) { event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating")).withStyle(ChatFormatting.GOLD)); } - if (state.is(ModTags.Blocks.COOLING_BLOCKS) || stack.is(ModTags.Items.COOLING_ARMOR) || (trim.isPresent() && trim.get().material().is(ModTags.Trims.COOLING_TRIMS))) { event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling")).withStyle(ChatFormatting.AQUA)); } + // Heating/Cooling Held Items 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)); } - // Display tooltips for items used as materials for trims (the code above is for displaying tooltips on trimmed armor) - if (trimMaterial.isPresent() && trimMaterial.get().is(ModTags.Trims.HEATING_TRIMS)) + // Heating/Cooling Consumables + if (stack.is(ModTags.Items.HEATING_CONSUMED_ITEMS)) { - event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating_trim")).withStyle(ChatFormatting.GOLD)); + event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating_consumed")).withStyle(ChatFormatting.GOLD)); } - - if (trimMaterial.isPresent() && trimMaterial.get().is(ModTags.Trims.COOLING_TRIMS)) + if (stack.is(ModTags.Items.COOLING_CONSUMED_ITEMS)) { - event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling_trim")).withStyle(ChatFormatting.AQUA)); + event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling_consumed")).withStyle(ChatFormatting.AQUA)); } - // Consumable cooling/heating items - if (stack.is(ModTags.Items.HEATING_CONSUMED_ITEMS)) + // Heating/Cooling Trim Material Items + if (trimMaterial.isPresent() && trimMaterial.get().is(ModTags.Trims.HEATING_TRIMS)) { - event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating_consumed")).withStyle(ChatFormatting.GOLD)); + event.getTooltip().add(Component.literal("\uD83D\uDD25 ").append(Component.translatable("desc.toughasnails.heating_trim")).withStyle(ChatFormatting.GOLD)); } - - if (stack.is(ModTags.Items.COOLING_CONSUMED_ITEMS)) + if (trimMaterial.isPresent() && trimMaterial.get().is(ModTags.Trims.COOLING_TRIMS)) { - event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling_consumed")).withStyle(ChatFormatting.AQUA)); + event.getTooltip().add(Component.literal("\u2744 ").append(Component.translatable("desc.toughasnails.cooling_trim")).withStyle(ChatFormatting.AQUA)); } } diff --git a/common/src/main/java/toughasnails/init/ModItems.java b/common/src/main/java/toughasnails/init/ModItems.java index 4aa799a5..e25bad8e 100644 --- a/common/src/main/java/toughasnails/init/ModItems.java +++ b/common/src/main/java/toughasnails/init/ModItems.java @@ -21,6 +21,27 @@ public class ModItems { public static void registerItems(BiConsumer func) { + // Block Items + TANItems.TEMPERATURE_GAUGE = register(func, "temperature_gauge", new BlockItem(TANBlocks.TEMPERATURE_GAUGE, new Item.Properties())); + TANItems.RAIN_COLLECTOR = register(func, "rain_collector", new BlockItem(TANBlocks.RAIN_COLLECTOR, new Item.Properties())); + TANItems.WATER_PURIFIER = register(func, "water_purifier", new BlockItem(TANBlocks.WATER_PURIFIER, new Item.Properties())); + + // Items + TANItems.THERMOMETER = register(func, "thermometer", new Item(new Item.Properties().stacksTo(1))); + + TANItems.LEAF_HELMET = register(func, "leaf_helmet", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.HELMET, (new Item.Properties()))); + TANItems.LEAF_CHESTPLATE = register(func, "leaf_chestplate", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.CHESTPLATE, (new Item.Properties()))); + TANItems.LEAF_LEGGINGS = register(func, "leaf_leggings", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.LEGGINGS, (new Item.Properties()))); + TANItems.LEAF_BOOTS = register(func, "leaf_boots", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.BOOTS, (new Item.Properties()))); + + TANItems.WOOL_HELMET = register(func, "wool_helmet", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.HELMET, (new Item.Properties()))); + TANItems.WOOL_CHESTPLATE = register(func, "wool_chestplate", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.CHESTPLATE, (new Item.Properties()))); + TANItems.WOOL_LEGGINGS = register(func, "wool_leggings", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.LEGGINGS, (new Item.Properties()))); + TANItems.WOOL_BOOTS = register(func, "wool_boots", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.BOOTS, (new Item.Properties()))); + + TANItems.ICE_CREAM = register(func, "ice_cream", new StackableBowlFoodItem(new Item.Properties().stacksTo(16).food(new FoodProperties.Builder().nutrition(0).saturationMod(0.0F).alwaysEat().build()))); + TANItems.CHARC_0S = register(func, "charc_os", new StackableBowlFoodItem(new Item.Properties().stacksTo(16).food(new FoodProperties.Builder().nutrition(0).saturationMod(0.0F).alwaysEat().build()))); + TANItems.EMPTY_LEATHER_CANTEEN = register(func, "empty_leather_canteen", new EmptyLeatherCanteenItem((new Item.Properties()).stacksTo(1))); TANItems.LEATHER_DIRTY_WATER_CANTEEN = register(func, "leather_dirty_water_canteen", new FilledLeatherCanteenItem((new Item.Properties()).durability(5))); TANItems.LEATHER_WATER_CANTEEN = register(func, "leather_water_canteen", new FilledLeatherCanteenItem((new Item.Properties()).durability(5))); @@ -51,7 +72,6 @@ public static void registerItems(BiConsumer func) TANItems.NETHERITE_WATER_CANTEEN = register(func, "netherite_water_canteen", new FilledNetheriteCanteenItem((new Item.Properties()).durability(25))); TANItems.NETHERITE_PURIFIED_WATER_CANTEEN = register(func, "netherite_purified_water_canteen", new FilledNetheriteCanteenItem((new Item.Properties()).durability(25))); - TANItems.DIRTY_WATER_BOTTLE = register(func, "dirty_water_bottle", new DirtyWaterBottleItem((new Item.Properties()).stacksTo(1))); TANItems.PURIFIED_WATER_BOTTLE = register(func, "purified_water_bottle", new PurifiedWaterBottleItem((new Item.Properties()).stacksTo(1))); @@ -63,27 +83,8 @@ public static void registerItems(BiConsumer func) TANItems.PUMPKIN_JUICE = register(func, "pumpkin_juice", new JuiceItem((new Item.Properties()).stacksTo(16))); TANItems.SWEET_BERRY_JUICE = register(func, "sweet_berry_juice", new JuiceItem((new Item.Properties()).stacksTo(16))); - TANItems.ICE_CREAM = register(func, "ice_cream", new StackableBowlFoodItem(new Item.Properties().stacksTo(16).food(new FoodProperties.Builder().nutrition(0).saturationMod(0.0F).alwaysEat().build()))); - TANItems.CHARC_0S = register(func, "charc_os", new StackableBowlFoodItem(new Item.Properties().stacksTo(16).food(new FoodProperties.Builder().nutrition(0).saturationMod(0.0F).alwaysEat().build()))); - - TANItems.LEAF_HELMET = register(func, "leaf_helmet", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.HELMET, (new Item.Properties()))); - TANItems.LEAF_CHESTPLATE = register(func, "leaf_chestplate", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.CHESTPLATE, (new Item.Properties()))); - TANItems.LEAF_LEGGINGS = register(func, "leaf_leggings", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.LEGGINGS, (new Item.Properties()))); - TANItems.LEAF_BOOTS = register(func, "leaf_boots", new LeafArmorItem(ModArmorMaterials.LEAF, ArmorItem.Type.BOOTS, (new Item.Properties()))); - - TANItems.WOOL_HELMET = register(func, "wool_helmet", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.HELMET, (new Item.Properties()))); - TANItems.WOOL_CHESTPLATE = register(func, "wool_chestplate", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.CHESTPLATE, (new Item.Properties()))); - TANItems.WOOL_LEGGINGS = register(func, "wool_leggings", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.LEGGINGS, (new Item.Properties()))); - TANItems.WOOL_BOOTS = register(func, "wool_boots", new DyeableWoolArmorItem(ModArmorMaterials.WOOL, ArmorItem.Type.BOOTS, (new Item.Properties()))); - - TANItems.THERMOMETER = register(func, "thermometer", new Item(new Item.Properties().stacksTo(1))); - TANItems.TAN_ICON = register(func, "tan_icon", new Item(new Item.Properties())); - TANItems.TEMPERATURE_GAUGE = register(func, "temperature_gauge", new BlockItem(TANBlocks.TEMPERATURE_GAUGE, new Item.Properties())); - TANItems.RAIN_COLLECTOR = register(func, "rain_collector", new BlockItem(TANBlocks.RAIN_COLLECTOR, new Item.Properties())); - TANItems.WATER_PURIFIER = register(func, "water_purifier", new BlockItem(TANBlocks.WATER_PURIFIER, new Item.Properties())); - if (Environment.isClient()) { ModClient.registerItemProperties(); diff --git a/common/src/main/java/toughasnails/thirst/ThirstHandler.java b/common/src/main/java/toughasnails/thirst/ThirstHandler.java index 1c7bdd8f..aebed833 100644 --- a/common/src/main/java/toughasnails/thirst/ThirstHandler.java +++ b/common/src/main/java/toughasnails/thirst/ThirstHandler.java @@ -32,6 +32,7 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; +import toughasnails.api.damagesource.TANDamageTypes; import toughasnails.api.item.TANItems; import toughasnails.api.potion.TANEffects; import toughasnails.api.temperature.ITemperature; @@ -81,7 +82,7 @@ else if (difficulty != Difficulty.PEACEFUL) { if (player.getHealth() > 10.0F || difficulty == Difficulty.HARD || player.getHealth() > 1.0F && difficulty == Difficulty.NORMAL) { - player.hurt(player.damageSources().starve(), 1.0F); + player.hurt(player.damageSources().source(TANDamageTypes.THIRST), 1.0F); } thirst.setTickTimer(0); diff --git a/common/src/main/java/toughasnails/thirst/ThirstHooks.java b/common/src/main/java/toughasnails/thirst/ThirstHooks.java index 09ac8ce1..90ae6643 100644 --- a/common/src/main/java/toughasnails/thirst/ThirstHooks.java +++ b/common/src/main/java/toughasnails/thirst/ThirstHooks.java @@ -4,9 +4,9 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodData; import net.minecraft.world.level.GameRules; +import toughasnails.api.damagesource.TANDamageTypes; import toughasnails.api.thirst.IThirst; import toughasnails.api.thirst.ThirstHelper; -import toughasnails.config.ThirstConfig; import toughasnails.init.ModConfig; public class ThirstHooks @@ -82,7 +82,7 @@ else if (data.foodLevel <= 0) { if (player.getHealth() > 10.0F || difficulty == Difficulty.HARD || player.getHealth() > 1.0F && difficulty == Difficulty.NORMAL) { - player.hurt(player.damageSources().starve(), 1.0F); + player.hurt(player.damageSources().source(TANDamageTypes.THIRST), 1.0F); } data.tickTimer = 0; diff --git a/common/src/main/resources/assets/toughasnails/lang/en_us.json b/common/src/main/resources/assets/toughasnails/lang/en_us.json index 7ca163d6..e188c46b 100644 --- a/common/src/main/resources/assets/toughasnails/lang/en_us.json +++ b/common/src/main/resources/assets/toughasnails/lang/en_us.json @@ -5,6 +5,8 @@ "death.attack.toughasnails.hyperthermia": "%1$s overheated to death", "death.attack.toughasnails.hyperthermia.player": "%1$s overheated to death while trying to escape %2$s", + "death.attack.toughasnails.thirst": "%1$s died of thirst", + "death.attack.toughasnails.thirst.player": "%1$s died of thirst while fighting %2$s", "desc.toughasnails.heating": "Heating", "desc.toughasnails.cooling": "Cooling", "desc.toughasnails.heating_held": "Heating (Held)", diff --git a/forge/src/main/java/toughasnails/forge/datagen/ModDamageTypes.java b/forge/src/main/java/toughasnails/forge/datagen/ModDamageTypes.java index a78b62e9..aad19e65 100644 --- a/forge/src/main/java/toughasnails/forge/datagen/ModDamageTypes.java +++ b/forge/src/main/java/toughasnails/forge/datagen/ModDamageTypes.java @@ -13,5 +13,6 @@ public class ModDamageTypes protected static void bootstrap(BootstapContext context) { context.register(TANDamageTypes.HYPERTHERMIA, new DamageType("toughasnails.hyperthermia", 0.1F)); + context.register(TANDamageTypes.THIRST, new DamageType("toughasnails.thirst", 0.0F)); } } diff --git a/forge/src/main/java/toughasnails/forge/datagen/provider/TANDamageTypeTagsProvider.java b/forge/src/main/java/toughasnails/forge/datagen/provider/TANDamageTypeTagsProvider.java index 44d29876..15f27170 100644 --- a/forge/src/main/java/toughasnails/forge/datagen/provider/TANDamageTypeTagsProvider.java +++ b/forge/src/main/java/toughasnails/forge/datagen/provider/TANDamageTypeTagsProvider.java @@ -26,6 +26,7 @@ public TANDamageTypeTagsProvider(PackOutput output, CompletableFuture