generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MCZME
committed
Sep 15, 2024
1 parent
f4b5261
commit 69977db
Showing
18 changed files
with
190 additions
and
14 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/generated/resources/.cache/71e72dbdeb626cc835aaccd2ae47fd3d8794cd24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.21 2024-09-13T20:55:00.8873792 Languages: zh_cn for mod: lingshi | ||
2e1b4e1f1d8cbf6dafcf7443382ad9b22630f6c0 assets/lingshi/lang/zh_cn.json | ||
// 1.21 2024-09-15T11:59:51.5147636 Languages: zh_cn for mod: lingshi | ||
7f40641f62247679c64effe607911965a80fb96f assets/lingshi/lang/zh_cn.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/lingshi/models/item/buns_filled_with_cabbage_and_pork.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "lingshi:item/buns_filled_with_cabbage_and_pork" | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...ed/resources/data/lingshi/advancement/recipes/food/buns_filled_with_cabbage_and_pork.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"parent": "minecraft:recipes/root", | ||
"criteria": { | ||
"has_dough": { | ||
"conditions": { | ||
"items": [ | ||
{ | ||
"items": "lingshi:dough" | ||
} | ||
] | ||
}, | ||
"trigger": "minecraft:inventory_changed" | ||
}, | ||
"has_the_recipe": { | ||
"conditions": { | ||
"recipe": "lingshi:buns_filled_with_cabbage_and_pork" | ||
}, | ||
"trigger": "minecraft:recipe_unlocked" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"has_the_recipe", | ||
"has_dough" | ||
] | ||
], | ||
"rewards": { | ||
"recipes": [ | ||
"lingshi:buns_filled_with_cabbage_and_pork" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/generated/resources/data/lingshi/recipe/buns_filled_with_cabbage_and_pork.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"type": "minecraft:crafting_shapeless", | ||
"category": "misc", | ||
"ingredients": [ | ||
{ | ||
"item": "lingshi:dough" | ||
}, | ||
{ | ||
"item": "lingshi:sliced_pork" | ||
}, | ||
{ | ||
"tag": "neoforge:crops/cabbage" | ||
} | ||
], | ||
"result": { | ||
"count": 4, | ||
"id": "lingshi:buns_filled_with_cabbage_and_pork" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package mczme.lingshi.common.datacomponent; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import io.netty.buffer.ByteBuf; | ||
import net.minecraft.network.codec.ByteBufCodecs; | ||
import net.minecraft.network.codec.StreamCodec; | ||
|
||
import java.util.Objects; | ||
|
||
public class Eat { | ||
|
||
public boolean eat = false; | ||
|
||
public static final Codec<Eat> BASIC_CODEC = RecordCodecBuilder.create(instance -> | ||
instance.group( | ||
Codec.BOOL.fieldOf("getEat").forGetter(Eat::getEat) | ||
).apply(instance, Eat::new) | ||
); | ||
public static final StreamCodec<ByteBuf, Eat> BASIC_STREAM_CODEC = StreamCodec.composite( | ||
ByteBufCodecs.BOOL, Eat::getEat, | ||
Eat::new | ||
); | ||
|
||
public Eat(boolean eat) { | ||
this.eat = eat; | ||
} | ||
|
||
public Boolean getEat() { | ||
return eat; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(this.eat); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == this) { | ||
return true; | ||
} else { | ||
return obj instanceof Eat ex | ||
&& this.eat == ex.eat; | ||
} | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/mczme/lingshi/common/item/ConditionalFood.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package mczme.lingshi.common.item; | ||
|
||
import mczme.lingshi.common.datacomponent.Eat; | ||
import mczme.lingshi.common.registry.ModDataComponents; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResultHolder; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.food.FoodProperties; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class ConditionalFood extends Item { | ||
public ConditionalFood(Properties pProperties) { | ||
super(pProperties.component(ModDataComponents.EAT,new Eat(false))); | ||
} | ||
|
||
@Override | ||
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) { | ||
ItemStack itemstack = pPlayer.getItemInHand(pUsedHand); | ||
FoodProperties foodproperties = itemstack.getFoodProperties(pPlayer); | ||
Eat eat = itemstack.get(ModDataComponents.EAT); | ||
if (foodproperties != null && eat != null && eat.getEat()) { | ||
if (pPlayer.canEat(foodproperties.canAlwaysEat())) { | ||
pPlayer.startUsingItem(pUsedHand); | ||
return InteractionResultHolder.consume(itemstack); | ||
} else { | ||
return InteractionResultHolder.fail(itemstack); | ||
} | ||
} else { | ||
return InteractionResultHolder.pass(pPlayer.getItemInHand(pUsedHand)); | ||
} | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/mczme/lingshi/common/registry/ModDataComponents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package mczme.lingshi.common.registry; | ||
|
||
import mczme.lingshi.common.datacomponent.Eat; | ||
import mczme.lingshi.lingshi; | ||
import net.minecraft.core.component.DataComponentType; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.neoforge.registries.DeferredHolder; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
|
||
public class ModDataComponents { | ||
public static final DeferredRegister.DataComponents REGISTRAR = DeferredRegister.createDataComponents(lingshi.MODID); | ||
|
||
public static final DeferredHolder<DataComponentType<?>, DataComponentType<Eat>> EAT = REGISTRAR.registerComponentType( | ||
"eat", | ||
builder -> builder | ||
.persistent(Eat.BASIC_CODEC) | ||
.networkSynchronized(Eat.BASIC_STREAM_CODEC) | ||
); | ||
|
||
public static void register(IEventBus modEventBus) { | ||
REGISTRAR.register(modEventBus); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+298 Bytes
...in/resources/assets/lingshi/textures/item/buns_filled_with_cabbage_and_pork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-37 Bytes
(89%)
src/main/resources/assets/lingshi/textures/item/soybean_milk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.