Skip to content

Commit

Permalink
添加:煎鱼 调整data文件结构 修复hud问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MCZME committed Sep 11, 2024
1 parent 7cc9891 commit cd00321
Show file tree
Hide file tree
Showing 35 changed files with 467 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-09-09T22:04:36.2459739 Item Models: lingshi
// 1.21 2024-09-11T16:41:07.9791561 Item Models: lingshi
14f86299910462582d98bcf699b35e34c615ee8e assets/lingshi/models/item/cabbage.json
0e18f939d46f6a164584f621fa97b024122785d9 assets/lingshi/models/item/cabbage_leaf.json
0bcbbc8c3377f7b20a37790cc33d36690c2044c7 assets/lingshi/models/item/cabbage_seed.json
Expand All @@ -10,6 +10,7 @@ a2eecf0a3a6c93ab1c418b7953b4080059274277 assets/lingshi/models/item/egg_added_st
37db2e9897cd20f19d58456cafcb898f113c1d4b assets/lingshi/models/item/egg_fried_rice.json
3492c131525851e1fa451f33349d2686d2ff1fc0 assets/lingshi/models/item/flour.json
014b17c43a62c41d623a0d944e434cf1ac3986be assets/lingshi/models/item/fried_egg.json
4d872e0d2b22e00bc1e83385ec690b91852ac799 assets/lingshi/models/item/fried_fish.json
bb65673aded0d1674c4329547af6263f100a1e6b assets/lingshi/models/item/glass_jar.json
249957a6811e300efca306db358e468855851d73 assets/lingshi/models/item/iron_knife.json
8889a4deb394774a900a518a3d4849db21da3370 assets/lingshi/models/item/noodles.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-09-08T13:11:17.1194972 Languages: zh_cn for mod: lingshi
c3200bf00b6b972fe1d324853da84e5a4d632b71 assets/lingshi/lang/zh_cn.json
// 1.21 2024-09-11T16:41:07.985159 Languages: zh_cn for mod: lingshi
3af0560adaf650552afc0d5598a33c18ef001aed assets/lingshi/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-09-06T08:35:30.5005652 Recipes
// 1.21 2024-09-11T16:41:07.9821614 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 @@ -7,6 +7,7 @@ d918a2369d899974ffa38d6a363553af9e97fdee data/lingshi/advancement/recipes/cookin
b324dfe8c51c5f2f94e08473d966192d14d40c5a data/lingshi/advancement/recipes/cooking_pot/stewed_noodles.json
6a319c97da924f9ab21b5d264c18cb8ad9da8755 data/lingshi/advancement/recipes/decorations/chopping_board.json
316ee6a89da986357d408cff58db9554636fc16a data/lingshi/advancement/recipes/decorations/cooking_pot.json
6590069c0dd94d0c627ade3700b0e59d995c7826 data/lingshi/advancement/recipes/decorations/glass_jar.json
0486b842988b1d1ac0abb797a91d26077583679e data/lingshi/advancement/recipes/decorations/pot_lid.json
0a4b54bfda8aa98f1a26bbf1d8231c76ed12e770 data/lingshi/advancement/recipes/decorations/skillet.json
129f0de548d7a7b62ee9dcaeb54da65d7095a009 data/lingshi/advancement/recipes/decorations/stove.json
Expand All @@ -21,6 +22,7 @@ de37dcaf7e9f79459492cd69ddb81d8d27406f99 data/lingshi/advancement/recipes/skille
7a6163420d51a47990b3415927969c8a83ee97ac data/lingshi/advancement/recipes/skillet/egg_added_stewed_noodles.json
e6b8f09f653cc6c1180feb64eaf5b196543ae4f7 data/lingshi/advancement/recipes/skillet/egg_fried_rice.json
ee50d7e3c59e644ce93e46945ff090c3c68fda04 data/lingshi/advancement/recipes/skillet/fried_egg.json
80e9965c7ee31089a18f9c11cfbb08bdc5b1c090 data/lingshi/advancement/recipes/skillet/fried_fish.json
e241bb59f1e7d265a9afbd0f38efdc05d5b325eb data/lingshi/advancement/recipes/skillet/sauteed_seasonal_vegetable.json
47116fef6fadd5ebb9231aee1717b2830949e776 data/lingshi/advancement/recipes/skillet/stewed_noodles.json
0e940fa2ba82aed478ee367c4b998f0bc7ead5c3 data/lingshi/advancement/recipes/tools/iron_knife.json
Expand All @@ -38,6 +40,7 @@ d0f1076aaf14e4191918a911196f1aeac7d7a59d data/lingshi/recipe/cooking_pot/cooked_
9f2a57c63666f89853bc85b73416c4172f4c17bf data/lingshi/recipe/cooking_pot/egg_added_stewed_noodles.json
62d3840084dd51eb8b305821add2a3daf75d976d data/lingshi/recipe/cooking_pot/pork_feet_rice.json
5cf82cc1c760154fd4fc1c686cae448e40a60903 data/lingshi/recipe/cooking_pot/stewed_noodles.json
6939bc4dbaf8516c0f496369032353a353704949 data/lingshi/recipe/glass_jar.json
e6daac4cca245fc9e220e2fcb1f2b27e410ba503 data/lingshi/recipe/iron_knife.json
dba470601fa51254c73ae3c63fa858de333a48c2 data/lingshi/recipe/pot_lid.json
a0c7fd85028ea7997689d7bc093b9d025c522ea6 data/lingshi/recipe/skillet.json
Expand All @@ -51,7 +54,8 @@ c60918f7fafeb03f1c8244417c151ea7a5e44a31 data/lingshi/recipe/skillet/cooked_rabb
e72067c16cd3f5e2ec6a11abb0c7a9e41d3e3fd4 data/lingshi/recipe/skillet/cooked_salmon.json
f135d354583075761e6a774f9007cc9c0c377409 data/lingshi/recipe/skillet/egg_added_stewed_noodles.json
88b7de6efd83a1065897ffe5447d6cbba14e9123 data/lingshi/recipe/skillet/egg_fried_rice.json
0c39fdabe7970065856b4adc9e9f3eae7690ea2d data/lingshi/recipe/skillet/fried_egg.json
94e2e5b3687b5e2dcbf9cb99fd817ebcb8a3580d data/lingshi/recipe/skillet/fried_egg.json
fe5d9e40862da49ec28457afb189103da4288249 data/lingshi/recipe/skillet/fried_fish.json
140dcebcd3163fc850baf9601ea2e9364f4b0437 data/lingshi/recipe/skillet/sauteed_seasonal_vegetable.json
fdba5b9f3c24313b753271e755d317990919bc07 data/lingshi/recipe/skillet/stewed_noodles.json
3563171190654e76637de2fa78a6c750389674d7 data/lingshi/recipe/spatula.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// 1.21 2024-09-08T13:11:17.1214938 Block States: lingshi
// 1.21 2024-09-11T16:41:07.9871608 Block States: lingshi
c5265867b72222a7b9a0c319c8593c91a69953ab assets/lingshi/blockstates/chopping_board.json
5a97e2294b02d54bf2ea8ebde233dfde1f678cd2 assets/lingshi/blockstates/fried_fish.json
853092c1c42ba5c9b5c021b2035d8ea9b6d813cb assets/lingshi/blockstates/glass_jar.json
cf0f8d1e27a4b3d6af3697ad29c93125328b6213 assets/lingshi/blockstates/sauteed_seasonal_vegetable.json
34 changes: 34 additions & 0 deletions src/generated/resources/assets/lingshi/blockstates/fried_fish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"variants": {
"amount=0,facing=east": {
"model": "lingshi:block/plate",
"y": 270
},
"amount=0,facing=north": {
"model": "lingshi:block/plate",
"y": 180
},
"amount=0,facing=south": {
"model": "lingshi:block/plate"
},
"amount=0,facing=west": {
"model": "lingshi:block/plate",
"y": 90
},
"amount=1,facing=east": {
"model": "lingshi:block/fried_fish",
"y": 270
},
"amount=1,facing=north": {
"model": "lingshi:block/fried_fish",
"y": 180
},
"amount=1,facing=south": {
"model": "lingshi:block/fried_fish"
},
"amount=1,facing=west": {
"model": "lingshi:block/fried_fish",
"y": 90
}
}
}
1 change: 1 addition & 0 deletions src/generated/resources/assets/lingshi/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"block.lingshi.cabbage": "白菜种子",
"block.lingshi.chopping_board": "砧板",
"block.lingshi.cooking_pot": "烹饪锅",
"block.lingshi.fried_fish": "煎鱼",
"block.lingshi.glass_jar": "玻璃罐",
"block.lingshi.pork_feet_rice": "猪脚饭",
"block.lingshi.rice": "稻米",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lingshi:item/fried_fish"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_glass_panes": {
"conditions": {
"items": [
{
"items": "#c:glass_panes"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "lingshi:glass_jar"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_glass_panes"
]
],
"rewards": {
"recipes": [
"lingshi:glass_jar"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_skillet": {
"conditions": {
"items": [
{
"items": "lingshi:skillet"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "lingshi:skillet/fried_fish"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_skillet"
]
],
"rewards": {
"recipes": [
"lingshi:skillet/fried_fish"
]
}
}
21 changes: 21 additions & 0 deletions src/generated/resources/data/lingshi/recipe/glass_jar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"A": {
"tag": "minecraft:wooden_slabs"
},
"X": {
"tag": "c:glass_panes"
}
},
"pattern": [
" A ",
"X X",
" X "
],
"result": {
"count": 1,
"id": "lingshi:glass_jar"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "lingshi:skillet",
"fluid": {
"amount": 100,
"amount": 250,
"id": "lingshi:oil_source"
},
"group": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "lingshi:skillet",
"container": {
"container": {
"count": 1,
"id": "minecraft:bowl"
},
"stir_fry_count": 1
},
"fluid": {
"amount": 250,
"id": "lingshi:oil_source"
},
"group": "",
"ingredients": [
{
"item": "minecraft:cod"
}
],
"label": "pan_fry",
"result": {
"count": 1,
"id": "lingshi:fried_fish"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) {
tag.put("result", result.save(pRegistries));
}
tag.putInt("count", stewingTime);
tag.putInt("stew_time", stewTime);
return tag;
}

Expand All @@ -225,6 +226,7 @@ protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistrie
result = ItemStack.EMPTY;
}
stewingTime = pTag.getInt("count");
stewTime = pTag.getInt("stew_time");
}

@Override
Expand All @@ -239,6 +241,7 @@ protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistrie
pTag.put("result", result.save(pRegistries));
}
pTag.putInt("count", stewingTime);
pTag.putInt("stew_time",stewTime);
}

private void saveCookingTime(CompoundTag nbt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ 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,1);
private final CookingItemStackHandler itemStackHandler = new CookingItemStackHandler(MAX_SLOT + 2, 1);

private final int[] cookingTime = new int[MAX_SLOT + 1];
public int stirFryCount = 0;
public int stirFry =0;
public int stirFry = 0;
public ItemStack result = ItemStack.EMPTY;


Expand Down Expand Up @@ -150,7 +150,7 @@ public int getMAX() {
}

@Override
public int getMaxAmount(){
public int getMaxAmount() {
return 250;
}

Expand All @@ -171,6 +171,7 @@ public Packet<ClientGamePacketListener> getUpdatePacket() {
tag.put("result", result.save(pRegistries));
}
tag.putInt("count", stirFryCount);
tag.putInt("stir_fry", stirFry);
return tag;
}

Expand All @@ -191,6 +192,7 @@ protected void loadAdditional(CompoundTag pTag, HolderLookup.@NotNull Provider p
result = ItemStack.EMPTY;
}
stirFryCount = pTag.getInt("count");
stirFry = pTag.getInt("stir_fry");
}

@Override
Expand All @@ -205,6 +207,7 @@ protected void saveAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull P
pTag.put("result", result.save(pRegistries));
}
pTag.putInt("count", stirFryCount);
pTag.putInt("stir_fry", stirFry);
}

private void saveCookingTime(CompoundTag nbt) {
Expand Down Expand Up @@ -245,7 +248,7 @@ public static <T extends BlockEntity> void serverTick(Level pLevel, BlockPos pPo
if (!flag) {
int cookedTime = 0, burntTime = 0;
int cooked_size = 0, burnt_size = 0;
boolean fluid_heated= blockEntity.getFluid().isEmpty();
boolean fluid_heated = blockEntity.getFluid().isEmpty();
// cookProgress
for (int i = 0; i < MAX_SLOT + 1; i++) {
// fluid
Expand Down Expand Up @@ -299,21 +302,22 @@ public static <T extends BlockEntity> void serverTick(Level pLevel, BlockPos pPo
blockEntity.stirFry = optional.map(RecipeHolder::value)
.map(e -> e.getContainer().stirFryCount())
.orElse(0);

if (cooked_size == blockEntity.size() && blockEntity.stirFryCount >= blockEntity.stirFry && !blockEntity.result.isEmpty() && fluid_heated) {
itemStackHandler.setStackInSlot(5, optional.map(RecipeHolder::value)
.map(e -> e.getContainer().container())
.orElse(ItemStack.EMPTY));
if(itemStackHandler.getStackInSlot(5).isEmpty()){
itemStackHandler.setStackInSlot(5,new ItemStack(ModItems.SPATULA.get()));
if (itemStackHandler.getStackInSlot(5).isEmpty()) {
itemStackHandler.setStackInSlot(5, new ItemStack(ModItems.SPATULA.get()));
}
itemStackHandler.setStackInSlot(6,blockEntity.result);
itemStackHandler.setStackInSlot(6, blockEntity.result);
} else if (burnt_size > 0) {
blockEntity.result = new ItemStack(ModItems.STRANGE_FOOD.get());
itemStackHandler.setStackInSlot(5,new ItemStack(ModItems.SPATULA.get()));
itemStackHandler.setStackInSlot(5, new ItemStack(ModItems.SPATULA.get()));
}
} else {
blockEntity.clearTime();
itemStackHandler.setStackInSlot(5,ItemStack.EMPTY);
itemStackHandler.setStackInSlot(5, ItemStack.EMPTY);
blockEntity.result = ItemStack.EMPTY;
blockEntity.stirFryCount = 0;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/mczme/lingshi/common/registry/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class ModBlocks {
public static final Supplier<FoodBlock> PORK_FEET_RICE = BLOCKS.register("pork_feet_rice", () -> new FoodBlock(BlockBehaviour.Properties.of().destroyTime(0.3F)));
public static final Supplier<PlateFoodBlock> SAUTEED_SEASONAL_VEGETABLE = BLOCKS.register("sauteed_seasonal_vegetable", () -> new PlateFoodBlock(BlockBehaviour.Properties.of().destroyTime(0.3F)));
public static final Supplier<StewedNoodles> STEWED_NOODLES = BLOCKS.register("stewed_noodles", () -> new StewedNoodles(BlockBehaviour.Properties.of().destroyTime(0.3F)));
public static final Supplier<FoodBlock> FRIED_FISH = BLOCKS.register("fried_fish", () -> new PlateFoodBlock(BlockBehaviour.Properties.of().destroyTime(0.3F)));

public static void register(IEventBus modEventBus) {
BLOCKS.register(modEventBus);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mczme/lingshi/common/registry/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public class ModItems {
.component(ITEM_NAME, Component.translatable("item.lingshi.egg_added_stewed_noodles"))));
public static final Supplier<Item> STEWED_NOODLES = registerWithCreateTab("stewed_noodles", () -> new FoodBlockItem(ModBlocks.STEWED_NOODLES.get(), new Item.Properties()
.food(new FoodProperties.Builder().usingConvertsTo(Items.BOWL).nutrition(6).saturationModifier(5f).build())));
public static final Supplier<Item> FRIED_FISH = registerWithCreateTab("fried_fish", () -> new FoodBlockItem(ModBlocks.FRIED_FISH.get(), new Item.Properties()
.food(new FoodProperties.Builder().usingConvertsTo(Items.BOWL).nutrition(6).saturationModifier(6f)
.effect(() -> new MobEffectInstance(MobEffects.REGENERATION, 2 * 20, 0), 1.0F).build())));

private static Supplier<Item> registerWithCreateTab(String item_name, Supplier<Item> itemSupplier) {
Supplier<Item> item = ITEMS.register(item_name, itemSupplier);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mczme.lingshi.common.data;
package mczme.lingshi.data;

import mczme.lingshi.common.registry.ModBlocks;
import mczme.lingshi.lingshi;
Expand Down Expand Up @@ -27,6 +27,7 @@ protected void registerStatesAndModels() {
horizontalBlock(ModBlocks.CHOPPING_BOARD.get(), "block/chopping_board");
horizontalBlock(ModBlocks.SAUTEED_SEASONAL_VEGETABLE.get(),"block/plate","block/sauteed_seasonal_vegetable");
// horizontalBlock(ModBlocks.STEWED_NOODLES.get(),"block/bowl","block/sauteed_seasonal_vegetable");
horizontalBlock(ModBlocks.FRIED_FISH.get(),"block/plate","block/fried_fish");

simpleBlock(ModBlocks.GLASS_JAR.get(),modelFile("block/glass_jar"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mczme.lingshi.common.data;
package mczme.lingshi.data;

import mczme.lingshi.common.datamap.ingredient.CookingFoodData;
import mczme.lingshi.common.registry.ModFluids;
Expand Down
Loading

0 comments on commit cd00321

Please sign in to comment.