diff --git a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 index 75da488..84b223c 100644 --- a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 +++ b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 @@ -1,2 +1,2 @@ -// 1.21 2024-08-22T18:03:26.4900985 Languages: zh_cn for mod: lingshi -2012858b997388159ffda305994f25429de3d030 assets/lingshi/lang/zh_cn.json +// 1.21 2024-08-27T05:38:33.2066749 Languages: zh_cn for mod: lingshi +c4e31085268a58b4bdb72f5cc12a36fecd42c0d3 assets/lingshi/lang/zh_cn.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 8e4ed31..87417f4 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,7 @@ -// 1.21 2024-08-27T02:55:56.0325835 Recipes +// 1.21 2024-08-27T06:08:36.0532515 Recipes +b8cb7428b718c0ca190af49165cd25554d27fa19 data/lingshi/advancement/recipes/cooking_pot/cooked_rice.json +7d0ef4cd02c38f4648e712a935f0ea32fb50aeff data/lingshi/advancement/recipes/cooking_pot/cooked_rice_1.json +d918a2369d899974ffa38d6a363553af9e97fdee data/lingshi/advancement/recipes/cooking_pot/cooked_rice_2.json 6a319c97da924f9ab21b5d264c18cb8ad9da8755 data/lingshi/advancement/recipes/decorations/chopping_board.json 0a4b54bfda8aa98f1a26bbf1d8231c76ed12e770 data/lingshi/advancement/recipes/decorations/skillet.json e4ccb4f32d90b93ef63a3f2a17e843c6a8b2322b data/lingshi/advancement/recipes/skillet/baked_potato.json @@ -14,15 +17,18 @@ ee50d7e3c59e644ce93e46945ff090c3c68fda04 data/lingshi/advancement/recipes/skille e511f76246f906a279fc1ec531922d8f70dfb68c data/lingshi/advancement/recipes/tools/spatula.json bec1047337843fdd073fe87393c3b500ae11a1de data/lingshi/recipe/chopping_board.json 3e41620c4ec5b19f87046dad7fe5c7ed6ede21c2 data/lingshi/recipe/chopping_board/rice.json +34ff78a571b7d344a2b31e18de2771cc505ab562 data/lingshi/recipe/cooking_pot/cooked_rice.json +5b0d88672d868c5aff2928bd701f603643ac0dc0 data/lingshi/recipe/cooking_pot/cooked_rice_1.json +e96b40d81c45dec0c25d57ddc8c8938c7196ec94 data/lingshi/recipe/cooking_pot/cooked_rice_2.json e6daac4cca245fc9e220e2fcb1f2b27e410ba503 data/lingshi/recipe/iron_knife.json a0c7fd85028ea7997689d7bc093b9d025c522ea6 data/lingshi/recipe/skillet.json -26590681b1777b3be492a971dfc95a36af346fee data/lingshi/recipe/skillet/baked_potato.json -91bf1f4b8acf5c536598059691981e665838ea17 data/lingshi/recipe/skillet/cooked_beef.json -27b62cedc03d158bf611f528d405dd7cfe39b429 data/lingshi/recipe/skillet/cooked_chicken.json -88368af861afa365e968533c265c89b65019b049 data/lingshi/recipe/skillet/cooked_cod.json -93fa44daf3296aff85255b2e05a89fda9fbdc69f data/lingshi/recipe/skillet/cooked_mutton.json -920d7c639da2cb840174d1a9c932349a0d85dee5 data/lingshi/recipe/skillet/cooked_porkchop.json -5565fa5a338b2fefe8369d4cec4e28dd7c3481c3 data/lingshi/recipe/skillet/cooked_rabbit.json -524f6c88e228427667c5201e43752957f7bbd649 data/lingshi/recipe/skillet/cooked_salmon.json -1c104eed6daaa90da2777ec06f29089caf0446d3 data/lingshi/recipe/skillet/fried_egg.json +e2328874e467cf5efdb65d0fedeac1cfe1677e98 data/lingshi/recipe/skillet/baked_potato.json +f028991439854ef986d28feab97a637b53df876a data/lingshi/recipe/skillet/cooked_beef.json +a7eb02ae67924077e8066c8cc2c5a05e02b5bb44 data/lingshi/recipe/skillet/cooked_chicken.json +09adfb28e337e8cc2333380dbfc8abaef2033c06 data/lingshi/recipe/skillet/cooked_cod.json +918165a19dfbbde26ca0397c107b3328fe0d6933 data/lingshi/recipe/skillet/cooked_mutton.json +c3cfbc2afc0b4cec90a57fdac12ec3bc7b462b4f data/lingshi/recipe/skillet/cooked_porkchop.json +c60918f7fafeb03f1c8244417c151ea7a5e44a31 data/lingshi/recipe/skillet/cooked_rabbit.json +e72067c16cd3f5e2ec6a11abb0c7a9e41d3e3fd4 data/lingshi/recipe/skillet/cooked_salmon.json +0c39fdabe7970065856b4adc9e9f3eae7690ea2d data/lingshi/recipe/skillet/fried_egg.json 3563171190654e76637de2fa78a6c750389674d7 data/lingshi/recipe/spatula.json diff --git a/src/generated/resources/assets/lingshi/lang/zh_cn.json b/src/generated/resources/assets/lingshi/lang/zh_cn.json index d451ef1..6a111b6 100644 --- a/src/generated/resources/assets/lingshi/lang/zh_cn.json +++ b/src/generated/resources/assets/lingshi/lang/zh_cn.json @@ -7,6 +7,7 @@ "block.lingshi.tea_tree": "茶树", "gui.lingshi.cooking_pot_menu": "烹饪锅", "gui.lingshi.skillet_menu": "平底锅", + "item.lingshi.cooked_rice": "米饭", "item.lingshi.fried_egg": "煎鸡蛋", "item.lingshi.iron_knife": "铁菜刀", "item.lingshi.oil_bucket": "油桶", diff --git a/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice.json b/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice.json new file mode 100644 index 0000000..002df27 --- /dev/null +++ b/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_rice": { + "conditions": { + "items": [ + { + "items": "lingshi:rice" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "lingshi:cooking_pot/cooked_rice" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_rice" + ] + ], + "rewards": { + "recipes": [ + "lingshi:cooking_pot/cooked_rice" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice_1.json b/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice_1.json new file mode 100644 index 0000000..c4e0b7c --- /dev/null +++ b/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice_1.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_rice": { + "conditions": { + "items": [ + { + "items": "lingshi:rice" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "lingshi:cooking_pot/cooked_rice_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_rice" + ] + ], + "rewards": { + "recipes": [ + "lingshi:cooking_pot/cooked_rice_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice_2.json b/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice_2.json new file mode 100644 index 0000000..527a189 --- /dev/null +++ b/src/generated/resources/data/lingshi/advancement/recipes/cooking_pot/cooked_rice_2.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_rice": { + "conditions": { + "items": [ + { + "items": "lingshi:rice" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "lingshi:cooking_pot/cooked_rice_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_rice" + ] + ], + "rewards": { + "recipes": [ + "lingshi:cooking_pot/cooked_rice_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice.json b/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice.json new file mode 100644 index 0000000..cd5b65e --- /dev/null +++ b/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice.json @@ -0,0 +1,34 @@ +{ + "type": "lingshi:cooking_pot", + "container": { + "braising_time": 0, + "container": { + "count": 1, + "id": "minecraft:bowl" + } + }, + "fluid": { + "amount": 1000, + "id": "minecraft:water" + }, + "group": "", + "ingredients": [ + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + } + ], + "label": "boil", + "result": { + "count": 8, + "id": "lingshi:cooked_rice" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice_1.json b/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice_1.json new file mode 100644 index 0000000..344440a --- /dev/null +++ b/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice_1.json @@ -0,0 +1,37 @@ +{ + "type": "lingshi:cooking_pot", + "container": { + "braising_time": 0, + "container": { + "count": 1, + "id": "minecraft:bowl" + } + }, + "fluid": { + "amount": 1000, + "id": "minecraft:water" + }, + "group": "", + "ingredients": [ + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + } + ], + "label": "boil", + "result": { + "count": 10, + "id": "lingshi:cooked_rice" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice_2.json b/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice_2.json new file mode 100644 index 0000000..9ffca18 --- /dev/null +++ b/src/generated/resources/data/lingshi/recipe/cooking_pot/cooked_rice_2.json @@ -0,0 +1,40 @@ +{ + "type": "lingshi:cooking_pot", + "container": { + "braising_time": 0, + "container": { + "count": 1, + "id": "minecraft:bowl" + } + }, + "fluid": { + "amount": 1000, + "id": "minecraft:water" + }, + "group": "", + "ingredients": [ + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + }, + { + "item": "lingshi:rice" + } + ], + "label": "boil", + "result": { + "count": 12, + "id": "lingshi:cooked_rice" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/recipe/skillet/baked_potato.json b/src/generated/resources/data/lingshi/recipe/skillet/baked_potato.json index 85833f7..e8549a5 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/baked_potato.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/baked_potato.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:potato" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_beef.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_beef.json index c6e79d7..fbfecb6 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_beef.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_beef.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:beef" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_chicken.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_chicken.json index 2f0f86c..93ad2c2 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_chicken.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_chicken.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:chicken" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_cod.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_cod.json index 2833a32..0b72bca 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_cod.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_cod.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:cod" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_mutton.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_mutton.json index 0fa2619..65b0feb 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_mutton.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_mutton.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:mutton" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_porkchop.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_porkchop.json index feaa669..073a968 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_porkchop.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_porkchop.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:porkchop" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_rabbit.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_rabbit.json index 7d156f2..6706bbe 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_rabbit.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_rabbit.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:rabbit" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/cooked_salmon.json b/src/generated/resources/data/lingshi/recipe/skillet/cooked_salmon.json index 9142b33..766a8be 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/cooked_salmon.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/cooked_salmon.json @@ -1,6 +1,6 @@ { "type": "lingshi:skillet", - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:salmon" diff --git a/src/generated/resources/data/lingshi/recipe/skillet/fried_egg.json b/src/generated/resources/data/lingshi/recipe/skillet/fried_egg.json index dd6a87d..703df1e 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet/fried_egg.json +++ b/src/generated/resources/data/lingshi/recipe/skillet/fried_egg.json @@ -4,7 +4,7 @@ "amount": 100, "id": "lingshi:oil_source" }, - "group": "Skillet", + "group": "", "ingredients": [ { "item": "minecraft:egg" diff --git a/src/main/java/mczme/lingshi/client/BlockEntityRenderer/CookingPotBER.java b/src/main/java/mczme/lingshi/client/BlockEntityRenderer/CookingPotBER.java index ca5f3c4..01dab56 100644 --- a/src/main/java/mczme/lingshi/client/BlockEntityRenderer/CookingPotBER.java +++ b/src/main/java/mczme/lingshi/client/BlockEntityRenderer/CookingPotBER.java @@ -2,13 +2,11 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; -import mczme.lingshi.common.block.ChoppingBoardBlock; import mczme.lingshi.common.block.entity.CookingPotBlockEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; -import net.minecraft.core.Direction; import net.minecraft.world.item.ItemDisplayContext; import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.items.ItemStackHandler; @@ -27,7 +25,6 @@ public void render(CookingPotBlockEntity pBlockEntity, float pPartialTick, PoseS if(!pBlockEntity.getBlockState().getValue(COVER)){ ItemStackHandler itemStack = pBlockEntity.getItemStacks(); FluidStack fluidStack = pBlockEntity.getFluid(); - Direction direction = pBlockEntity.getBlockState().getValue(ChoppingBoardBlock.FACING); if (!pBlockEntity.isEmpty()) { if (!fluidStack.isEmpty()) { @@ -37,8 +34,8 @@ public void render(CookingPotBlockEntity pBlockEntity, float pPartialTick, PoseS for (int i = 0; i < pBlockEntity.getMAX(); i++) { if (itemStack.getStackInSlot(i).isEmpty()) continue; pPoseStack.pushPose(); - pPoseStack.translate(0.5, 0.2 + i / 16.0, 0.5); - pPoseStack.mulPose(Axis.YP.rotationDegrees(-direction.toYRot())); + pPoseStack.translate(1.5*i/16F+0.25, 0.3, 0.5); + pPoseStack.mulPose(Axis.YP.rotationDegrees(90)); pPoseStack.scale(0.5F, 0.5F, 0.5F); Minecraft.getInstance().getItemRenderer().renderStatic(itemStack.getStackInSlot(i), ItemDisplayContext.FIXED, pPackedLight, pPackedOverlay, pPoseStack, pBufferSource, pBlockEntity.getLevel(), (int) pBlockEntity.getBlockPos().asLong()); pPoseStack.popPose(); diff --git a/src/main/java/mczme/lingshi/client/event/Registry.java b/src/main/java/mczme/lingshi/client/event/Registry.java index 7807044..5bb43a8 100644 --- a/src/main/java/mczme/lingshi/client/event/Registry.java +++ b/src/main/java/mczme/lingshi/client/event/Registry.java @@ -79,7 +79,7 @@ public static void registerRecipeBook(RegisterRecipeBookCategoriesEvent event) { }); // Cooking Pot event.registerBookCategories(COOKING_POT, ImmutableList.of(COOKING_POT_SEARCH.get(), COOKING_POT_POT_BOIL.get(), COOKING_POT_STEW.get(), COOKING_POT_DEEP_FRY.get(), COOKING_POT_MISC.get())); - event.registerAggregateCategory(SKILLET_SEARCH.get(), ImmutableList.of(COOKING_POT_POT_BOIL.get(), COOKING_POT_STEW.get(), COOKING_POT_DEEP_FRY.get(), COOKING_POT_MISC.get())); + event.registerAggregateCategory(COOKING_POT_SEARCH.get(), ImmutableList.of(COOKING_POT_POT_BOIL.get(), COOKING_POT_STEW.get(), COOKING_POT_DEEP_FRY.get(), COOKING_POT_MISC.get())); event.registerRecipeCategoryFinder(ModRecipes.COOKING_POT_RECIPE.get(), recipe -> { if (recipe.value() instanceof SkilletRecipe Recipe) { diff --git a/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java b/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java index 896254e..a440c95 100644 --- a/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java +++ b/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java @@ -49,9 +49,7 @@ private void addWorkSlot(ItemStackHandler itemStacks) { slot.set(itemStacks.getStackInSlot(i)); this.addSlot(slot); } - itemStackHandler.setStackInSlot(6,blockEntity.container); this.addSlot(new ResultSlot(itemStackHandler, 6, X[6], Y[6])); - itemStackHandler.setStackInSlot(7,blockEntity.result); this.addSlot(new ResultSlot(itemStackHandler, 7, X[7], Y[7])); } diff --git a/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java b/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java index 35c0852..4e3bea6 100644 --- a/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java +++ b/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java @@ -48,9 +48,7 @@ private void addWorkSlot(ItemStackHandler itemStacks) { slot.set(itemStacks.getStackInSlot(i)); this.addSlot(slot); } - itemStackHandler.setStackInSlot(5,blockEntity.container); this.addSlot(new ResultSlot(itemStackHandler, 5, X[5], Y[5])); - itemStackHandler.setStackInSlot(6,blockEntity.result); this.addSlot(new ResultSlot(itemStackHandler, 6, X[6], Y[6])); } diff --git a/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java b/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java index 3aa077a..ccc48ed 100644 --- a/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java +++ b/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java @@ -1,6 +1,6 @@ package mczme.lingshi.client.recipebook; -import mczme.lingshi.common.recipe.SkilletRecipe; +import mczme.lingshi.common.recipe.CookingPotRecipe; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; import net.minecraft.core.NonNullList; import net.minecraft.world.inventory.Slot; @@ -14,12 +14,12 @@ public class CookingPotRecipeBookComponent extends RecipeBookComponent { @Override public void setupGhostRecipe(RecipeHolder pRecipe, List pSlots) { - SkilletRecipe skilletRecipe = (SkilletRecipe) pRecipe.value(); + CookingPotRecipe Recipe = (CookingPotRecipe) pRecipe.value(); ItemStack resultitem = pRecipe.value().getResultItem(this.minecraft.level.registryAccess()); this.ghostRecipe.setRecipe(pRecipe); - this.ghostRecipe.addIngredient(Ingredient.of(resultitem), pSlots.get(6).x, pSlots.get(6).y); - if(skilletRecipe.getContainer().container() != ItemStack.EMPTY){ - this.ghostRecipe.addIngredient(Ingredient.of(skilletRecipe.getContainer().container()), pSlots.get(5).x, pSlots.get(5).y); + this.ghostRecipe.addIngredient(Ingredient.of(resultitem), pSlots.get(7).x, pSlots.get(7).y); + if(Recipe.getContainer().container() != ItemStack.EMPTY){ + this.ghostRecipe.addIngredient(Ingredient.of(Recipe.getContainer().container()), pSlots.get(6).x, pSlots.get(6).y); } NonNullList nonnulllist = pRecipe.value().getIngredients(); diff --git a/src/main/java/mczme/lingshi/client/screen/CookingHud.java b/src/main/java/mczme/lingshi/client/screen/CookingHud.java index 3ba1b49..4395390 100644 --- a/src/main/java/mczme/lingshi/client/screen/CookingHud.java +++ b/src/main/java/mczme/lingshi/client/screen/CookingHud.java @@ -79,10 +79,15 @@ public void render(@NotNull GuiGraphics pGuiGraphics, @NotNull DeltaTracker pDel } else if (player != null && getHitResult(BlockEntityTypes.COOKING_POT_BLOCKENTITY.get())) { getData((CookingPotBlockEntity)Minecraft.getInstance().level.getBlockEntity(blockPos)); int j = 0; - if (!result.isEmpty()) { - pGuiGraphics.renderItem(result, X - 18, Y); -// pGuiGraphics.blit(HUD_Sprite, X, Y , 16, 16, 0, 36,16,16, 64, 64); - pGuiGraphics.drawCenteredString(Minecraft.getInstance().font, String.valueOf(Count), X + 24, Y + 6, 0xffffff); + if (!result.isEmpty()||!itemStackHandler.getStackInSlot(7).isEmpty()) { + if(!result.isEmpty()){ + pGuiGraphics.renderItem(result, X - 18, Y); + } else if (!itemStackHandler.getStackInSlot(7).isEmpty()) { + pGuiGraphics.renderItem(itemStackHandler.getStackInSlot(7), X - 18, Y); + } + pGuiGraphics.drawCenteredString(Minecraft.getInstance().font, String.valueOf(itemStackHandler.getStackInSlot(7).getCount()), X + 24, Y + 6, 0xffffff); + pGuiGraphics.blit(HUD_Sprite, X, Y , 16, 16, 0, 36,16,16, 64, 64); + pGuiGraphics.drawCenteredString(Minecraft.getInstance().font, String.valueOf(itemStackHandler.getStackInSlot(7).getCount()), X + 24, Y + 6, 0xffffff); if (!container.isEmpty()) { pGuiGraphics.renderItem(container, X + 36, Y); } @@ -114,7 +119,7 @@ private void getData(T blockEntity) { this.cookingTime = blockEntity.getCookingTime(); this.MAX_SLOT = blockEntity.getMAX(); this.result = blockEntity.getResult(); - this.container = blockEntity.getContainer(); + this.container = itemStackHandler.getStackInSlot(MAX_SLOT); if(blockEntity instanceof SkilletBlockEntity blockEntity1){ this.Count = blockEntity1.stirFryCount; }else if (blockEntity instanceof CookingPotBlockEntity blockEntity1){ @@ -143,7 +148,7 @@ private void drawItemProgress(GuiGraphics pGuiGraphics, CookingFoodData cookingF private void drawFluidProgress(GuiGraphics pGuiGraphics, CookingFoodData cookingFoodData, int j) { int pHeight = 8; - int progress = Math.min(cookingTime[5], 580); + int progress = Math.min(cookingTime[MAX_SLOT], 580); ItemStack bucket = ModFluids.MOD_FLUID_TYPE.get().getBucket(fluidStack); if (!bucket.isEmpty()) { pGuiGraphics.renderItem(bucket, X - 18, Y + j * 18); diff --git a/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java b/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java index cf5abb8..4e57f35 100644 --- a/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java +++ b/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java @@ -51,22 +51,22 @@ public CookingPotBlock(Properties pProperties) { public ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHitResult) { if (pLevel.getBlockEntity(pPos) instanceof CookingPotBlockEntity blockEntity) { - if (!blockEntity.container.isEmpty() && pStack.is(blockEntity.container.getItem())) { - if (pPlayer.addItem(blockEntity.result)) { + if (!blockEntity.getItemStacks().getStackInSlot(6).isEmpty() && pStack.is(blockEntity.getItemStacks().getStackInSlot(6).getItem())) { + if(pPlayer.addItem(new ItemStack(blockEntity.getItemStacks().getStackInSlot(7).getItem(),1))){ + blockEntity.getItemStacks().getStackInSlot(7).shrink(1); pStack.consume(1, pPlayer); - blockEntity.clear(); blockEntity.setChanged(); return ItemInteractionResult.SUCCESS; } } else if (!blockEntity.isFull() && !pStack.isEmpty() && !pStack.is(ModItems.POT_LID.get()) && !pState.getValue(COVER)) { if (pStack.is(Items.WATER_BUCKET)) { blockEntity.setFluid(new FluidStack(Fluids.WATER, 1000)); - blockEntity.getCookingTime()[5] = 0; + blockEntity.getCookingTime()[6] = 0; blockEntity.setChanged(); return ItemInteractionResult.SUCCESS; } else if (pStack.is(ModItems.OIL_BUCKET.get())) { blockEntity.setFluid(new FluidStack(ModFluids.OIL_SOURCE.get(), 1000)); - blockEntity.getCookingTime()[5] = 0; + blockEntity.getCookingTime()[6] = 0; blockEntity.setChanged(); return ItemInteractionResult.SUCCESS; } @@ -104,6 +104,16 @@ protected InteractionResult useWithoutItem(BlockState pState, Level pLevel, Bloc return InteractionResult.PASS; } + @Override + protected void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pMovedByPiston) { + if (pLevel.getBlockEntity(pPos) instanceof CookingPotBlockEntity blockEntity) { + for (int i = 0; i < blockEntity.getMAX(); i++) { + Containers.dropItemStack(pLevel, pPos.getX(), pPos.getY(), pPos.getZ(), blockEntity.dropItem()); + } + } + super.onRemove(pState, pLevel, pPos, pNewState, pMovedByPiston); + } + @Override protected MapCodec codec() { return null; diff --git a/src/main/java/mczme/lingshi/common/block/SkilletBlock.java b/src/main/java/mczme/lingshi/common/block/SkilletBlock.java index 5bca7a8..a77d6ed 100644 --- a/src/main/java/mczme/lingshi/common/block/SkilletBlock.java +++ b/src/main/java/mczme/lingshi/common/block/SkilletBlock.java @@ -59,7 +59,7 @@ protected MapCodec codec() { public ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHitResult) { if (pLevel.getBlockEntity(pPos) instanceof SkilletBlockEntity blockEntity) { - if (!blockEntity.container.isEmpty() && pStack.is(blockEntity.container.getItem())) { + if (!blockEntity.getItemStacks().getStackInSlot(5).isEmpty() && pStack.is(blockEntity.getItemStacks().getStackInSlot(5).getItem())) { if (pPlayer.addItem(blockEntity.result)) { pStack.consume(1, pPlayer); blockEntity.clear(); @@ -113,6 +113,16 @@ protected InteractionResult useWithoutItem(BlockState pState, Level pLevel, Bloc return InteractionResult.sidedSuccess(pLevel.isClientSide); } + @Override + protected void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pMovedByPiston) { + if (pLevel.getBlockEntity(pPos) instanceof SkilletBlockEntity blockEntity) { + for (int i = 0; i < blockEntity.getMAX(); i++) { + Containers.dropItemStack(pLevel, pPos.getX(), pPos.getY(), pPos.getZ(), blockEntity.dropItem()); + } + } + super.onRemove(pState, pLevel, pPos, pNewState, pMovedByPiston); + } + @Nullable @Override public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { diff --git a/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java b/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java index fae135f..c95f6f1 100644 --- a/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java +++ b/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java @@ -5,10 +5,9 @@ import mczme.lingshi.common.block.entity.baseblockentity.ICanBeHeated; import mczme.lingshi.common.datamap.DataMapTypes; import mczme.lingshi.common.datamap.ingredient.CookingFoodData; -import mczme.lingshi.common.recipe.SkilletRecipe; +import mczme.lingshi.common.recipe.CookingPotRecipe; import mczme.lingshi.common.recipe.input.CookingFoodRecipeInput; import mczme.lingshi.common.registry.BlockEntityTypes; -import mczme.lingshi.common.registry.ModItems; import mczme.lingshi.common.registry.ModRecipes; import mczme.lingshi.lingshi; import net.minecraft.core.BlockPos; @@ -37,6 +36,8 @@ import java.util.Arrays; import java.util.Optional; +import static mczme.lingshi.common.block.CookingPotBlock.COVER; + public class CookingPotBlockEntity extends BlockEntity implements ICanBeHeated, MenuProvider { private final int MAX_SLOT = 6; @@ -45,7 +46,6 @@ public class CookingPotBlockEntity extends BlockEntity implements ICanBeHeated, private final CookingItemStackHandler itemStackHandler = new CookingItemStackHandler(MAX_SLOT + 2,16); private final int[] cookingTime = new int[MAX_SLOT + 1]; - public ItemStack container = ItemStack.EMPTY; public ItemStack result = ItemStack.EMPTY; public int stewingTime = 0; @@ -142,9 +142,22 @@ public ItemStack getResult(){ return result; } - @Override - public ItemStack getContainer(){ - return container; + public void consume(int count){ + if (count > 0) { + boolean t = true; + for (int i = 0; i < MAX_SLOT; i++) { + if (!itemStackHandler.getStackInSlot(i).isEmpty()) { + itemStackHandler.getStackInSlot(i).shrink(count); + if(!itemStackHandler.getStackInSlot(i).isEmpty()){ + t=false; + } + } + } + if(t){ + clear(); + } + } + } @Override @@ -168,9 +181,6 @@ public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) { if (!result.isEmpty()) { tag.put("result", result.save(pRegistries)); } - if (!container.isEmpty()) { - tag.put("container", container.save(pRegistries)); - } return tag; } @@ -190,11 +200,6 @@ protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistrie } else { result = ItemStack.EMPTY; } - if (pTag.get("container") != null) { - container = ItemStack.parse(pRegistries, pTag.getCompound("container")).orElse(ItemStack.EMPTY); - } else { - container = ItemStack.EMPTY; - } } @Override @@ -208,9 +213,6 @@ protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistrie if (!result.isEmpty()) { pTag.put("result", result.save(pRegistries)); } - if (!container.isEmpty()) { - pTag.put("container", container.save(pRegistries)); - } } private void saveCookingTime(CompoundTag nbt) { @@ -246,71 +248,83 @@ public static void serverTick(Level pLevel, BlockPos pPo boolean flag = blockEntity.isEmpty(); boolean heat_flag = blockEntity.isHeated(pLevel, pPos); int MAX_SLOT = blockEntity.getMAX(); - ItemStackHandler itemStackHandler = blockEntity.getItemStacks(); - blockEntity.container = ItemStack.EMPTY; + CookingItemStackHandler itemStackHandler = blockEntity.getItemStacks(); + ItemStackHandler inputStackHandler = new ItemStackHandler(MAX_SLOT); + for (int i = 0; i < MAX_SLOT; i++) { + inputStackHandler.setStackInSlot(i, itemStackHandler.getStackInSlot(i)); + } if (heat_flag) { if (!flag) { - int cookedTime = 0, burntTime = 0; - int cooked_size = 0, burnt_size = 0; + int cookedTime = 0; + int cooked_size = 0; boolean fluid_heated= blockEntity.getFluid().isEmpty(); -// cookProgress - for (int i = 0; i < MAX_SLOT + 1; i++) { -// fluid - if (i == MAX_SLOT) { - if (!blockEntity.getFluid().isEmpty()) { - CookingFoodData cookingFoodData = blockEntity.getFluid().getFluidHolder().getData(DataMapTypes.COOKING_FOOD_FLUID); - if (cookingFoodData != null) { - cookedTime = cookingFoodData.cookedTime(); - blockEntity.cookingTime[i]++; +// 获取配方 + CookingFoodRecipeInput input = new CookingFoodRecipeInput(inputStackHandler, blockEntity.getFluid()); + Optional> optional = pLevel.getRecipeManager().getRecipeFor( + ModRecipes.COOKING_POT_RECIPE.get(), + input, + pLevel + ); + ItemStack result1 = optional.map(RecipeHolder::value) + .map(e -> e.assemble(input, pLevel.registryAccess())) + .orElse(ItemStack.EMPTY); + int stewTime = optional.map(RecipeHolder::value) + .map(e->e.getContainer().braisingTime()) + .orElse(0); + //cookProgress + if(!blockState.getValue(COVER)&&(itemStackHandler.getStackInSlot(7).isEmpty()||(itemStackHandler.getStackInSlot(7).is(result1.getItem())&&itemStackHandler.getStackInSlot(7).getCount()<64))){ + for (int i = 0; i < MAX_SLOT + 1; i++) { + //fluid + if (i == MAX_SLOT) { + if (!blockEntity.getFluid().isEmpty()) { + CookingFoodData cookingFoodData = blockEntity.getFluid().getFluidHolder().getData(DataMapTypes.COOKING_FOOD_FLUID); + if (cookingFoodData != null) { + cookedTime = cookingFoodData.cookedTime(); + blockEntity.cookingTime[i]++; + } + } else { + blockEntity.cookingTime[i] = 0; + } + if (blockEntity.cookingTime[i] > cookedTime * 20) { + fluid_heated = true; } - } else { + continue; + } + //item + ItemStack itemStack = itemStackHandler.getStackInSlot(i); + if (itemStack.isEmpty()) { blockEntity.cookingTime[i] = 0; + continue; + } + CookingFoodData cookingFoodData = itemStack.getItemHolder().getData(DataMapTypes.COOKING_FOOD_ITEM); + if (cookingFoodData != null) { + cookedTime = cookingFoodData.cookedTime(); + blockEntity.cookingTime[i]++; } if (blockEntity.cookingTime[i] > cookedTime * 20) { - fluid_heated = true; + cooked_size++; } - continue; - } -// item - ItemStack itemStack = itemStackHandler.getStackInSlot(i); - if (itemStack.isEmpty()) { - blockEntity.cookingTime[i] = 0; - continue; - } - CookingFoodData cookingFoodData = itemStack.getItemHolder().getData(DataMapTypes.COOKING_FOOD_ITEM); - if (cookingFoodData != null) { - cookedTime = cookingFoodData.cookedTime(); - burntTime = cookingFoodData.burntTime(); - blockEntity.cookingTime[i]++; - } - if (blockEntity.cookingTime[i] > burntTime * 20) { - burnt_size++; - } else if (blockEntity.cookingTime[i] > cookedTime * 20) { - cooked_size++; } + }else{ + blockEntity.stewingTime++; } -// 获取配方 - CookingFoodRecipeInput input = new CookingFoodRecipeInput(itemStackHandler, blockEntity.getFluid()); - Optional> optional = pLevel.getRecipeManager().getRecipeFor( - ModRecipes.SKILLET_RECIPE.get(), - input, - pLevel - ); - blockEntity.result = optional.map(RecipeHolder::value) - .map(e -> e.assemble(input, pLevel.registryAccess())) - .orElse(ItemStack.EMPTY); - if (cooked_size == blockEntity.size() && !blockEntity.result.isEmpty() && fluid_heated) { - blockEntity.container = optional.map(RecipeHolder::value) +// 结果判断 + blockEntity.result=result1; + if (cooked_size == blockEntity.size() && !blockEntity.result.isEmpty() && fluid_heated && itemStackHandler.getStackInSlot(7).getCount()<=64&&blockEntity.stewingTime>= stewTime) { + itemStackHandler.setStackInSlot(6,optional.map(RecipeHolder::value) .map(e -> e.getContainer().container()) - .orElse(ItemStack.EMPTY); - if(blockEntity.container.isEmpty()){ - blockEntity.container=new ItemStack(ModItems.SPATULA.get()); + .orElse(ItemStack.EMPTY)); + if(!itemStackHandler.getStackInSlot(7).isEmpty()){ + itemStackHandler.getStackInSlot(7).grow(blockEntity.getResult().getCount()); + }else { + blockEntity.setItem(blockEntity.result,7); } - } else if (burnt_size > 0) { - blockEntity.result = new ItemStack(ModItems.STRANGE_FOOD.get()); - blockEntity.container=new ItemStack(ModItems.SPATULA.get()); + blockEntity.consume(1); } } else { + if(itemStackHandler.getStackInSlot(7).isEmpty()){ + itemStackHandler.setStackInSlot(6, ItemStack.EMPTY); + } blockEntity.clearTime(); blockEntity.result = ItemStack.EMPTY; } diff --git a/src/main/java/mczme/lingshi/common/block/entity/SkilletBlockEntity.java b/src/main/java/mczme/lingshi/common/block/entity/SkilletBlockEntity.java index b15c7df..cc24d51 100644 --- a/src/main/java/mczme/lingshi/common/block/entity/SkilletBlockEntity.java +++ b/src/main/java/mczme/lingshi/common/block/entity/SkilletBlockEntity.java @@ -46,7 +46,6 @@ public class SkilletBlockEntity extends BlockEntity implements MenuProvider, ICa private final CookingItemStackHandler itemStackHandler = new CookingItemStackHandler(MAX_SLOT + 2,1); private final int[] cookingTime = new int[MAX_SLOT + 1]; - public ItemStack container = ItemStack.EMPTY; public int stirFryCount = 0; public ItemStack result = ItemStack.EMPTY; @@ -143,11 +142,6 @@ public ItemStack getResult() { return result; } - @Override - public ItemStack getContainer() { - return container; - } - public int getMAX() { return MAX_SLOT; } @@ -168,9 +162,6 @@ public Packet getUpdatePacket() { if (!result.isEmpty()) { tag.put("result", result.save(pRegistries)); } - if (!container.isEmpty()) { - tag.put("container", container.save(pRegistries)); - } tag.putInt("count", stirFryCount); return tag; } @@ -191,11 +182,6 @@ protected void loadAdditional(CompoundTag pTag, HolderLookup.@NotNull Provider p } else { result = ItemStack.EMPTY; } - if (pTag.get("container") != null) { - container = ItemStack.parse(pRegistries, pTag.getCompound("container")).orElse(ItemStack.EMPTY); - } else { - container = ItemStack.EMPTY; - } stirFryCount = pTag.getInt("count"); } @@ -210,9 +196,6 @@ protected void saveAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull P if (!result.isEmpty()) { pTag.put("result", result.save(pRegistries)); } - if (!container.isEmpty()) { - pTag.put("container", container.save(pRegistries)); - } pTag.putInt("count", stirFryCount); } @@ -250,7 +233,6 @@ public static void serverTick(Level pLevel, BlockPos pPo boolean heat_flag = blockEntity.isHeated(pLevel, pPos); int MAX_SLOT = blockEntity.getMAX(); ItemStackHandler itemStackHandler = blockEntity.getItemStacks(); - blockEntity.container = ItemStack.EMPTY; if (heat_flag) { if (!flag) { int cookedTime = 0, burntTime = 0; @@ -293,7 +275,11 @@ public static void serverTick(Level pLevel, BlockPos pPo } } // 获取配方 - CookingFoodRecipeInput input = new CookingFoodRecipeInput(itemStackHandler, blockEntity.getFluid()); + ItemStackHandler inputStackHandler = new ItemStackHandler(MAX_SLOT); + for (int i = 0; i < MAX_SLOT; i++) { + inputStackHandler.setStackInSlot(i, itemStackHandler.getStackInSlot(i)); + } + CookingFoodRecipeInput input = new CookingFoodRecipeInput(inputStackHandler, blockEntity.getFluid()); Optional> optional = pLevel.getRecipeManager().getRecipeFor( ModRecipes.SKILLET_RECIPE.get(), input, @@ -306,18 +292,20 @@ public static void serverTick(Level pLevel, BlockPos pPo .map(e -> e.getContainer().stirFryCount()) .orElse(0); if (cooked_size == blockEntity.size() && blockEntity.stirFryCount >= stirFryCount1 && !blockEntity.result.isEmpty() && fluid_heated) { - blockEntity.container = optional.map(RecipeHolder::value) + itemStackHandler.setStackInSlot(5, optional.map(RecipeHolder::value) .map(e -> e.getContainer().container()) - .orElse(ItemStack.EMPTY); - if(blockEntity.container.isEmpty()){ - blockEntity.container=new ItemStack(ModItems.SPATULA.get()); + .orElse(ItemStack.EMPTY)); + if(itemStackHandler.getStackInSlot(5).isEmpty()){ + itemStackHandler.setStackInSlot(5,new ItemStack(ModItems.SPATULA.get())); } + itemStackHandler.setStackInSlot(6,blockEntity.result); } else if (burnt_size > 0) { blockEntity.result = new ItemStack(ModItems.STRANGE_FOOD.get()); - blockEntity.container=new ItemStack(ModItems.SPATULA.get()); + itemStackHandler.setStackInSlot(5,new ItemStack(ModItems.SPATULA.get())); } } else { blockEntity.clearTime(); + itemStackHandler.setStackInSlot(5,ItemStack.EMPTY); blockEntity.result = ItemStack.EMPTY; blockEntity.stirFryCount = 0; diff --git a/src/main/java/mczme/lingshi/common/block/entity/baseblockentity/ICanBeHeated.java b/src/main/java/mczme/lingshi/common/block/entity/baseblockentity/ICanBeHeated.java index 280a284..c28b7b0 100644 --- a/src/main/java/mczme/lingshi/common/block/entity/baseblockentity/ICanBeHeated.java +++ b/src/main/java/mczme/lingshi/common/block/entity/baseblockentity/ICanBeHeated.java @@ -17,8 +17,6 @@ public interface ICanBeHeated { ItemStack getResult(); - ItemStack getContainer(); - int getMAX(); default boolean isHeated(Level pLevel, BlockPos pPos){ diff --git a/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java b/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java index 9c0c5c3..92235de 100644 --- a/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java +++ b/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java @@ -35,6 +35,7 @@ protected void addTranslations() { this.add(ModItems.OIL_BUCKET.get(),"油桶"); this.add(ModItems.FRIED_EGG.get(),"煎鸡蛋"); + this.add(ModItems.COOKED_RICE.get(),"米饭"); } } diff --git a/src/main/java/mczme/lingshi/common/data/recipe/CookingPotRecipeDataGen.java b/src/main/java/mczme/lingshi/common/data/recipe/CookingPotRecipeDataGen.java index c9e5aca..e4e9dca 100644 --- a/src/main/java/mczme/lingshi/common/data/recipe/CookingPotRecipeDataGen.java +++ b/src/main/java/mczme/lingshi/common/data/recipe/CookingPotRecipeDataGen.java @@ -2,26 +2,44 @@ import mczme.lingshi.client.recipebook.CookingFoodRecipeLabel; import mczme.lingshi.common.data.builder.CookingPotRecipeBuilder; +import mczme.lingshi.common.recipe.CookingPotRecipe; +import mczme.lingshi.common.registry.ModItems; import mczme.lingshi.lingshi; import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.material.Fluids; import net.neoforged.neoforge.fluids.FluidStack; import java.util.List; +import static mczme.lingshi.common.data.recipe.Recipes.has; + public class CookingPotRecipeDataGen { public CookingPotRecipeDataGen(RecipeOutput output) { buildRecipes(output); } protected void buildRecipes(RecipeOutput output) { + build(List.of(Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get())),new FluidStack(Fluids.WATER,1000),new ItemStack(ModItems.COOKED_RICE.get(),8),CookingFoodRecipeLabel.BOIL) + .unlockedBy("has_rice", has(ModItems.RICE.get())) + .setContainer(new CookingPotRecipe.CookingPotContainer(new ItemStack(Items.BOWL),0)) + .save(output,create("cooked_rice")); + build(List.of(Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get())),new FluidStack(Fluids.WATER,1000),new ItemStack(ModItems.COOKED_RICE.get(),10),CookingFoodRecipeLabel.BOIL) + .unlockedBy("has_rice", has(ModItems.RICE.get())) + .setContainer(new CookingPotRecipe.CookingPotContainer(new ItemStack(Items.BOWL),0)) + .save(output,create("cooked_rice_1")); + build(List.of(Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get()),Ingredient.of(ModItems.RICE.get())),new FluidStack(Fluids.WATER,1000),new ItemStack(ModItems.COOKED_RICE.get(),12),CookingFoodRecipeLabel.BOIL) + .unlockedBy("has_rice", has(ModItems.RICE.get())) + .setContainer(new CookingPotRecipe.CookingPotContainer(new ItemStack(Items.BOWL),0)) + .save(output,create("cooked_rice_2")); } private CookingPotRecipeBuilder build(List items, FluidStack fluid, ItemStack result, CookingFoodRecipeLabel label){ - return new CookingPotRecipeBuilder(items, fluid, result).setLabel(label).group("CookingPot"); + return new CookingPotRecipeBuilder(items, fluid, result).setLabel(label); } private ResourceLocation create(String s){ diff --git a/src/main/java/mczme/lingshi/common/data/recipe/Recipes.java b/src/main/java/mczme/lingshi/common/data/recipe/Recipes.java index 315d529..5a63962 100644 --- a/src/main/java/mczme/lingshi/common/data/recipe/Recipes.java +++ b/src/main/java/mczme/lingshi/common/data/recipe/Recipes.java @@ -24,6 +24,7 @@ protected void buildRecipes(RecipeOutput output) { new ChoppingBoardRecipeDatagen(output); new SkilletRecipeDatagen(output); new CraftingRecipeDataGen(output); + new CookingPotRecipeDataGen(output); } public static Criterion has(MinMaxBounds.Ints pCount, ItemLike pItem) { diff --git a/src/main/java/mczme/lingshi/common/data/recipe/SkilletRecipeDatagen.java b/src/main/java/mczme/lingshi/common/data/recipe/SkilletRecipeDatagen.java index 4fbadcd..3191b84 100644 --- a/src/main/java/mczme/lingshi/common/data/recipe/SkilletRecipeDatagen.java +++ b/src/main/java/mczme/lingshi/common/data/recipe/SkilletRecipeDatagen.java @@ -48,7 +48,7 @@ protected void buildRecipes(RecipeOutput output) { } private SkilletRecipeBuilder build(List items, FluidStack fluid, ItemStack result){ - return new SkilletRecipeBuilder(items, fluid, result).unlockedBy("has_skillet",has(ModItems.SKILLET.get())).group("Skillet"); + return new SkilletRecipeBuilder(items, fluid, result).unlockedBy("has_skillet",has(ModItems.SKILLET.get())); } private ResourceLocation create(String s){ diff --git a/src/main/java/mczme/lingshi/common/registry/ModItems.java b/src/main/java/mczme/lingshi/common/registry/ModItems.java index 7c0dd84..2eb0ca8 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModItems.java +++ b/src/main/java/mczme/lingshi/common/registry/ModItems.java @@ -29,12 +29,13 @@ public class ModItems { public static final Supplier CHOPPING_BOARD = registerWithCreateTab("chopping_board", () -> new BlockItem(ModBlocks.CHOPPING_BOARD.get(), new Item.Properties())); public static final Supplier POT_LID = registerWithCreateTab("pot_lid", () -> new PotLid(new Item.Properties())); - public static final Supplier SPATULA = registerWithCreateTab("spatula", () -> new SpatulaItem(new Item.Properties())); + public static final Supplier SPATULA = registerWithCreateTab("spatula", () -> new SpatulaItem(new Item.Properties().stacksTo(1))); public static final Supplier IRON_KNIFE = registerWithCreateTab("iron_knife", () -> new KnifeItem(Tiers.IRON, new Item.Properties().attributes(SwordItem.createAttributes(Tiers.IRON, 3, -2.4F)))); public static final Supplier OIL_BUCKET = registerWithCreateTab("oil_bucket", () -> new BucketItem(ModFluids.OIL_SOURCE.get(), new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); public static final Supplier STRANGE_FOOD = registerWithCreateTab("strange_food", () -> new Item(new Item.Properties())); public static final Supplier FRIED_EGG = registerWithCreateTab("fried_egg", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).saturationModifier(3.2f).build()))); + public static final Supplier COOKED_RICE = registerWithCreateTab("cooked_rice", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).saturationModifier(4f).build()))); private static Supplier registerWithCreateTab(String item_name, Supplier itemSupplier) { Supplier item = ITEMS.register(item_name, itemSupplier); diff --git a/src/main/java/mczme/lingshi/common/registry/ModRecipes.java b/src/main/java/mczme/lingshi/common/registry/ModRecipes.java index 1da0271..14f12e3 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModRecipes.java +++ b/src/main/java/mczme/lingshi/common/registry/ModRecipes.java @@ -1,6 +1,7 @@ package mczme.lingshi.common.registry; import mczme.lingshi.common.recipe.ChoppingBoardRecipe; +import mczme.lingshi.common.recipe.CookingPotRecipe; import mczme.lingshi.common.recipe.SkilletRecipe; import mczme.lingshi.lingshi; import net.minecraft.core.registries.Registries; @@ -25,7 +26,7 @@ public class ModRecipes { "skillet_recipe", () -> RecipeType.simple(ResourceLocation.fromNamespaceAndPath(lingshi.MODID, "skillet_recipe")) ); - public static final Supplier> COOKING_POT_RECIPE = + public static final Supplier> COOKING_POT_RECIPE = RECIPE_TYPES.register( "cooking_pot_recipe", () -> RecipeType.simple(ResourceLocation.fromNamespaceAndPath(lingshi.MODID, "cooking_pot_recipe"))