Skip to content

Commit

Permalink
添加:猪蹄和修改战利品表,修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MCZME committed Aug 29, 2024
1 parent af62c3e commit 550e85a
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 99 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-08-29T07:08:37.9053494 Item Models: lingshi
// 1.21 2024-08-30T00:38:36.78528 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
Expand All @@ -9,6 +9,7 @@ bad0cb5e093fa42331c2d4a1157d1a7b5b3fc588 assets/lingshi/models/item/chopping_boa
249957a6811e300efca306db358e468855851d73 assets/lingshi/models/item/iron_knife.json
8889a4deb394774a900a518a3d4849db21da3370 assets/lingshi/models/item/noodles.json
b767fc7952daf0eff3485fe4d8c06c5bba930c22 assets/lingshi/models/item/oil_bucket.json
8a787e79ccb05e02b90ea12cfed0a54b8fda4bf5 assets/lingshi/models/item/pig_feet.json
496d711c2d4af0f851d40f859b102da69188089d assets/lingshi/models/item/rice.json
abe8ae1523c26af167289fe958382b2477d96ea1 assets/lingshi/models/item/rice_of_ear.json
57cfb1f90de649ab0f56f107cb56e1d0d2f87ae6 assets/lingshi/models/item/rice_seedling.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-08-29T05:56:03.5935269 Languages: zh_cn for mod: lingshi
5bdd11351b0d44fe7080a6d7c35de0b93b2adbf4 assets/lingshi/lang/zh_cn.json
// 1.21 2024-08-30T00:17:04.375195 Languages: zh_cn for mod: lingshi
12b7b8f4abc406cbe0975e45310e1a78e62f7caa assets/lingshi/lang/zh_cn.json
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 @@ -16,6 +16,7 @@
"item.lingshi.iron_knife": "铁菜刀",
"item.lingshi.noodles": "面条",
"item.lingshi.oil_bucket": "油桶",
"item.lingshi.pig_feet": "猪蹄",
"item.lingshi.pot_lid": "锅盖",
"item.lingshi.rice_of_ear": "稻穗",
"item.lingshi.spatula": "锅铲",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lingshi:item/pig_feet"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

import static mczme.lingshi.common.block.RiceSeedlingBlock.EMERGE;
import static mczme.lingshi.common.block.RiceSeedlingBlock.WATERLOGGED;

public class RiceSeedlingTopBlock extends CropBlock {
Expand Down Expand Up @@ -53,7 +54,7 @@ public void performBonemeal(ServerLevel pLevel, RandomSource pRandom, BlockPos p
}
pLevel.setBlock(pPos, this.getStateForAge(i), 2);
if (i == 4) {
pLevel.setBlockAndUpdate(pPos.below(), pLevel.getBlockState(pPos.below()).setValue(WATERLOGGED, false));
pLevel.setBlockAndUpdate(pPos.below(), pLevel.getBlockState(pPos.below()).setValue(WATERLOGGED, false).setValue(EMERGE,true));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected CookingFoodDataGen(PackOutput packOutput, CompletableFuture<HolderLook

@Override
protected void gather() {
addCookingFood(ModItems.RICE,10,20);
addCookingFood(ModItems.RICE,8,25);
addCookingFood(Items.POTATO,5,25);
addCookingFood(Items.BEEF,5,20);
addCookingFood(Items.PORKCHOP,5,20);
Expand All @@ -36,7 +36,8 @@ protected void gather() {
addCookingFood(Items.RABBIT,5,20);
addCookingFood(Items.COD,5,20);
addCookingFood(Items.SALMON,5,20);
addCookingFood(Items.EGG,3,15);
addCookingFood(Items.EGG,3,12);
addCookingFood(ModItems.PIG_FEET,8,20);

addCookingFood(Fluids.WATER,15);
builder(COOKING_FOOD_FLUID).add(ModFluids.OIL_SOURCE.get().builtInRegistryHolder(), new CookingFoodData(8,30),false);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mczme/lingshi/common/data/ItemModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected void registerModels() {
basicItem(ModItems.FLOUR.get());
basicItem(ModItems.DOUGH.get());
basicItem(ModItems.NOODLES.get());
basicItem(ModItems.PIG_FEET.get());

basicItem(ModItems.OIL_BUCKET.get());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected void addTranslations() {
this.add(ModItems.FLOUR.get(), "面粉");
this.add(ModItems.DOUGH.get(), "面团");
this.add(ModItems.NOODLES.get(), "面条");
this.add(ModItems.PIG_FEET.get(), "猪蹄");

}
}
15 changes: 1 addition & 14 deletions src/main/java/mczme/lingshi/common/event/Registry.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package mczme.lingshi.common.event;

import mczme.lingshi.common.network.CookingData;
import mczme.lingshi.common.network.CookingDataClientPayloadHandler;
import mczme.lingshi.common.network.CookingDataServerPayloadHandler;
import mczme.lingshi.lingshi;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
import net.neoforged.neoforge.network.handling.DirectionalPayloadHandler;
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
import net.neoforged.neoforge.registries.datamaps.RegisterDataMapTypesEvent;

import static mczme.lingshi.common.datamap.DataMapTypes.*;
Expand All @@ -33,15 +28,7 @@ private static void registerCapabilities(RegisterCapabilitiesEvent event) {
// network
@SubscribeEvent
public static void registerPayloadHandlers(final RegisterPayloadHandlersEvent event) {
final PayloadRegistrar registrar = event.registrar("cooking_data");
registrar.playBidirectional(
CookingData.TYPE,
CookingData.STREAM_CODEC,
new DirectionalPayloadHandler<>(
CookingDataClientPayloadHandler::handleData,
CookingDataServerPayloadHandler::handleData
)
);

}

}
25 changes: 0 additions & 25 deletions src/main/java/mczme/lingshi/common/network/CookingData.java

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions src/main/java/mczme/lingshi/common/registry/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class ModItems {
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())));
public static final Supplier<Item> PIG_FEET = registerWithCreateTab("pig_feet", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(5).saturationModifier(3f).build())));

private static Supplier<Item> registerWithCreateTab(String item_name, Supplier<Item> itemSupplier) {
Supplier<Item> item = ITEMS.register(item_name, itemSupplier);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"animation": {
"frametime": 15,
"interpolate": true,
"frames": [0, 1, 2, 1]
}
}
Binary file modified src/main/resources/assets/lingshi/textures/item/noodles.png
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{"type": "neoforge:add_table",
"conditions": [
{
"condition": "minecraft:all_of",
"terms": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:pig"
}
},
{
"condition": "minecraft:killed_by_player",
"inverse": true
}
]
}
],
"table": "lingshi:entities/pig_feet"
}
32 changes: 32 additions & 0 deletions src/main/resources/data/lingshi/loot_table/entities/pig_feet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"type": "minecraft:entity",
"pools": [
{
"rolls": {
"min": 1,
"max": 4
},
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:item",
"name": "lingshi:pig_feet"
}
],
"conditions": [
{
"condition": "minecraft:entity_properties",
"entity": "attacking_player",
"predicate": {
"equipment": {
"mainhand": {
"items": "#neoforge:knife"
}
}
}
}
]
}
],
"random_sequence": "minecraft:entities/pig"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"entries": [
"lingshi:add_item_pig_feet_to_pig"
]
}

0 comments on commit 550e85a

Please sign in to comment.