Skip to content

Commit

Permalink
添加:面粉,面团,面条以及相关材质
Browse files Browse the repository at this point in the history
  • Loading branch information
MCZME committed Aug 28, 2024
1 parent b4dfb89 commit af62c3e
Show file tree
Hide file tree
Showing 27 changed files with 135 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
// 1.21 2024-08-21T06:28:09.8754652 Tags for minecraft:item mod id lingshi
// 1.21 2024-08-29T06:03:27.686323 Tags for minecraft:item mod id lingshi
1d6722e1fc6798f76ac5a0b47a05e1d66b36f99b data/lingshi/tags/item/choppingboard_tool.json
12ad13636327de1dc80f1d241b2ae2d134cb64fe data/neoforge/tags/item/dough.json
9519c03dece0e01af8a13e365d488256a3748107 data/neoforge/tags/item/flour.json
769d1ceef14cb7c493ce5e9c32d87dbc633472ba data/neoforge/tags/item/knife.json
dacf3ae14477e7f588946b39429277347e55c4f0 data/neoforge/tags/item/noodles.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// 1.21 2024-08-28T08:40:40.9896745 Item Models: lingshi
// 1.21 2024-08-29T07:08:37.9053494 Item Models: lingshi
bad0cb5e093fa42331c2d4a1157d1a7b5b3fc588 assets/lingshi/models/item/chopping_board.json
7bc27021669767547c0b0bd606195e5f80cea272 assets/lingshi/models/item/cooked_rice.json
8106af92df770f5e2062db0b6aaed967fe386d87 assets/lingshi/models/item/cooking_pot.json
1c45db1e6af3006c822037495e1197c9cd5cfb4e assets/lingshi/models/item/dough.json
37db2e9897cd20f19d58456cafcb898f113c1d4b assets/lingshi/models/item/egg_fried_rice.json
3492c131525851e1fa451f33349d2686d2ff1fc0 assets/lingshi/models/item/flour.json
014b17c43a62c41d623a0d944e434cf1ac3986be assets/lingshi/models/item/fried_egg.json
249957a6811e300efca306db358e468855851d73 assets/lingshi/models/item/iron_knife.json
8889a4deb394774a900a518a3d4849db21da3370 assets/lingshi/models/item/noodles.json
b767fc7952daf0eff3485fe4d8c06c5bba930c22 assets/lingshi/models/item/oil_bucket.json
496d711c2d4af0f851d40f859b102da69188089d assets/lingshi/models/item/rice.json
abe8ae1523c26af167289fe958382b2477d96ea1 assets/lingshi/models/item/rice_of_ear.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-08-28T08:40:40.9956752 Languages: zh_cn for mod: lingshi
f05d3fc257903f3b78dc6d4a231fd0aded91d8c7 assets/lingshi/lang/zh_cn.json
// 1.21 2024-08-29T05:56:03.5935269 Languages: zh_cn for mod: lingshi
5bdd11351b0d44fe7080a6d7c35de0b93b2adbf4 assets/lingshi/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-08-28T10:28:02.876575 Recipes
// 1.21 2024-08-29T05:56:03.5915256 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
Expand All @@ -20,6 +20,9 @@ ee50d7e3c59e644ce93e46945ff090c3c68fda04 data/lingshi/advancement/recipes/skille
0e940fa2ba82aed478ee367c4b998f0bc7ead5c3 data/lingshi/advancement/recipes/tools/iron_knife.json
e511f76246f906a279fc1ec531922d8f70dfb68c data/lingshi/advancement/recipes/tools/spatula.json
bec1047337843fdd073fe87393c3b500ae11a1de data/lingshi/recipe/chopping_board.json
dbe74c08be4c49a28a0f8bf9dd1ec1825c557d55 data/lingshi/recipe/chopping_board/dough.json
df6343e05449c8aded71e42701d18e37311ea0c9 data/lingshi/recipe/chopping_board/flour.json
771ae63028a23ade683357752f8152f0ebb2203b data/lingshi/recipe/chopping_board/noodles.json
3e41620c4ec5b19f87046dad7fe5c7ed6ede21c2 data/lingshi/recipe/chopping_board/rice.json
2bca8f59bf6fc074377fc44b2331427a96aea5d4 data/lingshi/recipe/cooking_pot.json
2e23fcd215c647e72e989050fbfe466f419bed56 data/lingshi/recipe/cooking_pot/cooked_rice.json
Expand Down
3 changes: 3 additions & 0 deletions src/generated/resources/assets/lingshi/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
"gui.lingshi.cooking_pot_menu": "烹饪锅",
"gui.lingshi.skillet_menu": "平底锅",
"item.lingshi.cooked_rice": "米饭",
"item.lingshi.dough": "面团",
"item.lingshi.egg_fried_rice": "蛋炒饭",
"item.lingshi.flour": "面粉",
"item.lingshi.fried_egg": "煎鸡蛋",
"item.lingshi.iron_knife": "铁菜刀",
"item.lingshi.noodles": "面条",
"item.lingshi.oil_bucket": "油桶",
"item.lingshi.pot_lid": "锅盖",
"item.lingshi.rice_of_ear": "稻穗",
Expand Down
6 changes: 6 additions & 0 deletions src/generated/resources/assets/lingshi/models/item/dough.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lingshi:item/dough"
}
}
6 changes: 6 additions & 0 deletions src/generated/resources/assets/lingshi/models/item/flour.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lingshi:item/flour"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lingshi:item/noodles"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "lingshi:chopping_board",
"input": {
"item": "lingshi:flour"
},
"result": [
{
"count": 1,
"id": "lingshi:dough"
}
],
"tool": {
"item": "minecraft:water_bucket"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "lingshi:chopping_board",
"input": {
"item": "minecraft:wheat"
},
"result": [
{
"count": 1,
"id": "lingshi:flour"
}
],
"tool": {
"tag": "neoforge:knife"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "lingshi:chopping_board",
"input": {
"item": "lingshi:dough"
},
"result": [
{
"count": 1,
"id": "lingshi:noodles"
}
],
"tool": {
"tag": "neoforge:knife"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"lingshi:iron_knife",
"minecraft:water_bucket"
]
}
5 changes: 5 additions & 0 deletions src/generated/resources/data/neoforge/tags/item/dough.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"lingshi:dough"
]
}
5 changes: 5 additions & 0 deletions src/generated/resources/data/neoforge/tags/item/flour.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"lingshi:flour"
]
}
5 changes: 5 additions & 0 deletions src/generated/resources/data/neoforge/tags/item/noodles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"lingshi:noodles"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.serialization.MapCodec;
import mczme.lingshi.common.block.entity.ChoppingBoardBlockEntity;
import mczme.lingshi.common.tag.NeoforgeTags;
import mczme.lingshi.common.tag.ModTags;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.Containers;
Expand Down Expand Up @@ -62,7 +62,7 @@ protected MapCodec<? extends BaseEntityBlock> codec() {
public ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHitResult) {
if (pLevel.getBlockEntity(pPos) instanceof ChoppingBoardBlockEntity blockEntity) {
if (!pStack.isEmpty()) {
if (pStack.is(NeoforgeTags.KNIFE) && !blockEntity.getTheItem().isEmpty()) {
if (pStack.is(ModTags.ChoppingBoard_TOOL) && !blockEntity.getTheItem().isEmpty()) {
List<ItemStack> stacks = blockEntity.getRecipeAndResult(pPlayer.getMainHandItem());
if (stacks == null || stacks.isEmpty()) {
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
Expand All @@ -74,7 +74,7 @@ public ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Leve
}
blockEntity.setChanged();
return ItemInteractionResult.SUCCESS;
} else if (pStack.is(NeoforgeTags.KNIFE) && blockEntity.getTheItem().isEmpty() && !pPlayer.getItemInHand(InteractionHand.OFF_HAND).isEmpty()) {
} else if (pStack.is(ModTags.ChoppingBoard_TOOL) && blockEntity.getTheItem().isEmpty() && !pPlayer.getItemInHand(InteractionHand.OFF_HAND).isEmpty()) {
blockEntity.setTheItem(pPlayer.getItemInHand(InteractionHand.OFF_HAND).consumeAndReturn(1, pPlayer));
blockEntity.setChanged();
return ItemInteractionResult.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import mczme.lingshi.common.recipe.ChoppingBoardRecipe;
import mczme.lingshi.common.registry.BlockEntityTypes;
import mczme.lingshi.common.registry.ModRecipes;
import mczme.lingshi.common.tag.NeoforgeTags;
import mczme.lingshi.common.tag.ModTags;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -69,7 +69,7 @@ public List<ItemStack> getRecipeAndResult(ItemStack tool){
if (level.isClientSide()) {
return null;
}
if(tool.is(NeoforgeTags.KNIFE)) {
if(tool.is(ModTags.ChoppingBoard_TOOL)) {
RecipeManager recipes = level.getRecipeManager();
Optional<RecipeHolder<ChoppingBoardRecipe>> optional = recipes.getRecipeFor(
ModRecipes.CHOPPING_BOARD_RECIPE.get(),
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mczme/lingshi/common/data/ItemModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ protected void registerModels() {
basicItem(ModItems.FRIED_EGG.get());
basicItem(ModItems.COOKED_RICE.get());
basicItem(ModItems.EGG_FRIED_RICE.get());
basicItem(ModItems.FLOUR.get());
basicItem(ModItems.DOUGH.get());
basicItem(ModItems.NOODLES.get());

basicItem(ModItems.OIL_BUCKET.get());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ protected void addTranslations() {

this.add(ModItems.STOVE.get(), "炉灶");
this.add(ModItems.OIL_BUCKET.get(),"油桶");

// 食物
this.add(ModItems.FRIED_EGG.get(),"煎鸡蛋");
this.add(ModItems.COOKED_RICE.get(),"米饭");
this.add(ModItems.EGG_FRIED_RICE.get(), "蛋炒饭");
this.add(ModItems.FLOUR.get(), "面粉");
this.add(ModItems.DOUGH.get(), "面团");
this.add(ModItems.NOODLES.get(), "面条");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import mczme.lingshi.common.tag.NeoforgeTags;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;

import java.util.List;
Expand All @@ -16,6 +17,9 @@ public ChoppingBoardRecipeDatagen(RecipeOutput output) {

protected void buildRecipes(RecipeOutput output) {
build(List.of(new ItemStack(ModItems.RICE.get(),3)),Ingredient.of(NeoforgeTags.KNIFE),Ingredient.of(ModItems.RICE_OF_EAR.get()),output,"rice");
build(List.of(new ItemStack(ModItems.FLOUR.get())),Ingredient.of(NeoforgeTags.KNIFE),Ingredient.of(Items.WHEAT),output,"flour");
build(List.of(new ItemStack(ModItems.DOUGH.get())),Ingredient.of(Items.WATER_BUCKET),Ingredient.of(ModItems.FLOUR.get()),output,"dough");
build(List.of(new ItemStack(ModItems.NOODLES.get())),Ingredient.of(NeoforgeTags.KNIFE),Ingredient.of(ModItems.DOUGH.get()),output,"noodles");
}

private void build(List<ItemStack> result, Ingredient tool, Ingredient inputItem,RecipeOutput output,String pid){
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/mczme/lingshi/common/data/tag/ItemTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

import static mczme.lingshi.common.tag.ModTags.*;
import static mczme.lingshi.common.tag.NeoforgeTags.*;

public class ItemTags extends ItemTagsProvider {
Expand All @@ -24,5 +26,10 @@ public ItemTags(PackOutput pOutput, CompletableFuture<HolderLookup.Provider> pLo
@Override
protected void addTags(HolderLookup.@NotNull Provider pProvider) {
this.tag(KNIFE).add(ModItems.IRON_KNIFE.get());
this.tag(ChoppingBoard_TOOL).add(ModItems.IRON_KNIFE.get(), Items.WATER_BUCKET);

this.tag(FLOUR).add(ModItems.FLOUR.get());
this.tag(DOUGH).add(ModItems.DOUGH.get());
this.tag(NOODLES).add(ModItems.NOODLES.get());
}
}
5 changes: 4 additions & 1 deletion src/main/java/mczme/lingshi/common/registry/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ public class ModItems {

public static final Supplier<Item> STOVE = registerWithCreateTab("stove", () -> new BlockItem(ModBlocks.STOVE.get(), new Item.Properties()));
public static final Supplier<Item> OIL_BUCKET = registerWithCreateTab("oil_bucket", () -> new BucketItem(ModFluids.OIL_SOURCE.get(), new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1)));

//食物
public static final Supplier<Item> STRANGE_FOOD = registerWithCreateTab("strange_food", () -> new Item(new Item.Properties()));
public static final Supplier<Item> FRIED_EGG = registerWithCreateTab("fried_egg", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).saturationModifier(3.2f).build())));
public static final Supplier<Item> COOKED_RICE = registerWithCreateTab("cooked_rice", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).usingConvertsTo(Items.BOWL).saturationModifier(4f).build())));
public static final Supplier<Item> EGG_FRIED_RICE = registerWithCreateTab("egg_fried_rice", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(8).usingConvertsTo(Items.BOWL).saturationModifier(7.2f).build())));
public static final Supplier<Item> FLOUR = registerWithCreateTab("flour", () -> new Item(new Item.Properties()));
public static final Supplier<Item> DOUGH = registerWithCreateTab("dough", () -> new Item(new Item.Properties()));
public static final Supplier<Item> NOODLES = registerWithCreateTab("noodles", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(1f).build())));

private static Supplier<Item> registerWithCreateTab(String item_name, Supplier<Item> itemSupplier) {
Supplier<Item> item = ITEMS.register(item_name, itemSupplier);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mczme/lingshi/common/tag/ModTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;

public class ModTags {

public static final TagKey<Block> HEAT_SOURCE = modTag(Registries.BLOCK, "heat_source");
public static final TagKey<Block> CAN_SUPPORT = modTag(Registries.BLOCK, "can_support");

public static final TagKey<Item> ChoppingBoard_TOOL = modTag(Registries.ITEM, "choppingboard_tool");

private static <T> TagKey<T> modTag(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> pRegistry, String name) {
return TagKey.create(pRegistry, ResourceLocation.fromNamespaceAndPath(lingshi.MODID, name));
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mczme/lingshi/common/tag/NeoforgeTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
public class NeoforgeTags {

public static final TagKey<Item> KNIFE = neoforgeTag(Registries.ITEM, "knife");
public static final TagKey<Item> FLOUR = neoforgeTag(Registries.ITEM, "flour");
public static final TagKey<Item> DOUGH = neoforgeTag(Registries.ITEM, "dough");
public static final TagKey<Item> NOODLES = neoforgeTag(Registries.ITEM, "noodles");

private static <T> TagKey<T> neoforgeTag(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> pRegistry, String name) {
return TagKey.create(pRegistry, ResourceLocation.fromNamespaceAndPath("neoforge", name));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit af62c3e

Please sign in to comment.