Skip to content

Commit

Permalink
Merge branch 'dev-1.20.x' into 1.20.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SihenZhang committed Dec 24, 2024
2 parents b41dca0 + 10605d0 commit 54a0dc8
Show file tree
Hide file tree
Showing 153 changed files with 1,968 additions and 265 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod_name=CrockPot
mod_license=MIT
major_version=1
minor_version=0
patch_version=4
patch_version=5
version_label=release
mod_group_id=com.sihenzhang.crockpot
mod_authors=Si_hen,idyllicbean,SeraphJack,Whyte_V
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/com/sihenzhang/crockpot/base/FoodValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.*;

public class FoodValues {
private static final FoodCategory[] CATEGORIES = FoodCategory.values();
Expand Down Expand Up @@ -137,7 +134,7 @@ public static FoodValues fromJson(JsonElement json) {
final FoodValues foodValues = create();
JsonObject obj = json.getAsJsonObject();
obj.entrySet().forEach(entry -> {
String category = entry.getKey().toUpperCase();
String category = entry.getKey().toUpperCase(Locale.ROOT);
if (!EnumUtils.isValidEnum(FoodCategory.class, category)) {
throw new JsonSyntaxException("Expected the key of food value to be an enum of food category, was unknown name: '" + category + "'");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import java.util.Locale;

@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = CrockPot.MOD_ID)
public class FoodValuesTooltip {
private static final MutableComponent DELIMITER = Component.literal(", ").withStyle(ChatFormatting.WHITE);
Expand All @@ -29,7 +31,7 @@ public static void onTooltip(ItemTooltipEvent event) {
if (!foodValues.isEmpty()) {
var tooltip = foodValues.entrySet().stream()
.map(entry -> I18nUtils.createTooltipComponent("food_values",
Component.translatable("item." + CrockPot.MOD_ID + ".food_category_" + entry.getKey().name().toLowerCase()), entry.getValue()).withStyle(Style.EMPTY.withColor(entry.getKey().color)).withStyle(Style.EMPTY.withColor(entry.getKey().color)))
Component.translatable("item." + CrockPot.MOD_ID + ".food_category_" + entry.getKey().name().toLowerCase(Locale.ROOT)), entry.getValue()).withStyle(Style.EMPTY.withColor(entry.getKey().color)).withStyle(Style.EMPTY.withColor(entry.getKey().color)))
.reduce(null, (acc, foodValuesText) ->
acc == null ? foodValuesText : acc.append(DELIMITER).append(foodValuesText));
event.getToolTip().add(tooltip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ public static void onAnimalAppear(EntityJoinLevelEvent event) {
var hasTemptGoal = false;
var hasEatGoal = false;
for (var wrappedGoal : animal.goalSelector.getAvailableGoals()) {
var goal = wrappedGoal.getGoal();
hasTemptGoal = hasTemptGoal || isTemptGoal(goal);
hasEatGoal = hasEatGoal || isEatGoal(goal);
if (wrappedGoal != null) {
var goal = wrappedGoal.getGoal();
hasTemptGoal = hasTemptGoal || isTemptGoal(goal);
hasEatGoal = hasEatGoal || isEatGoal(goal);
}
}
// Avoid adding duplicate TemptGoal
if (!hasTemptGoal) {
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/com/sihenzhang/crockpot/item/CrockPotItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.function.Supplier;

public final class CrockPotItems {
Expand Down Expand Up @@ -153,7 +150,7 @@ private CrockPotItems() {

public static final Map<FoodCategory, RegistryObject<Item>> FOOD_CATEGORY_ITEMS = Util.make(new EnumMap<>(FoodCategory.class), map -> {
for (FoodCategory category : FoodCategory.values()) {
map.put(category, ITEMS.register("food_category_" + category.name().toLowerCase(), CrockPotBaseItem::new));
map.put(category, ITEMS.register("food_category_" + category.name().toLowerCase(Locale.ROOT), CrockPotBaseItem::new));
}
});
}
3 changes: 2 additions & 1 deletion src/main/java/com/sihenzhang/crockpot/util/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Locale;

public final class JsonUtils {
public static final Gson GSON = new GsonBuilder().create();
Expand Down Expand Up @@ -101,7 +102,7 @@ public static Ingredient getAsIngredient(JsonObject json, String memberName, boo

public static <E extends Enum<E>> E convertToEnum(JsonElement json, String memberName, Class<E> enumClass) {
if (GsonHelper.isStringValue(json)) {
var enumName = GsonHelper.convertToString(json, memberName).toUpperCase();
var enumName = GsonHelper.convertToString(json, memberName).toUpperCase(Locale.ROOT);
if (!EnumUtils.isValidEnum(enumClass, enumName)) {
throw new JsonSyntaxException("Expected " + memberName + " to be an enum of " + enumClass.getName() + ", was unknown name: '" + enumName + "'");
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/crockpot/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
"death.attack.crockpot.monster_food.player": "%1$s was scratched mouth by monster food whilst fighting %2$s",
"death.attack.crockpot.pow_cake": "%1$s was choked by the dense powder of Powdercake",
"death.attack.crockpot.pow_cake.player": "%1$s was choked by the dense powder of Powdercake whilst fighting %2$s",
"death.attack.crocpkpt.spicy": "%1$s''s mouth is on fire",
"death.attack.crocpkpt.spicy.player": "%1$s''s mouth is on fire whilst fighting %2$s",
"death.attack.crockpot.spicy": "%1$s''s mouth is on fire",
"death.attack.crockpot.spicy.player": "%1$s''s mouth is on fire whilst fighting %2$s",
"death.attack.crockpot.taffy": "%1$s was sweet to death by Taffy",
"death.attack.crockpot.taffy.player": "%1$s was sweet to death by Taffy whilst fighting %2$s",
"item.crockpot.food_category_meat": "Meats",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/crockpot/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
"death.attack.crockpot.monster_food.player": "%1$s在与%2$s战斗时被黑暗料理划伤了嘴",
"death.attack.crockpot.pow_cake": "%1$s因粉末蛋糕的致密粉末而被噎死",
"death.attack.crockpot.pow_cake.player": "%1$s在与%2$s战斗时因粉末蛋糕的致密粉末而被噎死",
"death.attack.crocpkpt.spicy": "%1$s被辣得嘴巴冒烟",
"death.attack.crocpkpt.spicy.player": "%1$s在与%2$s战斗时被辣得嘴巴冒烟",
"death.attack.crockpot.spicy": "%1$s被辣得嘴巴冒烟",
"death.attack.crockpot.spicy.player": "%1$s在与%2$s战斗时被辣得嘴巴冒烟",
"death.attack.crockpot.taffy": "%1$s被太妃糖甜死",
"death.attack.crockpot.taffy.player": "%1$s在与%2$s战斗时被太妃糖甜死",
"item.crockpot.food_category_meat": "肉类",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/crockpot/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
"death.attack.crockpot.monster_food.player": "%1$s在與%2$s戰鬥時被黑暗料理劃傷了嘴",
"death.attack.crockpot.pow_cake": "%1$s因粉末蛋糕的緻密粉末而被噎死",
"death.attack.crockpot.pow_cake.player": "%1$s在與%2$s戰鬥時因粉末蛋糕的緻密粉末而被噎死",
"death.attack.crocpkpt.spicy": "%1$s被辣得嘴巴冒煙",
"death.attack.crocpkpt.spicy.player": "%1$s在與%2$s戰鬥時被辣得嘴巴冒煙",
"death.attack.crockpot.spicy": "%1$s被辣得嘴巴冒煙",
"death.attack.crockpot.spicy.player": "%1$s在與%2$s戰鬥時被辣得嘴巴冒煙",
"death.attack.crockpot.taffy": "%1$s被太妃糖甜死",
"death.attack.crockpot.taffy.player": "%1$s在與%2$s戰鬥時被太妃糖甜死",
"item.crockpot.food_category_meat": "肉類",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions src/main/resources/data/create/tags/items/upright_on_belt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"values": [
"crockpot:asparagus_soup",
"crockpot:avaj",
"crockpot:bone_soup",
"crockpot:bone_stew",
"crockpot:breakfast_skillet",
"crockpot:bunny_stew",
"crockpot:flower_salad",
"crockpot:fruit_medley",
"crockpot:jammy_preserves",
"crockpot:gazpacho",
"crockpot:glow_berry_mousse",
"crockpot:honey_nuggets",
"crockpot:hot_chili",
"crockpot:hot_cocoa",
"crockpot:ice_cream",
"crockpot:iced_tea",
"crockpot:mashed_potatoes",
"crockpot:moqueca",
"crockpot:monster_lasagna",
"crockpot:monster_tartare",
"crockpot:moqueca",
"crockpot:mushy_cake",
"crockpot:plain_omelette",
"crockpot:potato_souffle",
"crockpot:powcake",
"crockpot:ratatouille",
"crockpot:salsa",
"crockpot:seafood_gumbo",
"crockpot:syrup",
"crockpot:tea",
"crockpot:tropical_bouillabaisse",
"crockpot:veg_stinger",
"crockpot:volt_goat_jelly"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"items": [
"crockpot:asparagus"
],
"damage": 3,
"reload_ticks": 15,
"knockback": 1.5,
"velocity_multiplier": 1.5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"items": [
"crockpot:cooked_eggplant"
],
"damage": 5,
"reload_ticks": 10,
"knockback": 1.5,
"velocity_multiplier": 1.0,
"sound_pitch": 1.2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"items": [
"crockpot:corn"
],
"damage": 8,
"reload_ticks": 20,
"knockback": 1.5,
"velocity_multiplier": 1.5,
"sound_pitch": 0.8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"items": [
"crockpot:eggplant"
],
"damage": 4,
"reload_ticks": 10,
"knockback": 1.5,
"velocity_multiplier": 1.5,
"sound_pitch": 1.2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"items": [
"crockpot:garlic"
],
"damage": 3,
"reload_ticks": 8,
"knockback": 0.8,
"velocity_multiplier": 2.0,
"sound_pitch": 1.4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"items": [
"crockpot:onion"
],
"damage": 5,
"reload_ticks": 15,
"velocity_multiplier": 1.2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"items": [
"crockpot:pepper"
],
"damage": 3,
"reload_ticks": 8,
"knockback": 0.1,
"split": 2,
"velocity_multiplier": 2.0,
"sound_pitch": 1.4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"items": [
"crockpot:popcorn"
],
"damage": 2,
"reload_ticks": 10,
"knockback": 0.1,
"split": 4,
"drag": 0.95,
"velocity_multiplier": 1.3,
"gravity_multiplier": 0.9,
"sticky": true,
"sound_pitch": 1.4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"items": [
"crockpot:tomato"
],
"damage": 2,
"reload_ticks": 10,
"knockback": 0.8,
"velocity_multiplier": 1.5,
"sound_pitch": 1.2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"items": [
"crockpot:wet_goop"
],
"damage": 1,
"reload_ticks": 10,
"knockback": 0.1,
"velocity_multiplier": 1.2,
"gravity_multiplier": 1.6,
"sticky": true
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"type": "crockpot:food_values",
"items": [
"minecraft:allium",
"minecraft:dandelion"
],
"values": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"minecraft:honey_bottle"
],
"values": {
"SWEETENER": 1
"SWEETENER": 1.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"minecraft:honeycomb"
],
"values": {
"SWEETENER": 0.5
"SWEETENER": 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"minecraft:kelp"
],
"values": {
"VEGGIE": 0.5,
"INEDIBLE": 0.25
"VEGGIE": 0.5
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "crockpot:food_values",
"tags": [
"forge:milk"
"items": [
"minecraft:milk_bucket"
],
"values": {
"DAIRY": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "crockpot:food_values",
"items": [
"minecraft:powder_snow_bucket",
"minecraft:snow_block"
],
"values": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "abnormals_delight"
}
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "abnormals_delight"
}
],
"recipe": {
"type": "crockpot:food_values",
"items": [
"abnormals_delight:perch_slice",
"abnormals_delight:cooked_perch_slice"
],
"recipe": {
"type": "crockpot:food_values",
"items": [
"abnormals_delight:perch_slice",
"abnormals_delight:cooked_perch_slice"
],
"values": {
"FISH": 0.75,
"MEAT": 0.5
}
"values": {
"FISH": 0.75,
"MEAT": 0.5
}
}
]
}
}
]
}
Loading

0 comments on commit 54a0dc8

Please sign in to comment.