Skip to content

Commit

Permalink
Added Ice Cream and Charc-O's, non-nutritional foods that provide tem…
Browse files Browse the repository at this point in the history
…porary cooling/heating when consumed. Increased default length of Internal Warmth/Chill effect.
  • Loading branch information
Forstride committed Jan 2, 2024
1 parent 6dee3d6 commit fa99f3d
Show file tree
Hide file tree
Showing 20 changed files with 223 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// 1.20.4 2024-01-02T07:25:05.8559215 Tags for minecraft:item mod id toughasnails
// 1.20.4 2024-01-02T09:16:41.432941 Tags for minecraft:item mod id toughasnails
f05342856fe99891fa5e94bbe8db82a4f75ac41e data/toughasnails/tags/items/cooling_armor.json
35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/cooling_consumed_items.json
572f6d0748095755aeef0ca7d602f4ebba9bfd76 data/toughasnails/tags/items/cooling_consumed_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
35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/heating_consumed_items.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
67139859406093c4ec7fb2563184a349cd422c65 data/toughasnails/tags/items/hydration/10_hydration_drinks.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.4 2024-01-02T07:25:05.8549215 Recipes
// 1.20.4 2024-01-02T09:16:41.4319405 Recipes
09252bd5a872203de304820e8d5c5493afe96cf4 data/toughasnails/advancements/recipes/combat/leaf_boots.json
2da825265e95f5dfc0dd4026e0dafee70c17512c data/toughasnails/advancements/recipes/combat/leaf_chestplate.json
6d96cd4baff66d426c9405852ceed3aa8a3cde8f data/toughasnails/advancements/recipes/combat/leaf_helmet.json
Expand All @@ -11,8 +11,10 @@ e8c549cdadb494e5854491524dbb6404aeb7f9a9 data/toughasnails/advancements/recipes/
bb4f151b3d411b20ad496cfa2a95fd9aba7c1f78 data/toughasnails/advancements/recipes/decorations/water_purifier.json
5f76369328acf2e24354a8918957059d62c035bc data/toughasnails/advancements/recipes/food/apple_juice.json
a566bf835d6a75c46dd173af19b9dd0f4fe7469c data/toughasnails/advancements/recipes/food/cactus_juice.json
11df03224589ebc8052207a735ac13ff8c0c9192 data/toughasnails/advancements/recipes/food/charc_os.json
51d195d1d579a660e2ed86e98f58f92c12052428 data/toughasnails/advancements/recipes/food/chorus_fruit_juice.json
db0a08a7c6ccc69ca4625db57d678ce644fdfe49 data/toughasnails/advancements/recipes/food/glow_berry_juice.json
ac01c289d4ed4ec056624a23703d850483309a46 data/toughasnails/advancements/recipes/food/ice_cream.json
938ed87afb45ab9596ddcb2435f32472a880e6bd data/toughasnails/advancements/recipes/food/melon_juice.json
1441a8289dbc285c34bf874d6976315fb41001f0 data/toughasnails/advancements/recipes/food/pumpkin_juice.json
1b3828862b65dcfb0a1e6d99070287e896379558 data/toughasnails/advancements/recipes/food/sweet_berry_juice.json
Expand All @@ -29,6 +31,7 @@ eb6859b0a41b94e3003405965dadf8f49b465ce0 data/toughasnails/advancements/recipes/
9ce52988e0ffa4ebd960125423c6dc331a72aadd data/toughasnails/advancements/recipes/tools/thermometer.json
715184d6dfbadc65234a787d2e8271dce076e7b1 data/toughasnails/recipes/apple_juice.json
7aefc36c9cb1e7393660e57c9bfe2f47e9c472b9 data/toughasnails/recipes/cactus_juice.json
f3ec21a6175eeb875a8f8f307dff2ece8532831e data/toughasnails/recipes/charc_os.json
c03137fedf80a5cea96fa69ecc23ddcc733b02bf data/toughasnails/recipes/chorus_fruit_juice.json
621a931c624e91f393ca22939253186876e40873 data/toughasnails/recipes/copper_purified_water_canteen.json
96da20c9eb64283df7947e6272c2286d8b8f2af7 data/toughasnails/recipes/copper_water_canteen.json
Expand All @@ -43,6 +46,7 @@ c2f1aadc3c947308ddb2ffa99ff481d3c2702ee3 data/toughasnails/recipes/empty_iron_ca
af1b982b9d1cc7246035fc73abfd1b34fbb1394d data/toughasnails/recipes/glow_berry_juice.json
20abd8e2a4e8172968eab10fe809720fc0160118 data/toughasnails/recipes/gold_purified_water_canteen.json
a2a23e956fe154b4db870456e6e06b3fb6c0e121 data/toughasnails/recipes/gold_water_canteen.json
f389ed39df339784766c0ce0edd0436a03bb7296 data/toughasnails/recipes/ice_cream.json
11beca7698ade01aa272b18b3314a42e552746b0 data/toughasnails/recipes/iron_purified_water_canteen.json
aa5d7b846a2b506c4d93d2f094834d16d8aeded9 data/toughasnails/recipes/iron_water_canteen.json
6cd4c90a0ccbc67304b76d8fd1890c7559bd3289 data/toughasnails/recipes/leaf_boots.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_charcoal": {
"conditions": {
"items": [
{
"items": [
"minecraft:charcoal"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "toughasnails:charc_os"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_charcoal"
]
],
"rewards": {
"recipes": [
"toughasnails:charc_os"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_snowball": {
"conditions": {
"items": [
{
"items": [
"minecraft:snowball"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "toughasnails:ice_cream"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_snowball"
]
],
"rewards": {
"recipes": [
"toughasnails:ice_cream"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"#": {
"item": "minecraft:charcoal"
},
"B": {
"item": "minecraft:bowl"
},
"S": {
"item": "minecraft:sugar"
}
},
"pattern": [
" # ",
"#S#",
" B "
],
"result": {
"item": "toughasnails:charc_os"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"#": {
"item": "minecraft:snowball"
},
"B": {
"item": "minecraft:bowl"
},
"S": {
"item": "minecraft:sugar"
}
},
"pattern": [
" # ",
"#S#",
" B "
],
"result": {
"item": "toughasnails:ice_cream"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"values": []
"values": [
"toughasnails:ice_cream"
]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"values": []
"values": [
"toughasnails:charc_os"
]
}
11 changes: 7 additions & 4 deletions common/src/main/java/toughasnails/api/item/TANItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ public class TANItems
public static Item PUMPKIN_JUICE;
public static Item SWEET_BERRY_JUICE;

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 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void load()
extremityDamageDelay = addNumber("general.extremity_damage_delay", 500, 0, Integer.MAX_VALUE, "Number of ticks to delay taking damage when icy or hot.");
climateClemencyDuration = addNumber("general.climate_clemency_duration", 6000, 0, Integer.MAX_VALUE, "Number of ticks for the duration of Climate Clemency.");
climateClemencyRespawning = add("general.climate_clemency_respawning", false, "Whether or not Climate Clemency should be granted when respawning.");
consumableEffectDuration = add("general.consumable_effect_duration", 600, "Duration of heating or cooling effects given by consuming items.");
consumableEffectDuration = add("general.consumable_effect_duration", 1200, "Duration of heating or cooling effects given by consuming items.");
temperatureModifierOrder = add("general.temperature_modifier_order", DEFAULT_TEMPERATURE_MODIFIER_ORDER, "The order in which to apply built-in temperature modifiers", TEMPERATURE_MODIFIER_VALIDATOR);

// Altitude options
Expand Down
18 changes: 10 additions & 8 deletions common/src/main/java/toughasnails/init/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.food.Foods;
import net.minecraft.world.item.*;
import org.jetbrains.annotations.Nullable;
import toughasnails.api.TANAPI;
import toughasnails.api.block.TANBlocks;
Expand Down Expand Up @@ -76,16 +75,19 @@ public static void registerItems(BiConsumer<ResourceLocation, Item> 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.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.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()));
Expand Down
6 changes: 3 additions & 3 deletions common/src/main/java/toughasnails/init/ModPotions.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static void registerEffects(BiConsumer<ResourceLocation, MobEffect> func)
{
TANEffects.THIRST = registerEffect(func, "thirst", new ThirstEffect(MobEffectCategory.HARMFUL, 0x76DB4C));
TANEffects.ICE_RESISTANCE = registerEffect(func, "ice_resistance", new MobEffect(MobEffectCategory.BENEFICIAL, 0x77A9FF));
TANEffects.CLIMATE_CLEMENCY = registerEffect(func, "climate_clemency", new MobEffect(MobEffectCategory.NEUTRAL, 0xB6B6B6));
TANEffects.INTERNAL_WARMTH = registerEffect(func, "internal_warmth", new MobEffect(MobEffectCategory.NEUTRAL, 0xFFFAD9));
TANEffects.INTERNAL_CHILL = registerEffect(func, "internal_chill", new MobEffect(MobEffectCategory.NEUTRAL, 0xE1FCFF));
TANEffects.CLIMATE_CLEMENCY = registerEffect(func, "climate_clemency", new MobEffect(MobEffectCategory.BENEFICIAL, 0xB6B6B6));
TANEffects.INTERNAL_WARMTH = registerEffect(func, "internal_warmth", new MobEffect(MobEffectCategory.BENEFICIAL, 0xFFFAD9));
TANEffects.INTERNAL_CHILL = registerEffect(func, "internal_chill", new MobEffect(MobEffectCategory.BENEFICIAL, 0xE1FCFF));
}

public static void registerPotions(BiConsumer<ResourceLocation, Potion> func)
Expand Down
54 changes: 54 additions & 0 deletions common/src/main/java/toughasnails/item/StackableBowlFoodItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright 2021, the Glitchfiend Team.
* All rights reserved.
******************************************************************************/
package toughasnails.item;

import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stats;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;

public class StackableBowlFoodItem extends Item
{
public StackableBowlFoodItem(Properties properties)
{
super(properties);
}

@Override
public ItemStack finishUsingItem(ItemStack stack, Level worldIn, LivingEntity entityLiving)
{
Player player = entityLiving instanceof Player ? (Player)entityLiving : null;

// Do nothing if this isn't a player
if (player == null)
return stack;

if (player instanceof ServerPlayer)
{
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer)player, stack);
}

player.awardStat(Stats.ITEM_USED.get(this));

if (!player.getAbilities().instabuild)
{
stack.shrink(1);

if (stack.isEmpty())
{
return new ItemStack(Items.BOWL);
}

player.getInventory().add(new ItemStack(Items.BOWL));
}

return stack;
}
}
2 changes: 2 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 @@ -32,6 +32,7 @@

"item.toughasnails.apple_juice": "Apple Juice",
"item.toughasnails.cactus_juice": "Cactus Juice",
"item.toughasnails.charc_os": "Charc-O's",
"item.toughasnails.chorus_fruit_juice": "Chorus Fruit Juice",
"item.toughasnails.copper_dirty_water_canteen": "Copper Dirty Water Canteen",
"item.toughasnails.copper_purified_water_canteen": "Copper Purified Water Canteen",
Expand All @@ -50,6 +51,7 @@
"item.toughasnails.gold_dirty_water_canteen": "Gold Dirty Water Canteen",
"item.toughasnails.gold_purified_water_canteen": "Gold Purified Water Canteen",
"item.toughasnails.gold_water_canteen": "Gold Water Canteen",
"item.toughasnails.ice_cream": "Ice Cream",
"item.toughasnails.iron_dirty_water_canteen": "Iron Dirty Water Canteen",
"item.toughasnails.iron_purified_water_canteen": "Iron Purified Water Canteen",
"item.toughasnails.iron_water_canteen": "Iron Water Canteen",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "toughasnails:item/charc_os"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "toughasnails:item/ice_cream"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ protected void addTags(HolderLookup.Provider provider)
// Temperature items
this.tag(ModTags.Items.COOLING_HELD_ITEMS).add(Items.POWDER_SNOW_BUCKET);
this.tag(ModTags.Items.HEATING_HELD_ITEMS).add(Items.LAVA_BUCKET);
this.tag(ModTags.Items.COOLING_CONSUMED_ITEMS);
this.tag(ModTags.Items.HEATING_CONSUMED_ITEMS);
this.tag(ModTags.Items.COOLING_CONSUMED_ITEMS).add(TANItems.ICE_CREAM);
this.tag(ModTags.Items.HEATING_CONSUMED_ITEMS).add(TANItems.CHARC_0S);

// Drinks
this.tag(ModTags.Items.DRINKS).addTags(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ protected void buildRecipes(RecipeOutput output)
ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, TANItems.PUMPKIN_JUICE).requires(TANItems.PURIFIED_WATER_BOTTLE).requires(Items.SUGAR).requires(Items.PUMPKIN).group("juice").unlockedBy("has_pumpkin", has(Items.PUMPKIN)).save(output);
ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, TANItems.SWEET_BERRY_JUICE).requires(TANItems.PURIFIED_WATER_BOTTLE).requires(Items.SUGAR).requires(Items.SWEET_BERRIES).group("juice").unlockedBy("has_sweet_berries", has(Items.SWEET_BERRIES)).save(output);

// Foods
ShapedRecipeBuilder.shaped(RecipeCategory.FOOD, TANItems.ICE_CREAM).define('#', Items.SNOWBALL).define('S', Items.SUGAR).define('B', Items.BOWL).pattern(" # ").pattern("#S#").pattern(" B ").unlockedBy("has_snowball", has(Items.SNOWBALL)).save(output);
ShapedRecipeBuilder.shaped(RecipeCategory.FOOD, TANItems.CHARC_0S).define('#', Items.CHARCOAL).define('S', Items.SUGAR).define('B', Items.BOWL).pattern(" # ").pattern("#S#").pattern(" B ").unlockedBy("has_charcoal", has(Items.CHARCOAL)).save(output);

// Blocks
ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, TANBlocks.TEMPERATURE_GAUGE).define('G', Items.GLASS).define('Q', Items.QUARTZ).define('T', TANItems.THERMOMETER).define('B', Items.BRICK_SLAB).pattern("GGG").pattern("QTQ").pattern("BBB").unlockedBy("has_thermometer", has(TANItems.THERMOMETER)).save(output);
ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, TANBlocks.RAIN_COLLECTOR).define('S', Items.STRING).define('I', Items.IRON_INGOT).define('B', Items.BARREL).pattern("ISI").pattern("IBI").unlockedBy("has_barrel", has(Items.BARREL)).save(output);
Expand Down

0 comments on commit fa99f3d

Please sign in to comment.