From b497f79b2680769c136559b29f9cf87ffbd8da82 Mon Sep 17 00:00:00 2001 From: MCZME <13183052+mczme@user.noreply.gitee.com> Date: Thu, 22 Aug 2024 22:10:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E7=83=B9=E9=A5=AA?= =?UTF-8?q?=E9=94=85=EF=BC=8C=E9=94=85=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../59eb3dbb5f86130e09b3c62d89b9525ee01cf52d | 3 +- .../85f12f813aff948f91f5cd129c0ffa86bcb17361 | 4 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +- .../resources/assets/lingshi/lang/zh_cn.json | 3 + .../loot_table/blocks/cooking_pot.json | 21 ++ .../data/lingshi/recipe/skillet.json | 5 +- .../BlockEntityRenderer/SkilletBER.java | 18 +- .../mczme/lingshi/client/event/Registry.java | 21 ++ .../lingshi/client/menu/CookingPotMenu.java | 158 +++++++++++++ .../lingshi/client/menu/SkilletMenu.java | 14 +- .../{ => Slot}/CookingItemStackHandler.java | 9 +- .../lingshi/client/menu/Slot/ResultSlot.java | 22 ++ .../CookingPotRecipeBookComponent.java | 45 ++++ .../client/recipebook/ModRecipeBookType.java | 1 + .../client/screen/CookingPotScreen.java | 117 ++++++++++ .../lingshi/common/block/CookingPotBlock.java | 118 ++++++++++ .../block/entity/CookingPotBlockEntity.java | 217 ++++++++++++++++++ .../block/entity/SkilletBlockEntity.java | 9 +- .../mczme/lingshi/common/data/ItemModels.java | 1 + .../data/lang/ChineseLanguageProvider.java | 3 + .../lingshi/common/data/loot/BlockLoot.java | 4 +- .../data/recipe/CraftingRecipeDataGen.java | 3 +- .../mczme/lingshi/common/item/PotLid.java | 10 + .../common/recipe/CookingPotRecipe.java | 153 ++++++++++++ .../lingshi/common/recipe/SkilletRecipe.java | 22 +- ...Input.java => CookingFoodRecipeInput.java} | 4 +- .../CookingPotRecipeSerializer.java | 56 +++++ .../common/registry/BlockEntityTypes.java | 5 + .../lingshi/common/registry/ModBlocks.java | 4 +- .../lingshi/common/registry/ModItems.java | 19 +- .../lingshi/common/registry/ModMenuTypes.java | 2 + .../lingshi/common/registry/ModRecipes.java | 5 + .../common/registry/ModSerializer.java | 6 +- .../resources/META-INF/enumExtensions.json | 6 + .../lingshi/blockstates/cooking_pot.json | 34 +++ .../lingshi/models/block/cooking_pot.json | 130 +++++++++++ .../lingshi/models/block/cooking_pot_1.json | 191 +++++++++++++++ .../assets/lingshi/models/item/pot_lid.json | 116 ++++++++++ .../assets/lingshi/textures/block/lib.png | Bin 0 -> 404 bytes .../assets/lingshi/textures/block/pot.png | Bin 0 -> 622 bytes .../textures/gui/container/cooking_pot.png | Bin 0 -> 1619 bytes 41 files changed, 1511 insertions(+), 52 deletions(-) create mode 100644 src/generated/resources/data/lingshi/loot_table/blocks/cooking_pot.json create mode 100644 src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java rename src/main/java/mczme/lingshi/client/menu/{ => Slot}/CookingItemStackHandler.java (66%) create mode 100644 src/main/java/mczme/lingshi/client/menu/Slot/ResultSlot.java create mode 100644 src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java create mode 100644 src/main/java/mczme/lingshi/client/screen/CookingPotScreen.java create mode 100644 src/main/java/mczme/lingshi/common/block/CookingPotBlock.java create mode 100644 src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java create mode 100644 src/main/java/mczme/lingshi/common/item/PotLid.java create mode 100644 src/main/java/mczme/lingshi/common/recipe/CookingPotRecipe.java rename src/main/java/mczme/lingshi/common/recipe/input/{SkilletRecipeInput.java => CookingFoodRecipeInput.java} (87%) create mode 100644 src/main/java/mczme/lingshi/common/recipe/serializer/CookingPotRecipeSerializer.java create mode 100644 src/main/resources/assets/lingshi/blockstates/cooking_pot.json create mode 100644 src/main/resources/assets/lingshi/models/block/cooking_pot.json create mode 100644 src/main/resources/assets/lingshi/models/block/cooking_pot_1.json create mode 100644 src/main/resources/assets/lingshi/models/item/pot_lid.json create mode 100644 src/main/resources/assets/lingshi/textures/block/lib.png create mode 100644 src/main/resources/assets/lingshi/textures/block/pot.png create mode 100644 src/main/resources/assets/lingshi/textures/gui/container/cooking_pot.png diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d index 6041b3a..a757ac1 100644 --- a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d +++ b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d @@ -1,5 +1,6 @@ -// 1.21 2024-08-13T03:55:33.7091711 Loot Tables +// 1.21 2024-08-22T18:03:26.4830973 Loot Tables 032b2242788b8411178136ca48214246ef2af8a9 data/lingshi/loot_table/blocks/chopping_board.json +63e60d75a79e0a64eb6338f6bc98dddd6a8d6a0b data/lingshi/loot_table/blocks/cooking_pot.json 67cc122cf5e7e5865ff9bc81fec6e8371225b0d6 data/lingshi/loot_table/blocks/skillet.json c843630bb0739aad37078f0119c9cc31f5316c3a data/lingshi/loot_table/blocks/tea_leaf.json 3cd0ced47f090fec162cddcb8b2f75284fa134cb data/lingshi/loot_table/blocks/tea_tree.json diff --git a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 index 2a23f20..75da488 100644 --- a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 +++ b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 @@ -1,2 +1,2 @@ -// 1.21 2024-08-21T06:16:10.9126133 Languages: zh_cn for mod: lingshi -18193d8163c50d2682857150071f4b38892474cb assets/lingshi/lang/zh_cn.json +// 1.21 2024-08-22T18:03:26.4900985 Languages: zh_cn for mod: lingshi +2012858b997388159ffda305994f25429de3d030 assets/lingshi/lang/zh_cn.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 11b4872..845250f 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.21 2024-08-21T06:32:40.2517736 Recipes +// 1.21 2024-08-22T18:03:26.4870994 Recipes 6a319c97da924f9ab21b5d264c18cb8ad9da8755 data/lingshi/advancement/recipes/decorations/chopping_board.json 0a4b54bfda8aa98f1a26bbf1d8231c76ed12e770 data/lingshi/advancement/recipes/decorations/skillet.json 90e465ef819e2007fb2b023b2970095ecce8b79a data/lingshi/advancement/recipes/skillet/baked_potato.json @@ -15,7 +15,7 @@ e511f76246f906a279fc1ec531922d8f70dfb68c data/lingshi/advancement/recipes/tools/ bec1047337843fdd073fe87393c3b500ae11a1de data/lingshi/recipe/chopping_board.json 3e41620c4ec5b19f87046dad7fe5c7ed6ede21c2 data/lingshi/recipe/chopping_board/rice.json e6daac4cca245fc9e220e2fcb1f2b27e410ba503 data/lingshi/recipe/iron_knife.json -6971547c4e197d1f259c4599e8bd99fa9a565095 data/lingshi/recipe/skillet.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 diff --git a/src/generated/resources/assets/lingshi/lang/zh_cn.json b/src/generated/resources/assets/lingshi/lang/zh_cn.json index 8e00060..d451ef1 100644 --- a/src/generated/resources/assets/lingshi/lang/zh_cn.json +++ b/src/generated/resources/assets/lingshi/lang/zh_cn.json @@ -1,13 +1,16 @@ { "block.lingshi.chopping_board": "砧板", + "block.lingshi.cooking_pot": "烹饪锅", "block.lingshi.rice": "稻米", "block.lingshi.rice_seedling": "稻苗", "block.lingshi.skillet": "平底锅", "block.lingshi.tea_tree": "茶树", + "gui.lingshi.cooking_pot_menu": "烹饪锅", "gui.lingshi.skillet_menu": "平底锅", "item.lingshi.fried_egg": "煎鸡蛋", "item.lingshi.iron_knife": "铁菜刀", "item.lingshi.oil_bucket": "油桶", + "item.lingshi.pot_lid": "锅盖", "item.lingshi.rice_of_ear": "稻穗", "item.lingshi.spatula": "锅铲", "item.lingshi.tea_leaf": "茶叶", diff --git a/src/generated/resources/data/lingshi/loot_table/blocks/cooking_pot.json b/src/generated/resources/data/lingshi/loot_table/blocks/cooking_pot.json new file mode 100644 index 0000000..b1b717d --- /dev/null +++ b/src/generated/resources/data/lingshi/loot_table/blocks/cooking_pot.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "lingshi:cooking_pot" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "lingshi:blocks/cooking_pot" +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/recipe/skillet.json b/src/generated/resources/data/lingshi/recipe/skillet.json index 95e1baf..b934de2 100644 --- a/src/generated/resources/data/lingshi/recipe/skillet.json +++ b/src/generated/resources/data/lingshi/recipe/skillet.json @@ -5,12 +5,15 @@ "#": { "tag": "minecraft:planks" }, + "A": { + "item": "minecraft:iron_ingot" + }, "X": { "tag": "minecraft:terracotta" } }, "pattern": [ - "XX#", + "AA#", "XX " ], "result": { diff --git a/src/main/java/mczme/lingshi/client/BlockEntityRenderer/SkilletBER.java b/src/main/java/mczme/lingshi/client/BlockEntityRenderer/SkilletBER.java index 0a16e8c..35aa36d 100644 --- a/src/main/java/mczme/lingshi/client/BlockEntityRenderer/SkilletBER.java +++ b/src/main/java/mczme/lingshi/client/BlockEntityRenderer/SkilletBER.java @@ -22,6 +22,8 @@ public class SkilletBER implements BlockEntityRenderer { + private int StirFryCount = 0; + public SkilletBER(BlockEntityRendererProvider.Context pContext) { } @@ -33,7 +35,7 @@ public void render(SkilletBlockEntity pBlockEntity, float pPartialTick, PoseStac Direction direction = pBlockEntity.getBlockState().getValue(ChoppingBoardBlock.FACING); double[] X = {0.5, 0.3, 0.6, 0.3, 0.6}; double[] Z = {0.5, 0.3, 0.3, 0.6, 0.6}; - double[] Y = {0.13, 0.125, 0.123, 0.125, 0.122}; + double[] Y = {0.13, 0.125, 0.123, 0.124, 0.122}; if (!pBlockEntity.isEmpty()) { if (!fluidStack.isEmpty()) { @@ -60,13 +62,13 @@ public void render(SkilletBlockEntity pBlockEntity, float pPartialTick, PoseStac private float randomAngel(int stirFry) { Random rand = new Random(); - int seed = switch (stirFry % 3) { - case 1 -> 123456; - case 2 -> 886549; - default -> 0; - }; - rand.setSeed(seed); - return seed == 0 ? 0 : rand.nextFloat() * 180; + if(StirFryCount!= stirFry){ + StirFryCount = stirFry; + rand.setSeed(StirFryCount); + }else { + rand.setSeed(StirFryCount* 500L); + } + return stirFry==0?0: rand.nextFloat() * 180; } } diff --git a/src/main/java/mczme/lingshi/client/event/Registry.java b/src/main/java/mczme/lingshi/client/event/Registry.java index ec13ab7..8bd6aa7 100644 --- a/src/main/java/mczme/lingshi/client/event/Registry.java +++ b/src/main/java/mczme/lingshi/client/event/Registry.java @@ -7,6 +7,7 @@ import mczme.lingshi.client.BlockEntityRenderer.SkilletBER; import mczme.lingshi.client.recipebook.CookingFoodRecipeLabel; import mczme.lingshi.client.screen.CookingHud; +import mczme.lingshi.client.screen.CookingPotScreen; import mczme.lingshi.client.screen.SkilletScreen; import mczme.lingshi.common.recipe.SkilletRecipe; import mczme.lingshi.common.registry.BlockEntityTypes; @@ -34,6 +35,7 @@ import org.joml.Vector3f; import static mczme.lingshi.client.recipebook.ModRecipeBookCategories.*; +import static mczme.lingshi.client.recipebook.ModRecipeBookType.COOKING_POT; import static mczme.lingshi.client.recipebook.ModRecipeBookType.SKILLET; @EventBusSubscriber(modid = lingshi.MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @@ -48,11 +50,13 @@ public static void registerRenderers(EntityRenderersEvent.RegisterRenderers even @SubscribeEvent private static void registerScreens(RegisterMenuScreensEvent event) { event.register(ModMenuTypes.SKILLET_MENU.get(), SkilletScreen::new); + event.register(ModMenuTypes.COOKING_POT_MENU.get(), CookingPotScreen::new); } // recipe book @SubscribeEvent public static void registerRecipeBook(RegisterRecipeBookCategoriesEvent event) { +// Skillet event.registerBookCategories(SKILLET, ImmutableList.of(SKILLET_SEARCH.get(), SKILLET_HEAT.get(), SKILLET_PAN_FRY.get(), SKILLET_STIR_FRY.get(), SKILLET_BOIL.get())); event.registerAggregateCategory(SKILLET_SEARCH.get(), ImmutableList.of(SKILLET_HEAT.get(), SKILLET_PAN_FRY.get(), SKILLET_STIR_FRY.get(), SKILLET_BOIL.get())); event.registerRecipeCategoryFinder(ModRecipes.SKILLET_RECIPE.get(), recipe -> @@ -69,6 +73,23 @@ public static void registerRecipeBook(RegisterRecipeBookCategoriesEvent event) { } return MISC.get(); }); +// Cooking Pot + event.registerBookCategories(COOKING_POT, ImmutableList.of(SKILLET_SEARCH.get(), SKILLET_HEAT.get(), SKILLET_PAN_FRY.get(), SKILLET_STIR_FRY.get(), SKILLET_BOIL.get())); + event.registerAggregateCategory(SKILLET_SEARCH.get(), ImmutableList.of(SKILLET_HEAT.get(), SKILLET_PAN_FRY.get(), SKILLET_STIR_FRY.get(), SKILLET_BOIL.get())); + event.registerRecipeCategoryFinder(ModRecipes.SKILLET_RECIPE.get(), recipe -> + { + if (recipe.value() instanceof SkilletRecipe Recipe) { + CookingFoodRecipeLabel label = Recipe.getLabel(); + return switch (label) { + case HEAT -> SKILLET_HEAT.get(); + case PAN_FRY -> SKILLET_PAN_FRY.get(); + case STIR_FRY -> SKILLET_STIR_FRY.get(); + case BOIL -> SKILLET_BOIL.get(); + default -> MISC.get(); + }; + } + return MISC.get(); + }); } //fluid diff --git a/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java b/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java new file mode 100644 index 0000000..896254e --- /dev/null +++ b/src/main/java/mczme/lingshi/client/menu/CookingPotMenu.java @@ -0,0 +1,158 @@ +package mczme.lingshi.client.menu; + +import mczme.lingshi.client.menu.Slot.CookingItemStackHandler; +import mczme.lingshi.client.menu.Slot.ResultSlot; +import mczme.lingshi.common.block.entity.CookingPotBlockEntity; +import mczme.lingshi.common.recipe.CookingPotRecipe; +import mczme.lingshi.common.recipe.input.CookingFoodRecipeInput; +import mczme.lingshi.common.registry.ModMenuTypes; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.inventory.RecipeBookMenu; +import net.minecraft.world.inventory.RecipeBookType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.level.Level; +import net.neoforged.neoforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.SlotItemHandler; + +import static mczme.lingshi.client.recipebook.ModRecipeBookType.COOKING_POT; + +public class CookingPotMenu extends RecipeBookMenu { + + public CookingPotBlockEntity blockEntity; + protected final Level level; + private final CookingItemStackHandler itemStackHandler; + + public CookingPotMenu(int pContainerId, Inventory pPlayerInventory, FriendlyByteBuf pContext) { + this(pContainerId, pPlayerInventory,(CookingPotBlockEntity) pPlayerInventory.player.level().getBlockEntity(pContext.readBlockPos())); + } + + public CookingPotMenu(int pContainerId,Inventory pPlayerInventory, CookingPotBlockEntity blockEntity) { + super(ModMenuTypes.COOKING_POT_MENU.get(), pContainerId); + checkContainerSize(pPlayerInventory, 1); + this.blockEntity = blockEntity; + this.level = pPlayerInventory.player.level(); + this.itemStackHandler = blockEntity.getItemStacks(); + this.addWorkSlot(itemStackHandler); + layoutPlayerInventorySlots(pPlayerInventory); + } + + private void addWorkSlot(ItemStackHandler itemStacks) { + int[] X = {33, 51, 69,33, 51, 69, 93, 127}; + int[] Y = {29, 29, 29,47, 47, 47, 29, 47}; + for (int i = 0; i < blockEntity.getMAX(); i++) { + SlotItemHandler slot = new SlotItemHandler(itemStackHandler, i, X[i], Y[i]); + 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])); + } + + private void layoutPlayerInventorySlots(Inventory playerInventory) { + // Player inventory + for (int i = 0; i < 3; ++i) { + for (int l = 0; l < 9; ++l) { + this.addSlot(new Slot(playerInventory, l + i * 9 + 9, 8 + l * 18, 84 + i * 18)); + } + } + // Hotbar + for (int i = 0; i < 9; ++i) { + this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); + } + } + + @Override + public void fillCraftSlotsStackedContents(StackedContents pItemHelper) { + for (int i = 0; i < blockEntity.getMAX(); i++) { + pItemHelper.accountSimpleStack(itemStackHandler.getStackInSlot(i)); + } + } + + @Override + public void clearCraftingContent() { + for (int i = 0; i < blockEntity.getMAX()-2; i++) { + this.getSlot(i).set(ItemStack.EMPTY); + } + } + + @Override + public boolean recipeMatches(RecipeHolder pRecipe) { + return pRecipe.value().matches(new CookingFoodRecipeInput(itemStackHandler,blockEntity.getFluid()), this.level); + } + + @Override + public int getResultSlotIndex() { + return 7; + } + + @Override + public int getGridWidth() { + return 6; + } + + @Override + public int getGridHeight() { + return 1; + } + + @Override + public int getSize() { + return 8; + } + + @Override + public RecipeBookType getRecipeBookType() { + return COOKING_POT; + } + + @Override + public boolean shouldMoveToInventory(int pSlotIndex) { + return pSlotIndex != this.getResultSlotIndex(); + } + + @Override + public ItemStack quickMoveStack(Player pPlayer, int pIndex) { + ItemStack quickMovedStack = ItemStack.EMPTY; + Slot quickMovedSlot = this.slots.get(pIndex); + if (quickMovedSlot.hasItem()) { + ItemStack rawStack = quickMovedSlot.getItem(); + quickMovedStack = rawStack.copy(); + if (pIndex >= 8 && pIndex < 43) { + if (!this.moveItemStackTo(rawStack, 0, 6, false)) { + if (pIndex < 32) { + if (!this.moveItemStackTo(rawStack, 34, 43, false)) { + return ItemStack.EMPTY; + } + } else if (!this.moveItemStackTo(rawStack, 8, 34, false)) { + return ItemStack.EMPTY; + } + } + } else if (!this.moveItemStackTo(rawStack, 7, 43, false)) { + return ItemStack.EMPTY; + } + + if (rawStack.isEmpty()) { + quickMovedSlot.set(ItemStack.EMPTY); + } else { + quickMovedSlot.setChanged(); + } + if (rawStack.getCount() == quickMovedStack.getCount()) { + return ItemStack.EMPTY; + } + quickMovedSlot.onTake(pPlayer, rawStack); + } + return quickMovedStack; + } + + @Override + public boolean stillValid(Player pPlayer) { + return true; + } +} diff --git a/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java b/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java index f9dd2b8..35c0852 100644 --- a/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java +++ b/src/main/java/mczme/lingshi/client/menu/SkilletMenu.java @@ -1,8 +1,10 @@ package mczme.lingshi.client.menu; +import mczme.lingshi.client.menu.Slot.CookingItemStackHandler; +import mczme.lingshi.client.menu.Slot.ResultSlot; import mczme.lingshi.common.block.entity.SkilletBlockEntity; import mczme.lingshi.common.recipe.SkilletRecipe; -import mczme.lingshi.common.recipe.input.SkilletRecipeInput; +import mczme.lingshi.common.recipe.input.CookingFoodRecipeInput; import mczme.lingshi.common.registry.ModMenuTypes; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; @@ -17,7 +19,7 @@ import static mczme.lingshi.client.recipebook.ModRecipeBookType.SKILLET; -public class SkilletMenu extends RecipeBookMenu { +public class SkilletMenu extends RecipeBookMenu { public SkilletBlockEntity blockEntity; protected final Level level; @@ -46,8 +48,10 @@ private void addWorkSlot(ItemStackHandler itemStacks) { slot.set(itemStacks.getStackInSlot(i)); this.addSlot(slot); } - this.addSlot(new SlotItemHandler(itemStackHandler, 5, X[5], Y[5])); - this.addSlot(new SlotItemHandler(itemStackHandler, 6, X[6], Y[6])); + 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])); } private void layoutPlayerInventorySlots(Inventory playerInventory) { @@ -121,7 +125,7 @@ public void clearCraftingContent() { @Override public boolean recipeMatches(RecipeHolder pRecipe) { - return pRecipe.value().matches(new SkilletRecipeInput(itemStackHandler,blockEntity.getFluid()), this.level); + return pRecipe.value().matches(new CookingFoodRecipeInput(itemStackHandler,blockEntity.getFluid()), this.level); } @Override diff --git a/src/main/java/mczme/lingshi/client/menu/CookingItemStackHandler.java b/src/main/java/mczme/lingshi/client/menu/Slot/CookingItemStackHandler.java similarity index 66% rename from src/main/java/mczme/lingshi/client/menu/CookingItemStackHandler.java rename to src/main/java/mczme/lingshi/client/menu/Slot/CookingItemStackHandler.java index 52a0a16..57595ed 100644 --- a/src/main/java/mczme/lingshi/client/menu/CookingItemStackHandler.java +++ b/src/main/java/mczme/lingshi/client/menu/Slot/CookingItemStackHandler.java @@ -1,4 +1,4 @@ -package mczme.lingshi.client.menu; +package mczme.lingshi.client.menu.Slot; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.items.ItemStackHandler; @@ -6,12 +6,15 @@ public class CookingItemStackHandler extends ItemStackHandler { - public CookingItemStackHandler(int size){ + private final int max; + + public CookingItemStackHandler(int size,int max){ super(size); + this.max=max; } @Override protected int getStackLimit(int slot, @NotNull ItemStack stack) { - return 1; + return max; } } diff --git a/src/main/java/mczme/lingshi/client/menu/Slot/ResultSlot.java b/src/main/java/mczme/lingshi/client/menu/Slot/ResultSlot.java new file mode 100644 index 0000000..d5154ac --- /dev/null +++ b/src/main/java/mczme/lingshi/client/menu/Slot/ResultSlot.java @@ -0,0 +1,22 @@ +package mczme.lingshi.client.menu.Slot; + +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.SlotItemHandler; + +public class ResultSlot extends SlotItemHandler { + + public ResultSlot(IItemHandler itemHandler, int index, int xPosition, int yPosition) { + super(itemHandler, index, xPosition, yPosition); + } + + public boolean mayPlace(ItemStack pStack) { + return false; + } + + @Override + public boolean mayPickup(Player playerIn) { + return false; + } +} diff --git a/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java b/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java new file mode 100644 index 0000000..3aa077a --- /dev/null +++ b/src/main/java/mczme/lingshi/client/recipebook/CookingPotRecipeBookComponent.java @@ -0,0 +1,45 @@ +package mczme.lingshi.client.recipebook; + +import mczme.lingshi.common.recipe.SkilletRecipe; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.core.NonNullList; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeHolder; + +import java.util.Iterator; +import java.util.List; + +public class CookingPotRecipeBookComponent extends RecipeBookComponent { + @Override + public void setupGhostRecipe(RecipeHolder pRecipe, List pSlots) { + SkilletRecipe skilletRecipe = (SkilletRecipe) 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); + } + + NonNullList nonnulllist = pRecipe.value().getIngredients(); + + Iterator iterator = nonnulllist.iterator(); + + for (int i = 0; i < 5; i++) { + if (!iterator.hasNext()) { + return; + } + Ingredient ingredient = iterator.next(); + if (!ingredient.isEmpty()) { + Slot slot1 = pSlots.get(i); + this.ghostRecipe.addIngredient(ingredient, slot1.x, slot1.y); + } + } + } + +// @Override +// protected void initFilterButtonTextures() { +// this.filterButton.initTextureValues(FILTER_SPRITES); +// } +} diff --git a/src/main/java/mczme/lingshi/client/recipebook/ModRecipeBookType.java b/src/main/java/mczme/lingshi/client/recipebook/ModRecipeBookType.java index 57a4a0e..d95c0e9 100644 --- a/src/main/java/mczme/lingshi/client/recipebook/ModRecipeBookType.java +++ b/src/main/java/mczme/lingshi/client/recipebook/ModRecipeBookType.java @@ -4,4 +4,5 @@ public class ModRecipeBookType { public static final RecipeBookType SKILLET = RecipeBookType.valueOf("lingshi_SKILLET"); + public static final RecipeBookType COOKING_POT = RecipeBookType.valueOf("lingshi_COOKING_POT"); } diff --git a/src/main/java/mczme/lingshi/client/screen/CookingPotScreen.java b/src/main/java/mczme/lingshi/client/screen/CookingPotScreen.java new file mode 100644 index 0000000..afa3c08 --- /dev/null +++ b/src/main/java/mczme/lingshi/client/screen/CookingPotScreen.java @@ -0,0 +1,117 @@ +package mczme.lingshi.client.screen; + +import mczme.lingshi.client.menu.CookingPotMenu; +import mczme.lingshi.client.recipebook.CookingPotRecipeBookComponent; +import mczme.lingshi.common.block.entity.CookingPotBlockEntity; +import mczme.lingshi.lingshi; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; + +public class CookingPotScreen extends AbstractContainerScreen implements RecipeUpdateListener { + + public final CookingPotRecipeBookComponent recipeBookComponent = new CookingPotRecipeBookComponent(); + private boolean widthTooNarrow; + private static final ResourceLocation BACKGROUND_TEXTURE = ResourceLocation.fromNamespaceAndPath(lingshi.MODID,"textures/gui/container/cooking_pot.png"); + + + public CookingPotScreen(CookingPotMenu pMenu, Inventory pPlayerInventory, Component pTitle) { + super(pMenu, pPlayerInventory, pTitle); + } + + @Override + public void init(){ + this.leftPos = (this.width - this.imageWidth) / 2; + this.topPos = (this.height - this.imageHeight) / 2; + this.widthTooNarrow = this.width < 379; + this.recipeBookComponent.init(this.width, this.height, this.minecraft, this.widthTooNarrow, this.menu); + this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); + this.addRenderableWidget(new ImageButton(this.leftPos+6, this.height / 2 - 49, 20, 18, RecipeBookComponent.RECIPE_BUTTON_SPRITES, p_313431_ -> { + this.recipeBookComponent.toggleVisibility(); + this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); + p_313431_.setPosition(this.leftPos + 6, this.height / 2 - 49); + })); + this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; + } + + @Override + public void containerTick() { + super.containerTick(); + this.recipeBookComponent.tick(); + } + + @Override + public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) { + if (this.recipeBookComponent.isVisible() && this.widthTooNarrow) { + this.renderBackground(pGuiGraphics, pMouseX, pMouseY, pPartialTick); + this.recipeBookComponent.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick); + } else { + super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick); + this.recipeBookComponent.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick); + this.recipeBookComponent.renderGhostRecipe(pGuiGraphics, this.leftPos, this.topPos, true, pPartialTick); + } + + this.renderTooltip(pGuiGraphics, pMouseX, pMouseY); + this.recipeBookComponent.renderTooltip(pGuiGraphics, this.leftPos, this.topPos, pMouseX, pMouseY); + } + + @Override + protected void renderBg(GuiGraphics pGuiGraphics, float pPartialTick, int pMouseX, int pMouseY) { + CookingPotBlockEntity blockEntity = this.menu.blockEntity; + pGuiGraphics.blit(BACKGROUND_TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight); + if(blockEntity.isHeated(blockEntity.getLevel(),blockEntity.getBlockPos())){ + pGuiGraphics.blit(BACKGROUND_TEXTURE, this.leftPos+93, this.topPos+64, 0, 166, 14, 14); + } + } + + @Override + public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) { + if (this.recipeBookComponent.mouseClicked(pMouseX, pMouseY, pButton)) { + return true; + } else { + return this.widthTooNarrow && this.recipeBookComponent.isVisible() ? true : super.mouseClicked(pMouseX, pMouseY, pButton); + } + } + + @Override + protected void slotClicked(Slot pSlot, int pSlotId, int pMouseButton, ClickType pType) { + super.slotClicked(pSlot, pSlotId, pMouseButton, pType); + this.recipeBookComponent.slotClicked(pSlot); + } + + @Override + public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) { + return this.recipeBookComponent.keyPressed(pKeyCode, pScanCode, pModifiers) ? true : super.keyPressed(pKeyCode, pScanCode, pModifiers); + } + + @Override + protected boolean hasClickedOutside(double pMouseX, double pMouseY, int pGuiLeft, int pGuiTop, int pMouseButton) { + boolean flag = pMouseX < (double)pGuiLeft + || pMouseY < (double)pGuiTop + || pMouseX >= (double)(pGuiLeft + this.imageWidth) + || pMouseY >= (double)(pGuiTop + this.imageHeight); + return this.recipeBookComponent.hasClickedOutside(pMouseX, pMouseY, this.leftPos, this.topPos, this.imageWidth, this.imageHeight, pMouseButton) && flag; + } + + @Override + public boolean charTyped(char pCodePoint, int pModifiers) { + return this.recipeBookComponent.charTyped(pCodePoint, pModifiers) ? true : super.charTyped(pCodePoint, pModifiers); + } + + @Override + public void recipesUpdated() { + this.recipeBookComponent.recipesUpdated(); + } + + @Override + public RecipeBookComponent getRecipeBookComponent() { + return this.recipeBookComponent; + } +} diff --git a/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java b/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java new file mode 100644 index 0000000..d5c3c36 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/block/CookingPotBlock.java @@ -0,0 +1,118 @@ +package mczme.lingshi.common.block; + +import com.mojang.serialization.MapCodec; +import mczme.lingshi.common.block.entity.CookingPotBlockEntity; +import mczme.lingshi.common.registry.ModItems; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.Containers; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; + + +public class CookingPotBlock extends BaseEntityBlock { + + public static final BooleanProperty COVER = BooleanProperty.create("cover"); + public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final VoxelShape SHAPE = Block.box(3,0,3,13,12,13); + + public CookingPotBlock(Properties pProperties) { + super(pProperties); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(COVER, false)); + } + + 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(pStack.is(ModItems.POT_LID.get())&& !pState.getValue(COVER)){ + pLevel.setBlockAndUpdate(pPos, pState.setValue(COVER, true)); + return ItemInteractionResult.SUCCESS; + } + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + } + + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + + @Override + protected InteractionResult useWithoutItem(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, BlockHitResult pHitResult) { + if (pLevel.getBlockEntity(pPos) instanceof CookingPotBlockEntity blockEntity){ + if (pState.getValue(COVER)){ + pLevel.setBlockAndUpdate(pPos, pState.setValue(COVER, false)); + Containers.dropItemStack(pLevel,pPos.getX(), pPos.getY()+0.7, pPos.getZ(), new ItemStack(ModItems.POT_LID.get())); + return InteractionResult.SUCCESS; + } else if (pPlayer.isShiftKeyDown()) { + pPlayer.openMenu(blockEntity,pPos); + } + + } + + return InteractionResult.sidedSuccess(pLevel.isClientSide); + } + + @Override + protected MapCodec codec() { + return null; + } + + @Override + protected VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { + return SHAPE; + } + + @Override + protected boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) { + return canSupportRigidBlock(pLevel, pPos.below()) || canSupportCenter(pLevel, pPos.below(), Direction.UP); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext pContext) { + return this.defaultBlockState().setValue(FACING, pContext.getHorizontalDirection()); + } + + @Override + public BlockState updateShape(BlockState pState, Direction pFacing, BlockState pFacingState, LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pFacingPos) { + if (!pState.canSurvive(pLevel, pCurrentPos)) { + return Blocks.AIR.defaultBlockState(); + } + return super.updateShape(pState, pFacing, pFacingState, pLevel, pCurrentPos, pFacingPos); + } + + @Override + public RenderShape getRenderShape(BlockState pState) { + return RenderShape.MODEL; + } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { + return new CookingPotBlockEntity(pPos, pState); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder pBuilder) { + pBuilder.add(FACING, COVER); + } + +} diff --git a/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java b/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java new file mode 100644 index 0000000..4aa52e5 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/block/entity/CookingPotBlockEntity.java @@ -0,0 +1,217 @@ +package mczme.lingshi.common.block.entity; + +import mczme.lingshi.client.menu.Slot.CookingItemStackHandler; +import mczme.lingshi.client.menu.CookingPotMenu; +import mczme.lingshi.common.block.entity.baseblockentity.ICanBeHeated; +import mczme.lingshi.common.registry.BlockEntityTypes; +import mczme.lingshi.lingshi; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; + +public class CookingPotBlockEntity extends BlockEntity implements ICanBeHeated, MenuProvider { + + private final int MAX_SLOT = 6; + + private FluidStack fluidStacks = FluidStack.EMPTY; + 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 CookingPotBlockEntity(BlockPos pPos, BlockState pBlockState) { + super(BlockEntityTypes.COOKING_POT_BLOCKENTITY.get(), pPos, pBlockState); + } + + public boolean isFull() { + for (int i = 0; i < MAX_SLOT; i++) { + if (itemStackHandler.getStackInSlot(i).isEmpty()) { + return false; + } + } + return true; + } + + public boolean isEmpty() { + for (int i = 0; i < MAX_SLOT; i++) { + if (!itemStackHandler.getStackInSlot(i).isEmpty()) { + return false; + } + } + return fluidStacks.isEmpty(); + } + + public ItemStack dropItem() { + for (int i = MAX_SLOT - 1; i >= 0; i--) { + if (!itemStackHandler.getStackInSlot(i).isEmpty()) { + ItemStack stack = itemStackHandler.getStackInSlot(i).copy(); + itemStackHandler.setStackInSlot(i, ItemStack.EMPTY); + return stack; + } + } + return ItemStack.EMPTY; + } + + public FluidStack getFluid() { + return fluidStacks; + } + + public CookingItemStackHandler getItemStacks() { + return itemStackHandler; + } + + public void setItem(ItemStack item) { + for (int i = 0; i < MAX_SLOT; i++) { + if (itemStackHandler.getStackInSlot(i).isEmpty()) { + itemStackHandler.setStackInSlot(i, item); + break; + } + } + } + + public void setItem(ItemStack item, int slot) { + itemStackHandler.insertItem(slot, item, false); + } + + public void setFluid(FluidStack fluid) { + fluidStacks = fluid; + } + + public int size() { + int size = 0; + for (int i = 0; i < MAX_SLOT; i++) { + if (!itemStackHandler.getStackInSlot(i).isEmpty()) { + size++; + } + } + return size; + } + + public void clear() { + result = ItemStack.EMPTY; + for (int i = 0; i < MAX_SLOT; i++) { + itemStackHandler.setStackInSlot(i, ItemStack.EMPTY); + } + fluidStacks = FluidStack.EMPTY; + clearTime(); + } + + public void clearTime() { + Arrays.fill(cookingTime, 0); + } + + public int[] getCookingTime() { + return cookingTime; + } + + public int getMAX() { + return MAX_SLOT; + } + + @Override + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } + + @Override + public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) { + CompoundTag tag = new CompoundTag(); + tag.put("items", itemStackHandler.serializeNBT(pRegistries)); + if (!fluidStacks.isEmpty()) { + tag.put("fluid", fluidStacks.save(pRegistries)); + } + saveCookingTime(tag); + if (!result.isEmpty()) { + tag.put("result", result.save(pRegistries)); + } + if (!container.isEmpty()) { + tag.put("container", container.save(pRegistries)); + } + return tag; + } + + @Override + protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { + itemStackHandler.deserializeNBT(pRegistries, pTag.getCompound("items")); + if (pTag.get("fluid") != null) { + fluidStacks = FluidStack.parse(pRegistries, pTag.getCompound("fluid")).orElse(FluidStack.EMPTY); + } else { + fluidStacks = FluidStack.EMPTY; + } + if (pTag.get("cookingTime") != null && pTag.getInt("Size") != 0) { + loadCookingTime(pTag.getList("cookingTime", Tag.TAG_COMPOUND), pTag.getInt("Size")); + } + if (pTag.get("result") != null) { + result = ItemStack.parse(pRegistries, pTag.getCompound("result")).orElse(ItemStack.EMPTY); + } else { + result = ItemStack.EMPTY; + } + if (pTag.get("container") != null) { + container = ItemStack.parse(pRegistries, pTag.getCompound("container")).orElse(ItemStack.EMPTY); + } else { + container = ItemStack.EMPTY; + } + } + + @Override + protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { + super.saveAdditional(pTag, pRegistries); + pTag.put("items", itemStackHandler.serializeNBT(pRegistries)); + if (!this.fluidStacks.isEmpty()) { + pTag.put("fluid", fluidStacks.save(pRegistries)); + } + saveCookingTime(pTag); + if (!result.isEmpty()) { + pTag.put("result", result.save(pRegistries)); + } + if (!container.isEmpty()) { + pTag.put("container", container.save(pRegistries)); + } + } + + private void saveCookingTime(CompoundTag nbt) { + ListTag nbtTagList = new ListTag(); + for (int i = 0; i < MAX_SLOT + 1; i++) { + CompoundTag itemTag = new CompoundTag(); + itemTag.putInt("index", cookingTime[i]); + nbtTagList.add(itemTag); + } + nbt.put("cookingTime", nbtTagList); + nbt.putInt("Size", MAX_SLOT + 1); + } + + private void loadCookingTime(ListTag pTag, int size) { + for (int i = 0; i < size; i++) { + cookingTime[i] = pTag.getCompound(i).getInt("index"); + } + } + + @Override + public Component getDisplayName() { + return Component.translatable("gui." + lingshi.MODID + ".cooking_pot_menu"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) { + return new CookingPotMenu(pContainerId, pPlayerInventory, this); + } +} 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 33b52c3..76d5474 100644 --- a/src/main/java/mczme/lingshi/common/block/entity/SkilletBlockEntity.java +++ b/src/main/java/mczme/lingshi/common/block/entity/SkilletBlockEntity.java @@ -1,12 +1,12 @@ package mczme.lingshi.common.block.entity; -import mczme.lingshi.client.menu.CookingItemStackHandler; +import mczme.lingshi.client.menu.Slot.CookingItemStackHandler; import mczme.lingshi.client.menu.SkilletMenu; 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.input.SkilletRecipeInput; +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; @@ -42,7 +42,7 @@ public class SkilletBlockEntity extends BlockEntity implements MenuProvider, ICa private final int MAX_SLOT = 5; private FluidStack fluidStacks = FluidStack.EMPTY; - private final CookingItemStackHandler itemStackHandler = new CookingItemStackHandler(MAX_SLOT + 2); + private final CookingItemStackHandler itemStackHandler = new CookingItemStackHandler(MAX_SLOT + 2,1); private final int[] cookingTime = new int[MAX_SLOT + 1]; public ItemStack container = ItemStack.EMPTY; @@ -240,7 +240,6 @@ public static void serverTick(Level pLevel, BlockPos pPo int MAX_SLOT = blockEntity.getMAX(); ItemStackHandler itemStackHandler = blockEntity.getItemStacks(); blockEntity.container = ItemStack.EMPTY; - if (heat_flag) { if (!flag) { int cookedTime = 0, burntTime = 0; @@ -283,7 +282,7 @@ public static void serverTick(Level pLevel, BlockPos pPo } } // 获取配方 - SkilletRecipeInput input = new SkilletRecipeInput(itemStackHandler, blockEntity.getFluid()); + CookingFoodRecipeInput input = new CookingFoodRecipeInput(itemStackHandler, blockEntity.getFluid()); Optional> optional = pLevel.getRecipeManager().getRecipeFor( ModRecipes.SKILLET_RECIPE.get(), input, diff --git a/src/main/java/mczme/lingshi/common/data/ItemModels.java b/src/main/java/mczme/lingshi/common/data/ItemModels.java index 4f5f5ab..be94c9d 100644 --- a/src/main/java/mczme/lingshi/common/data/ItemModels.java +++ b/src/main/java/mczme/lingshi/common/data/ItemModels.java @@ -20,6 +20,7 @@ protected void registerModels() { basicItem(ModItems.OIL_BUCKET.get()); + withExistingParent(String.valueOf(ModItems.COOKING_POT.get()), modLoc("block/cooking_pot")); withExistingParent(String.valueOf(ModItems.CHOPPING_BOARD.get()), modLoc("block/chopping_board")); withExistingParent(String.valueOf(ModItems.SKILLET.get()), modLoc("block/skillet")); withExistingParent(String.valueOf(ModItems.IRON_KNIFE.get()),mcLoc("item/handheld")).texture("layer0", modLoc("item/iron_knife")); 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 ba1f4f5..9c0c5c3 100644 --- a/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java +++ b/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java @@ -28,6 +28,9 @@ protected void addTranslations() { this.add("gui.lingshi.skillet_menu","平底锅"); this.add(ModItems.SKILLET.get(), "平底锅"); this.add(ModItems.SPATULA.get(),"锅铲"); + this.add("gui.lingshi.cooking_pot_menu","烹饪锅"); + this.add(ModItems.COOKING_POT.get(), "烹饪锅"); + this.add(ModItems.POT_LID.get(),"锅盖"); this.add(ModItems.OIL_BUCKET.get(),"油桶"); diff --git a/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java b/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java index 5991925..35920c2 100644 --- a/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java +++ b/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java @@ -15,7 +15,8 @@ public class BlockLoot extends BlockLootSubProvider { ModBlocks.TEA_TREE.get(), ModBlocks.TEA_LEAF.get(), ModBlocks.CHOPPING_BOARD.get(), - ModBlocks.SKILLET.get() + ModBlocks.SKILLET.get(), + ModBlocks.COOKING_POT.get() ); public BlockLoot(HolderLookup.Provider lookupProvider) { @@ -29,6 +30,7 @@ protected void generate() { dropOther(ModBlocks.TEA_LEAF.get(), ModItems.TEA_LEAF.get()); dropSelf(ModBlocks.CHOPPING_BOARD.get()); dropSelf(ModBlocks.SKILLET.get()); + dropSelf(ModBlocks.COOKING_POT.get()); } @Override diff --git a/src/main/java/mczme/lingshi/common/data/recipe/CraftingRecipeDataGen.java b/src/main/java/mczme/lingshi/common/data/recipe/CraftingRecipeDataGen.java index 3d3b192..ad93897 100644 --- a/src/main/java/mczme/lingshi/common/data/recipe/CraftingRecipeDataGen.java +++ b/src/main/java/mczme/lingshi/common/data/recipe/CraftingRecipeDataGen.java @@ -38,10 +38,11 @@ protected void buildRecipes(RecipeOutput output) { .unlockedBy("has_iron_ingot", has(Items.STICK)) .save(output); ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, ModItems.SKILLET.get()) - .pattern("XX#") + .pattern("AA#") .pattern("XX ") .define('X', ItemTags.TERRACOTTA) .define('#', ItemTags.PLANKS) + .define('A', Items.IRON_INGOT) .unlockedBy("has_iron_ingot", has(ItemTags.PLANKS)) .save(output); } diff --git a/src/main/java/mczme/lingshi/common/item/PotLid.java b/src/main/java/mczme/lingshi/common/item/PotLid.java new file mode 100644 index 0000000..7959183 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/item/PotLid.java @@ -0,0 +1,10 @@ +package mczme.lingshi.common.item; + +import net.minecraft.world.item.Item; + +public class PotLid extends Item { + public PotLid(Properties properties) { + super(properties); + } + +} diff --git a/src/main/java/mczme/lingshi/common/recipe/CookingPotRecipe.java b/src/main/java/mczme/lingshi/common/recipe/CookingPotRecipe.java new file mode 100644 index 0000000..c6582e2 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/recipe/CookingPotRecipe.java @@ -0,0 +1,153 @@ +package mczme.lingshi.common.recipe; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import mczme.lingshi.client.recipebook.CookingFoodRecipeLabel; +import mczme.lingshi.common.recipe.input.CookingFoodRecipeInput; +import mczme.lingshi.common.registry.ModRecipes; +import mczme.lingshi.common.registry.ModSerializer; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; +import net.neoforged.neoforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static mczme.lingshi.common.util.ModCodec.ModoptionalField; +import static net.neoforged.neoforge.common.util.RecipeMatcher.findMatches; + +public class CookingPotRecipe extends CookingFoodRecipe implements Recipe { + + public static final int MAX_SLOT = 6; + + private final List items; + private final FluidStack fluids; + private final CookingPotContainer container; + private final ItemStack result; + + final String group; + + public CookingPotRecipe(List items, FluidStack fluids, CookingPotContainer container, ItemStack result, String group,CookingFoodRecipeLabel label) { + super(label); + this.items = items; + this.fluids = fluids; + this.container = container; + this.result = result; + this.group = group; + } + + @Override + public @NotNull NonNullList getIngredients() { + NonNullList list = NonNullList.create(); + list.addAll(items); + return list; + } + + @Override + public boolean matches(CookingFoodRecipeInput pInput, Level pLevel) { + List inputs = new ArrayList<>(); + int i = 0; + if (!pInput.isEmpty()) { + for (int j = 0; j < pInput.size(); ++j) { + ItemStack itemstack = pInput.getItem(j); + if (!itemstack.isEmpty()) { + ++i; + inputs.add(itemstack); + } + } + } + return i == this.items.size() && findMatches(inputs, this.items) != null && pInput.getFluid().is(fluids.getFluid()) ; + } + + @Override + public ItemStack assemble(CookingFoodRecipeInput pInput, HolderLookup.Provider pRegistries) { + return this.result.copy(); + } + + @Override + public boolean canCraftInDimensions(int pWidth, int pHeight) { + return pWidth * pHeight >= 1; + } + + @Override + public ItemStack getResultItem(HolderLookup.Provider pRegistries) { + return this.result; + } + + @Override + public RecipeSerializer getSerializer() { + return ModSerializer.COOKING_POT_SERIALIZER.get(); + } + + @Override + public RecipeType getType() { + return ModRecipes.COOKING_POT_RECIPE.get(); + } + public FluidStack getFluid() { + return fluids; + } + + public List getItems() { + return items; + } + + public ItemStack getResult() { + return result; + } + + public CookingPotContainer getContainer() { + return container; + } + + @Override + public @NotNull String getGroup() { + return this.group; + } + + public record CookingPotContainer(ItemStack container, int braisingTime) { + + public static final CookingPotContainer EMPTY = new CookingPotContainer(ItemStack.EMPTY, 0); + + public static final Codec CODEC = Codec.lazyInitialized( + () -> RecordCodecBuilder.create(inst -> inst.group( + ModoptionalField("container", ItemStack.OPTIONAL_CODEC, ItemStack.EMPTY).forGetter(CookingPotContainer::container), + ModoptionalField("braising_time", Codec.INT, 0).forGetter(CookingPotContainer::braisingTime) + ).apply(inst, CookingPotContainer::new))); + + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ItemStack.OPTIONAL_STREAM_CODEC, CookingPotContainer::container, + ByteBufCodecs.INT, CookingPotContainer::braisingTime, + CookingPotContainer::new + ); + + @Override + public ItemStack container() { + return container.copy(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CookingPotContainer that = (CookingPotContainer) o; + return braisingTime == that.braisingTime && Objects.equals(container, that.container); + } + + @Override + public int hashCode() { + return Objects.hash(container, braisingTime); + } + } + +} diff --git a/src/main/java/mczme/lingshi/common/recipe/SkilletRecipe.java b/src/main/java/mczme/lingshi/common/recipe/SkilletRecipe.java index 9364a1c..7c8ea1b 100644 --- a/src/main/java/mczme/lingshi/common/recipe/SkilletRecipe.java +++ b/src/main/java/mczme/lingshi/common/recipe/SkilletRecipe.java @@ -3,7 +3,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import mczme.lingshi.client.recipebook.CookingFoodRecipeLabel; -import mczme.lingshi.common.recipe.input.SkilletRecipeInput; +import mczme.lingshi.common.recipe.input.CookingFoodRecipeInput; import mczme.lingshi.common.registry.ModRecipes; import mczme.lingshi.common.registry.ModSerializer; import net.minecraft.core.HolderLookup; @@ -27,7 +27,7 @@ import static mczme.lingshi.common.util.ModCodec.ModoptionalField; import static net.neoforged.neoforge.common.util.RecipeMatcher.findMatches; -public class SkilletRecipe extends CookingFoodRecipe implements Recipe { +public class SkilletRecipe extends CookingFoodRecipe implements Recipe { public static final int MAX_SLOT = 5; @@ -55,7 +55,7 @@ public SkilletRecipe(List items, FluidStack fluids, SkilletCookingCo } @Override - public boolean matches(SkilletRecipeInput pInput, @NotNull Level pLevel) { + public boolean matches(CookingFoodRecipeInput pInput, @NotNull Level pLevel) { List inputs = new ArrayList<>(); int i = 0; if (!pInput.isEmpty()) { @@ -67,11 +67,11 @@ public boolean matches(SkilletRecipeInput pInput, @NotNull Level pLevel) { } } } - return i == this.items.size() && findMatches(inputs, this.items) != null && pInput.getFluid().is(fluids.getFluid()) ; + return i == this.items.size() && findMatches(inputs, this.items) != null && pInput.getFluid().is(fluids.getFluid()); } @Override - public @NotNull ItemStack assemble(@NotNull SkilletRecipeInput pInput, HolderLookup.@NotNull Provider pRegistries) { + public @NotNull ItemStack assemble(@NotNull CookingFoodRecipeInput pInput, HolderLookup.@NotNull Provider pRegistries) { return this.result.copy(); } @@ -118,17 +118,17 @@ public SkilletCookingContainer getContainer() { public record SkilletCookingContainer(ItemStack container, int stirFryCount) { - public static final SkilletCookingContainer EMPTY = new SkilletCookingContainer(ItemStack.EMPTY,0); + public static final SkilletCookingContainer EMPTY = new SkilletCookingContainer(ItemStack.EMPTY, 0); public static final Codec CODEC = Codec.lazyInitialized( - ()->RecordCodecBuilder.create(inst->inst.group( + () -> RecordCodecBuilder.create(inst -> inst.group( ModoptionalField("container", ItemStack.OPTIONAL_CODEC, ItemStack.EMPTY).forGetter(SkilletCookingContainer::container), - ModoptionalField("stir_fry_count",Codec.INT,0).forGetter(SkilletCookingContainer::stirFryCount) - ).apply(inst,SkilletCookingContainer::new))); + ModoptionalField("stir_fry_count", Codec.INT, 0).forGetter(SkilletCookingContainer::stirFryCount) + ).apply(inst, SkilletCookingContainer::new))); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ItemStack.OPTIONAL_STREAM_CODEC,SkilletCookingContainer::container, - ByteBufCodecs.INT,SkilletCookingContainer::stirFryCount, + ItemStack.OPTIONAL_STREAM_CODEC, SkilletCookingContainer::container, + ByteBufCodecs.INT, SkilletCookingContainer::stirFryCount, SkilletCookingContainer::new ); diff --git a/src/main/java/mczme/lingshi/common/recipe/input/SkilletRecipeInput.java b/src/main/java/mczme/lingshi/common/recipe/input/CookingFoodRecipeInput.java similarity index 87% rename from src/main/java/mczme/lingshi/common/recipe/input/SkilletRecipeInput.java rename to src/main/java/mczme/lingshi/common/recipe/input/CookingFoodRecipeInput.java index d17e107..8a8b8ae 100644 --- a/src/main/java/mczme/lingshi/common/recipe/input/SkilletRecipeInput.java +++ b/src/main/java/mczme/lingshi/common/recipe/input/CookingFoodRecipeInput.java @@ -7,12 +7,12 @@ import org.jetbrains.annotations.NotNull; -public class SkilletRecipeInput implements RecipeInput { +public class CookingFoodRecipeInput implements RecipeInput { private final ItemStackHandler items; private final FluidStack fluids; - public SkilletRecipeInput(ItemStackHandler items, FluidStack fluid) { + public CookingFoodRecipeInput(ItemStackHandler items, FluidStack fluid) { this.items = items; this.fluids = fluid; } diff --git a/src/main/java/mczme/lingshi/common/recipe/serializer/CookingPotRecipeSerializer.java b/src/main/java/mczme/lingshi/common/recipe/serializer/CookingPotRecipeSerializer.java new file mode 100644 index 0000000..2dee18b --- /dev/null +++ b/src/main/java/mczme/lingshi/common/recipe/serializer/CookingPotRecipeSerializer.java @@ -0,0 +1,56 @@ +package mczme.lingshi.common.recipe.serializer; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import mczme.lingshi.client.recipebook.CookingFoodRecipeLabel; +import mczme.lingshi.common.recipe.CookingPotRecipe; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.neoforged.neoforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +import static mczme.lingshi.common.util.ModCodec.ModoptionalField; + +public class CookingPotRecipeSerializer implements RecipeSerializer { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> inst.group( + Ingredient.CODEC.listOf().fieldOf("ingredients").forGetter(CookingPotRecipe::getItems), + ModoptionalField("fluid", FluidStack.OPTIONAL_CODEC,FluidStack.EMPTY).forGetter(CookingPotRecipe::getFluid), + ModoptionalField("container", CookingPotRecipe.CookingPotContainer.CODEC, CookingPotRecipe.CookingPotContainer.EMPTY).forGetter(CookingPotRecipe::getContainer), + ItemStack.CODEC.fieldOf("result").forGetter(CookingPotRecipe::getResult), + Codec.STRING.fieldOf("group").forGetter(CookingPotRecipe::getGroup), + CookingFoodRecipeLabel.CODEC.fieldOf("label").forGetter(CookingPotRecipe::getLabel) + ).apply(inst, CookingPotRecipe::new)); + + public static final StreamCodec> INGREDIENT_STREAM_CODEC = + Ingredient.CONTENTS_STREAM_CODEC.apply(ByteBufCodecs.list(CookingPotRecipe.MAX_SLOT)); + public static final StreamCodec CookingFoodLabel_STREAM_CODEC = + StreamCodec.of(SkilletRecipeSerializer::encode, SkilletRecipeSerializer::decode); + + public static final StreamCodec STREAM_CODEC = + StreamCodec.composite( + INGREDIENT_STREAM_CODEC, CookingPotRecipe::getItems, + StreamCodec.of(SkilletRecipeSerializer::FluidStack_encode, SkilletRecipeSerializer::FluidStack_decode), CookingPotRecipe::getFluid, + CookingPotRecipe.CookingPotContainer.STREAM_CODEC, CookingPotRecipe::getContainer, + ItemStack.STREAM_CODEC, CookingPotRecipe::getResult, + ByteBufCodecs.STRING_UTF8, CookingPotRecipe::getGroup, + CookingFoodLabel_STREAM_CODEC, CookingPotRecipe::getLabel, + CookingPotRecipe::new + ); + + @Override + public @NotNull MapCodec codec() { + return CODEC; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return STREAM_CODEC; + } +} diff --git a/src/main/java/mczme/lingshi/common/registry/BlockEntityTypes.java b/src/main/java/mczme/lingshi/common/registry/BlockEntityTypes.java index 3e1aa67..af9484d 100644 --- a/src/main/java/mczme/lingshi/common/registry/BlockEntityTypes.java +++ b/src/main/java/mczme/lingshi/common/registry/BlockEntityTypes.java @@ -1,6 +1,7 @@ package mczme.lingshi.common.registry; import mczme.lingshi.common.block.entity.ChoppingBoardBlockEntity; +import mczme.lingshi.common.block.entity.CookingPotBlockEntity; import mczme.lingshi.common.block.entity.SkilletBlockEntity; import mczme.lingshi.lingshi; import net.minecraft.core.registries.Registries; @@ -23,6 +24,10 @@ public class BlockEntityTypes { BLOCK_ENTITIES.register("skillet_blockentity", () -> BlockEntityType.Builder.of(SkilletBlockEntity::new, ModBlocks.SKILLET.get()).build(null)); + public static final Supplier> COOKING_POT_BLOCKENTITY = + BLOCK_ENTITIES.register("cooking_pot_blockentity", () -> + BlockEntityType.Builder.of(CookingPotBlockEntity::new, + ModBlocks.COOKING_POT.get()).build(null)); public static void register(IEventBus eventBus) { BLOCK_ENTITIES.register(eventBus); diff --git a/src/main/java/mczme/lingshi/common/registry/ModBlocks.java b/src/main/java/mczme/lingshi/common/registry/ModBlocks.java index 70656e8..3e72766 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModBlocks.java +++ b/src/main/java/mczme/lingshi/common/registry/ModBlocks.java @@ -32,7 +32,9 @@ public class ModBlocks { BlockBehaviour.Properties.of().randomTicks().mapColor(MapColor.PLANT).noCollission().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY)); public static final Supplier SKILLET = BLOCKS.registerBlock("skillet", SkilletBlock::new, - BlockBehaviour.Properties.of()); + BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_ORE)); + public static final Supplier COOKING_POT = BLOCKS.registerBlock("cooking_pot", CookingPotBlock::new, + BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_ORE)); public static final Supplier CHOPPING_BOARD = BLOCKS.registerBlock("chopping_board", ChoppingBoardBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS)); diff --git a/src/main/java/mczme/lingshi/common/registry/ModItems.java b/src/main/java/mczme/lingshi/common/registry/ModItems.java index 43fa205..148c3b1 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModItems.java +++ b/src/main/java/mczme/lingshi/common/registry/ModItems.java @@ -16,22 +16,25 @@ public class ModItems { public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(lingshi.MODID); public static final List> ITEMS_LIST = new ArrayList<>(); - public static final Supplier RICE = registerWithCreateTab("rice", ()->new BlockItem(ModBlocks.RICE.get(), new Item.Properties())); - public static final Supplier RICE_SEEDLING =registerWithCreateTab("rice_seedling", ()->new BlockItem(ModBlocks.RICE_SEEDLING.get(), new Item.Properties())); + public static final Supplier RICE = registerWithCreateTab("rice", () -> new BlockItem(ModBlocks.RICE.get(), new Item.Properties())); + public static final Supplier RICE_SEEDLING = registerWithCreateTab("rice_seedling", () -> new BlockItem(ModBlocks.RICE_SEEDLING.get(), new Item.Properties())); public static final Supplier RICE_OF_EAR = registerWithCreateTab("rice_of_ear", () -> new Item(new Item.Properties())); public static final Supplier TEA_TREE = registerWithCreateTab("tea_tree", () -> new BlockItem(ModBlocks.TEA_TREE.get(), new Item.Properties())); public static final Supplier TEA_LEAF = registerWithCreateTab("tea_leaf", () -> new Item(new Item.Properties())); - public static final Supplier SKILLET = registerWithCreateTab("skillet", () -> new BlockItem(ModBlocks.SKILLET.get(),new Item.Properties())); + public static final Supplier SKILLET = registerWithCreateTab("skillet", () -> new BlockItem(ModBlocks.SKILLET.get(), new Item.Properties())); + public static final Supplier COOKING_POT = registerWithCreateTab("cooking_pot", () -> new BlockItem(ModBlocks.COOKING_POT.get(), new Item.Properties())); public static final Supplier CHOPPING_BOARD = registerWithCreateTab("chopping_board", () -> new BlockItem(ModBlocks.CHOPPING_BOARD.get(), new Item.Properties())); - public static final Supplier SPATULA = registerWithCreateTab("spatula",()->new SpatulaItem(new Item.Properties())); - 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 POT_LID = registerWithCreateTab("pot_lid", () -> new Item( new Item.Properties())); + public static final Supplier SPATULA = registerWithCreateTab("spatula", () -> new SpatulaItem(new Item.Properties())); + 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 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()))); private static Supplier registerWithCreateTab(String item_name, Supplier itemSupplier) { Supplier item = ITEMS.register(item_name, itemSupplier); ITEMS_LIST.add(item); diff --git a/src/main/java/mczme/lingshi/common/registry/ModMenuTypes.java b/src/main/java/mczme/lingshi/common/registry/ModMenuTypes.java index 7cfd8d2..3ffcee1 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModMenuTypes.java +++ b/src/main/java/mczme/lingshi/common/registry/ModMenuTypes.java @@ -1,5 +1,6 @@ package mczme.lingshi.common.registry; +import mczme.lingshi.client.menu.CookingPotMenu; import mczme.lingshi.client.menu.SkilletMenu; import mczme.lingshi.lingshi; import net.minecraft.core.registries.Registries; @@ -16,6 +17,7 @@ public class ModMenuTypes { public static final Supplier> SKILLET_MENU = MENU_TYPES.register("skillet_menu", () -> IMenuTypeExtension.create(SkilletMenu::new)); + public static final Supplier> COOKING_POT_MENU = MENU_TYPES.register("cooking_pot_menu", () -> IMenuTypeExtension.create(CookingPotMenu::new)); public static void register(IEventBus eventBus){ MENU_TYPES.register(eventBus); diff --git a/src/main/java/mczme/lingshi/common/registry/ModRecipes.java b/src/main/java/mczme/lingshi/common/registry/ModRecipes.java index 4b96384..1da0271 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModRecipes.java +++ b/src/main/java/mczme/lingshi/common/registry/ModRecipes.java @@ -25,6 +25,11 @@ public class ModRecipes { "skillet_recipe", () -> RecipeType.simple(ResourceLocation.fromNamespaceAndPath(lingshi.MODID, "skillet_recipe")) ); + public static final Supplier> COOKING_POT_RECIPE = + RECIPE_TYPES.register( + "cooking_pot_recipe", + () -> RecipeType.simple(ResourceLocation.fromNamespaceAndPath(lingshi.MODID, "cooking_pot_recipe")) + ); public static void register(IEventBus modEventBus) { RECIPE_TYPES.register(modEventBus); diff --git a/src/main/java/mczme/lingshi/common/registry/ModSerializer.java b/src/main/java/mczme/lingshi/common/registry/ModSerializer.java index 9eb65c8..e97aee3 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModSerializer.java +++ b/src/main/java/mczme/lingshi/common/registry/ModSerializer.java @@ -1,5 +1,7 @@ package mczme.lingshi.common.registry; +import mczme.lingshi.common.recipe.CookingPotRecipe; +import mczme.lingshi.common.recipe.serializer.CookingPotRecipeSerializer; import mczme.lingshi.common.recipe.serializer.SkilletRecipeSerializer; import mczme.lingshi.common.recipe.ChoppingBoardRecipe; import mczme.lingshi.common.recipe.SkilletRecipe; @@ -20,8 +22,10 @@ public class ModSerializer { RECIPE_SERIALIZERS.register("chopping_board", ChoppingBoardRecipeSerializer::new); public static final Supplier> SKILLET_SERIALIZER = RECIPE_SERIALIZERS.register("skillet", SkilletRecipeSerializer::new); + public static final Supplier> COOKING_POT_SERIALIZER = + RECIPE_SERIALIZERS.register("cooking_pot", CookingPotRecipeSerializer::new); - public static void register (IEventBus modEventBus) { + public static void register(IEventBus modEventBus) { RECIPE_SERIALIZERS.register(modEventBus); } } diff --git a/src/main/resources/META-INF/enumExtensions.json b/src/main/resources/META-INF/enumExtensions.json index 3d689e9..8a31e02 100644 --- a/src/main/resources/META-INF/enumExtensions.json +++ b/src/main/resources/META-INF/enumExtensions.json @@ -6,6 +6,12 @@ "constructor": "()V", "parameters": [] }, + { + "enum": "net/minecraft/world/inventory/RecipeBookType", + "name": "lingshi_COOKING_POT", + "constructor": "()V", + "parameters": [] + }, { "enum": "net/minecraft/client/RecipeBookCategories", "name": "lingshi_SKILLET_SEARCH", diff --git a/src/main/resources/assets/lingshi/blockstates/cooking_pot.json b/src/main/resources/assets/lingshi/blockstates/cooking_pot.json new file mode 100644 index 0000000..1bcffd2 --- /dev/null +++ b/src/main/resources/assets/lingshi/blockstates/cooking_pot.json @@ -0,0 +1,34 @@ +{ + "variants": { + "facing=east,cover=false": { + "model": "lingshi:block/cooking_pot", + "y": 270 + }, + "facing=north,cover=false": { + "model": "lingshi:block/cooking_pot", + "y": 180 + }, + "facing=south,cover=false": { + "model": "lingshi:block/cooking_pot" + }, + "facing=west,cover=false": { + "model": "lingshi:block/cooking_pot", + "y": 90 + }, + "facing=east,cover=true": { + "model": "lingshi:block/cooking_pot_1", + "y": 270 + }, + "facing=north,cover=true": { + "model": "lingshi:block/cooking_pot_1", + "y": 180 + }, + "facing=south,cover=true": { + "model": "lingshi:block/cooking_pot_1" + }, + "facing=west,cover=true": { + "model": "lingshi:block/cooking_pot_1", + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/block/cooking_pot.json b/src/main/resources/assets/lingshi/models/block/cooking_pot.json new file mode 100644 index 0000000..63c5bab --- /dev/null +++ b/src/main/resources/assets/lingshi/models/block/cooking_pot.json @@ -0,0 +1,130 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "0": "lingshi:block/pot", + "particle": "lingshi:block/pot" + }, + "elements": [ + { + "from": [3, 0, 3], + "to": [13, 1, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 6]}, + "faces": { + "north": {"uv": [5.5, 8, 8, 8.25], "texture": "#0"}, + "east": {"uv": [8, 8, 10.5, 8.25], "texture": "#0"}, + "south": {"uv": [0, 8.25, 2.5, 8.5], "texture": "#0"}, + "west": {"uv": [2.5, 8.25, 5, 8.5], "texture": "#0"}, + "up": {"uv": [7.5, 8, 5, 5.5], "texture": "#0"}, + "down": {"uv": [10, 0, 7.5, 2.5], "texture": "#0"} + } + }, + { + "from": [2, 1, 3], + "to": [3, 12, 13], + "faces": { + "north": {"uv": [7.5, 2.5, 7.75, 5.25], "texture": "#0"}, + "east": {"uv": [0, 0, 2.5, 2.75], "texture": "#0"}, + "south": {"uv": [7.5, 5.25, 7.75, 8], "texture": "#0"}, + "west": {"uv": [2.5, 0, 5, 2.75], "texture": "#0"}, + "up": {"uv": [8.5, 5, 8.25, 2.5], "texture": "#0"}, + "down": {"uv": [8.5, 5, 8.25, 7.5], "texture": "#0"} + } + }, + { + "from": [13, 1, 3], + "to": [14, 12, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [13, 0, 0]}, + "faces": { + "north": {"uv": [7.75, 2.5, 8, 5.25], "texture": "#0"}, + "east": {"uv": [0, 2.75, 2.5, 5.5], "texture": "#0"}, + "south": {"uv": [7.75, 5.25, 8, 8], "texture": "#0"}, + "west": {"uv": [2.5, 2.75, 5, 5.5], "texture": "#0"}, + "up": {"uv": [5.75, 10.75, 5.5, 8.25], "texture": "#0"}, + "down": {"uv": [6, 8.25, 5.75, 10.75], "texture": "#0"} + } + }, + { + "from": [3, 1, 2], + "to": [13, 12, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 0]}, + "faces": { + "north": {"uv": [5, 0, 7.5, 2.75], "texture": "#0"}, + "east": {"uv": [8, 2.5, 8.25, 5.25], "texture": "#0"}, + "south": {"uv": [5, 2.75, 7.5, 5.5], "texture": "#0"}, + "west": {"uv": [5, 8, 5.25, 10.75], "texture": "#0"}, + "up": {"uv": [8.5, 8.5, 6, 8.25], "texture": "#0"}, + "down": {"uv": [10.75, 7.5, 8.25, 7.75], "texture": "#0"} + } + }, + { + "from": [3, 1, 13], + "to": [13, 12, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 12]}, + "faces": { + "north": {"uv": [0, 5.5, 2.5, 8.25], "texture": "#0"}, + "east": {"uv": [5.25, 8, 5.5, 10.75], "texture": "#0"}, + "south": {"uv": [2.5, 5.5, 5, 8.25], "texture": "#0"}, + "west": {"uv": [8, 5.25, 8.25, 8], "texture": "#0"}, + "up": {"uv": [10.75, 8, 8.25, 7.75], "texture": "#0"}, + "down": {"uv": [2.5, 8.5, 0, 8.75], "texture": "#0"} + } + }, + { + "from": [1, 10, 6], + "to": [2, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [1, 10, 6]}, + "faces": { + "north": {"uv": [8.5, 5, 8.75, 5.25], "texture": "#0"}, + "south": {"uv": [8.5, 5.25, 8.75, 5.5], "texture": "#0"}, + "west": {"uv": [8.5, 2.5, 9.5, 2.75], "texture": "#0"}, + "up": {"uv": [8.75, 3.75, 8.5, 2.75], "texture": "#0"}, + "down": {"uv": [3.75, 8.5, 3.5, 9.5], "texture": "#0"} + } + }, + { + "from": [14, 10, 6], + "to": [15, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 10, 6]}, + "faces": { + "north": {"uv": [8.5, 5.5, 8.75, 5.75], "texture": "#0"}, + "east": {"uv": [3.75, 8.5, 4.75, 8.75], "texture": "#0"}, + "south": {"uv": [8.5, 5.75, 8.75, 6], "texture": "#0"}, + "up": {"uv": [8.75, 5, 8.5, 4], "texture": "#0"}, + "down": {"uv": [5, 8.5, 4.75, 9.5], "texture": "#0"} + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.5, 0.5, 0.5] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/block/cooking_pot_1.json b/src/main/resources/assets/lingshi/models/block/cooking_pot_1.json new file mode 100644 index 0000000..584cbd0 --- /dev/null +++ b/src/main/resources/assets/lingshi/models/block/cooking_pot_1.json @@ -0,0 +1,191 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "0": "lingshi:block/pot", + "1": "lingshi:block/lib", + "particle": "lingshi:block/pot" + }, + "elements": [ + { + "from": [3, 0, 3], + "to": [13, 1, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 6]}, + "faces": { + "north": {"uv": [5.5, 8, 8, 8.25], "texture": "#0"}, + "east": {"uv": [8, 8, 10.5, 8.25], "texture": "#0"}, + "south": {"uv": [0, 8.25, 2.5, 8.5], "texture": "#0"}, + "west": {"uv": [2.5, 8.25, 5, 8.5], "texture": "#missing"}, + "up": {"uv": [7.5, 8, 5, 5.5], "texture": "#0"}, + "down": {"uv": [10, 0, 7.5, 2.5], "texture": "#0"} + } + }, + { + "from": [2, 1, 3], + "to": [3, 12, 13], + "faces": { + "north": {"uv": [7.5, 2.5, 7.75, 5.25], "texture": "#0"}, + "east": {"uv": [0, 0, 2.5, 2.75], "texture": "#0"}, + "south": {"uv": [7.5, 5.25, 7.75, 8], "texture": "#0"}, + "west": {"uv": [2.5, 0, 5, 2.75], "texture": "#0"}, + "up": {"uv": [8.5, 5, 8.25, 2.5], "texture": "#0"}, + "down": {"uv": [8.5, 5, 8.25, 7.5], "texture": "#0"} + } + }, + { + "from": [13, 1, 3], + "to": [14, 12, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [13, 0, 0]}, + "faces": { + "north": {"uv": [7.75, 2.5, 8, 5.25], "texture": "#0"}, + "east": {"uv": [0, 2.75, 2.5, 5.5], "texture": "#0"}, + "south": {"uv": [7.75, 5.25, 8, 8], "texture": "#0"}, + "west": {"uv": [2.5, 2.75, 5, 5.5], "texture": "#missing"}, + "up": {"uv": [5.75, 10.75, 5.5, 8.25], "texture": "#0"}, + "down": {"uv": [6, 8.25, 5.75, 10.75], "texture": "#0"} + } + }, + { + "from": [3, 1, 2], + "to": [13, 12, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 0]}, + "faces": { + "north": {"uv": [5, 0, 7.5, 2.75], "texture": "#0"}, + "east": {"uv": [8, 2.5, 8.25, 5.25], "texture": "#0"}, + "south": {"uv": [5, 2.75, 7.5, 5.5], "texture": "#0"}, + "west": {"uv": [5, 8, 5.25, 10.75], "texture": "#missing"}, + "up": {"uv": [8.5, 8.5, 6, 8.25], "texture": "#0"}, + "down": {"uv": [10.75, 7.5, 8.25, 7.75], "texture": "#0"} + } + }, + { + "from": [3, 1, 13], + "to": [13, 12, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 12]}, + "faces": { + "north": {"uv": [0, 5.5, 2.5, 8.25], "texture": "#0"}, + "east": {"uv": [5.25, 8, 5.5, 10.75], "texture": "#0"}, + "south": {"uv": [2.5, 5.5, 5, 8.25], "texture": "#0"}, + "west": {"uv": [8, 5.25, 8.25, 8], "texture": "#missing"}, + "up": {"uv": [10.75, 8, 8.25, 7.75], "texture": "#0"}, + "down": {"uv": [2.5, 8.5, 0, 8.75], "texture": "#0"} + } + }, + { + "from": [1, 10, 6], + "to": [2, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [1, 10, 6]}, + "faces": { + "north": {"uv": [8.5, 5, 8.75, 5.25], "texture": "#0"}, + "east": {"uv": [5, 17, 7, 17.5], "texture": "#0"}, + "south": {"uv": [8.5, 5.25, 8.75, 5.5], "texture": "#0"}, + "west": {"uv": [8.5, 2.5, 9.5, 2.75], "texture": "#missing"}, + "up": {"uv": [8.75, 3.75, 8.5, 2.75], "texture": "#0"}, + "down": {"uv": [3.75, 8.5, 3.5, 9.5], "texture": "#0"} + } + }, + { + "from": [14, 10, 6], + "to": [15, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 10, 6]}, + "faces": { + "north": {"uv": [8.5, 5.5, 8.75, 5.75], "texture": "#0"}, + "east": {"uv": [3.75, 8.5, 4.75, 8.75], "texture": "#0"}, + "south": {"uv": [8.5, 5.75, 8.75, 6], "texture": "#0"}, + "up": {"uv": [8.75, 5, 8.5, 4], "texture": "#0"}, + "down": {"uv": [5, 8.5, 4.75, 9.5], "texture": "#0"} + } + }, + { + "from": [2, 13, 2], + "to": [14, 14, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 13, 1]}, + "faces": { + "north": {"uv": [8, 0, 14, 0.5], "texture": "#1"}, + "east": {"uv": [8, 0.5, 14, 1], "texture": "#1"}, + "south": {"uv": [8, 1, 14, 1.5], "texture": "#1"}, + "west": {"uv": [8, 1.5, 14, 2], "texture": "#1"}, + "up": {"uv": [6, 6, 0, 0], "texture": "#1"}, + "down": {"uv": [6, 6, 0, 12], "texture": "#1"} + } + }, + { + "from": [1, 12, 2], + "to": [2, 13, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [0, -1, 0]}, + "faces": { + "north": {"uv": [9.5, 10, 10, 10.5], "texture": "#1"}, + "east": {"uv": [7, 7, 13, 7.5], "texture": "#1"}, + "south": {"uv": [10, 9.5, 10.5, 10], "texture": "#1"}, + "west": {"uv": [7, 7.5, 13, 8], "texture": "#1"}, + "up": {"uv": [7.5, 14, 7, 8], "texture": "#1"}, + "down": {"uv": [8, 8, 7.5, 14], "texture": "#1"} + } + }, + { + "from": [14, 12, 2], + "to": [15, 13, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [13, -1, 0]}, + "faces": { + "north": {"uv": [9, 10, 9.5, 10.5], "texture": "#1"}, + "east": {"uv": [6, 6, 12, 6.5], "texture": "#1"}, + "south": {"uv": [10, 9, 10.5, 9.5], "texture": "#1"}, + "west": {"uv": [6, 6.5, 12, 7], "texture": "#1"}, + "up": {"uv": [6.5, 13, 6, 7], "texture": "#1"}, + "down": {"uv": [7, 7, 6.5, 13], "texture": "#1"} + } + }, + { + "from": [2, 12, 1], + "to": [14, 13, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 12, 0]}, + "faces": { + "north": {"uv": [6, 4, 12, 4.5], "texture": "#1"}, + "east": {"uv": [8.5, 10, 9, 10.5], "texture": "#1"}, + "south": {"uv": [6, 4.5, 12, 5], "texture": "#1"}, + "west": {"uv": [10, 8.5, 10.5, 9], "texture": "#1"}, + "up": {"uv": [12, 5.5, 6, 5], "texture": "#1"}, + "down": {"uv": [12, 5.5, 6, 6], "texture": "#1"} + } + }, + { + "from": [2, 12, 14], + "to": [14, 13, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 12, 13]}, + "faces": { + "north": {"uv": [6, 2, 12, 2.5], "texture": "#1"}, + "east": {"uv": [8, 10, 8.5, 10.5], "texture": "#1"}, + "south": {"uv": [6, 2.5, 12, 3], "texture": "#1"}, + "west": {"uv": [10, 8, 10.5, 8.5], "texture": "#1"}, + "up": {"uv": [12, 3.5, 6, 3], "texture": "#1"}, + "down": {"uv": [12, 3.5, 6, 4], "texture": "#1"} + } + }, + { + "from": [6, 14, 6], + "to": [10, 15, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 14, 7]}, + "faces": { + "north": {"uv": [8, 8, 10, 8.5], "texture": "#1"}, + "east": {"uv": [8, 8.5, 10, 9], "texture": "#1"}, + "south": {"uv": [8, 9, 10, 9.5], "texture": "#1"}, + "west": {"uv": [8, 9.5, 10, 10], "texture": "#1"}, + "up": {"uv": [8, 2, 6, 0], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "pot", + "origin": [14, 10, 6], + "color": 0, + "children": [0, 1, 2, 3, 4, 5, 6] + }, + { + "name": "lid", + "origin": [8, 14, 7], + "color": 0, + "children": [7, 8, 9, 10, 11, 12] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/item/pot_lid.json b/src/main/resources/assets/lingshi/models/item/pot_lid.json new file mode 100644 index 0000000..53409ee --- /dev/null +++ b/src/main/resources/assets/lingshi/models/item/pot_lid.json @@ -0,0 +1,116 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "0": "lingshi:block/lib", + "particle": "lingshi:block/lib" + }, + "elements": [ + { + "from": [2, 1, 2], + "to": [14, 2, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 1, 1]}, + "faces": { + "north": {"uv": [8, 0, 14, 0.5], "texture": "#0"}, + "east": {"uv": [8, 0.5, 14, 1], "texture": "#0"}, + "south": {"uv": [8, 1, 14, 1.5], "texture": "#0"}, + "west": {"uv": [8, 1.5, 14, 2], "texture": "#0"}, + "up": {"uv": [6, 6, 0, 0], "texture": "#0"}, + "down": {"uv": [6, 6, 0, 12], "texture": "#0"} + } + }, + { + "from": [1, 0, 2], + "to": [2, 1, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [0, -13, 0]}, + "faces": { + "north": {"uv": [9.5, 10, 10, 10.5], "texture": "#0"}, + "east": {"uv": [7, 7, 13, 7.5], "texture": "#0"}, + "south": {"uv": [10, 9.5, 10.5, 10], "texture": "#0"}, + "west": {"uv": [7, 8, 13, 7.5], "texture": "#0"}, + "up": {"uv": [7.5, 14, 7, 8], "texture": "#0"}, + "down": {"uv": [8, 8, 7.5, 14], "texture": "#0"} + } + }, + { + "from": [14, 0, 2], + "to": [15, 1, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [13, -13, 0]}, + "faces": { + "north": {"uv": [9, 10, 9.5, 10.5], "texture": "#0"}, + "east": {"uv": [6, 6, 12, 6.5], "texture": "#0"}, + "south": {"uv": [10, 9, 10.5, 9.5], "texture": "#0"}, + "west": {"uv": [6, 7, 12, 6.5], "texture": "#0"}, + "up": {"uv": [6.5, 13, 6, 7], "texture": "#0"}, + "down": {"uv": [7, 7, 6.5, 13], "texture": "#0"} + } + }, + { + "from": [2, 0, 1], + "to": [14, 1, 2], + "faces": { + "north": {"uv": [6, 4, 12, 4.5], "texture": "#0"}, + "east": {"uv": [8.5, 10, 9, 10.5], "texture": "#0"}, + "south": {"uv": [6, 4.5, 12, 5], "texture": "#0"}, + "west": {"uv": [10, 8.5, 10.5, 9], "texture": "#0"}, + "up": {"uv": [12, 5.5, 6, 5], "texture": "#0"}, + "down": {"uv": [12, 5.5, 6, 6], "texture": "#0"} + } + }, + { + "from": [2, 0, 14], + "to": [14, 1, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 13]}, + "faces": { + "north": {"uv": [6, 2, 12, 2.5], "texture": "#0"}, + "east": {"uv": [9.5, 10, 10, 10.5], "texture": "#0"}, + "south": {"uv": [6, 2.5, 12, 3], "texture": "#0"}, + "west": {"uv": [10, 9.5, 10.5, 10], "texture": "#0"}, + "up": {"uv": [12, 3.5, 6, 3], "texture": "#0"}, + "down": {"uv": [12, 3.5, 6, 4], "texture": "#0"} + } + }, + { + "from": [6, 2, 6], + "to": [10, 3, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 2, 7]}, + "faces": { + "north": {"uv": [8, 8, 10, 8.5], "texture": "#0"}, + "east": {"uv": [8, 8.5, 10, 9], "texture": "#0"}, + "south": {"uv": [8, 9, 10, 9.5], "texture": "#0"}, + "west": {"uv": [8, 9.5, 10, 10], "texture": "#0"}, + "up": {"uv": [8, 2, 6, 0], "texture": "#0"} + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "rotation": [180, 0, 0], + "translation": [0, -3.75, 1.5], + "scale": [0.55, 0.55, 0.55] + }, + "thirdperson_lefthand": { + "rotation": [-180, 0, 0], + "translation": [0, -3.25, 1.25], + "scale": [0.55, 0.55, 0.55] + }, + "firstperson_righthand": { + "rotation": [0, -90, -96], + "translation": [1.13, 1.45, 4.38], + "scale": [0.68, 0.68, 0.68] + }, + "firstperson_lefthand": { + "rotation": [0, -90, -96], + "translation": [1.13, 1.45, 4.38], + "scale": [0.68, 0.68, 0.68] + }, + "ground": { + "translation": [0, 2, 0], + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "rotation": [87, 0, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/textures/block/lib.png b/src/main/resources/assets/lingshi/textures/block/lib.png new file mode 100644 index 0000000000000000000000000000000000000000..0082b2a3c3cdd15a7157a185e461cb87b6469add GIT binary patch literal 404 zcmV;F0c-w=P)NF1`5FP7s4c|U+Tich|FhUU|?XdP>~@@^NBl87?9PUxbuYJh0aWp9Doj3DALWq zz_9h}Qs~$bhDR#hI#X6GIFC`#PvIF*f z&nHnwA9WotzjrdJTBz#)j_3x`G|cazt^z`(%3 zAT2IIlvz(-zF^om?sU;3Vj8=YxT=pzS#Zeq=Nqf+8a6;n3L6W#wr9C+?Ic#!pu;*2d{s0%H zNMwj|Ae7?3YR8Xvp56A{XSC1f_Rf6Y=6Roa=Xt;L&iK0Q=o<*^ZN5-s7;PUX>7L{B zB;BsH;v)&O!~lSfnrfx!@cIS-P})?l)IFY_0{|M$Ql;+9egpsnYD}f>^4eCO&jm%= zui$Yc0o(y_BMIORfE!5wcL3ZNoEOi>I`4*oG^682%ILU}GCC@X!yiu24z6SJHiXVZ z+;P5ac2=tcOp)^$u+cO}(v6%hINArjVe|wW@-pajv{+$(piQZJxjfD^PHhx?5iIxw zu&x5>bSC0>SX%meHUGCoFk85aV8K5Ek^t@ixbZ{+tY{3|b|uTTwOC<_(MdVR*Uc&n zeYWGSy>gFX9*xq312l`9e3~HXx=Yp^?GJ0bO6r?S3}mp2OSQNiEp2|G^ zEF=0GUpV~xX z{O!@v{YRG$WCm~tz>Oq;I{-lt1VIo4K@bE%5ClOG1R;;S17}#1A<}3NdH?_b07*qo IM6N<$f~6W84gdfE literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lingshi/textures/gui/container/cooking_pot.png b/src/main/resources/assets/lingshi/textures/gui/container/cooking_pot.png new file mode 100644 index 0000000000000000000000000000000000000000..2d20fe50998c52403909a396708d20225b185088 GIT binary patch literal 1619 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|GzJDXDNh&2kcv5P@7m_wPLnzC zFx-hx;0e>m5Pn<7wTi*aDJPZ%r*J#y$2RFj?iJbV#9n+_V8KkQ4l8G?mEsyz%%vCF zRU@bAOcb&Iciz}_*$1b>L-XT;o~(APGVs5^+q^8^A%0EW#LqwP{PQ>GVQW@lx+-z& z=gV1(G$u)Ao3ia@oZ+{;cb|gAvv=?GmQK0!_iwF{utxfhp9jwIZ{(T(QD(t%76v9^ z1`Zzv1p~&01LSkwxL($O@c4ND(&G~S$2HG?4(m0R>iw3t`qlg2SAG<99b=v_?f=5l zCpPIkt-QCYkgxWn*WJg5i!E7*vU5Y&9Uhmzt9EdIlqlCM>t|pI`lfdz`OeZCwtS2V z8;+$jJpO2r8hLGZ;Vdb6zl#+NpKSE^a-Gjoop09r`O3x*874-)%S@&C9k_NV32bRC zW)PUc;E=#{A#n1^B`>Et@N+n{cQT}MIvfX*TOI{BaJ;$`s6M&VyTGzr(!qZQX8|AM z3qipLAxsyP`Is%HGJI*7JHOb1vqCZS{esz-Ypv~{8!^AIu(nSH8g%ogrZg^zBn539U+3qSSzn}d6-<6dg zof|g2`f;e+uI^xKvGkkEKN*%t?fdXZsJrUj?!t6a?HfJ*p_>_23vTXr21S|Fhby_e zm;aMF^(vHMla6wxX;jZcT^QkhAFZi+V7eCPDa4hq% z#cpk;pK%SZA_PxZtd&3B*D}<2pu7~!Y+)($nW*>jYacvxvi~8EUA;05BzT^=2L5>JWUyNDz=LPc zmOY%#bpAO@g6XM0OwUF4@mWlryPv6fk;b$2cJ*HW|9yIWQ9a-8{j+Ds>={b#7%ZK# z&c4PQD0S=BhW8)8w&!OW&5Zdb%CuE-*_2CPQYQjsZ-ZpMq!!)`XTOp)BkcXR_i_3A zcki#>Ys(#B_survNJm--_!6hHK|9eZT+zo_`OOxHdmMlaRRet~%od`NLQJ z{yjZ=`zz-@SCMs>zJIr0Gk?dAKlRpJ4%>OdkN>;bzukIv+RM|kx4(9`|NA^B@x|D|g4dTlsZdAHL3i zDxb!`x#{V*#kA2rSj92CSadhi!PNpP#<`D#%Pv LS3j3^P6