diff --git a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 index 068733c..eef8c5b 100644 --- a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 +++ b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 @@ -1,2 +1,2 @@ -// 1.21 2024-08-08T18:35:43.0608317 Languages: zh_cn for mod: lingshi -4da2b2e0b4727bd49396896000019baab4eb2e48 assets/lingshi/lang/zh_cn.json +// 1.21 2024-08-11T20:03:29.7270915 Languages: zh_cn for mod: lingshi +ceb883a13057e1c30eaabbc27de7a3819e5e58b5 assets/lingshi/lang/zh_cn.json diff --git a/src/generated/resources/.cache/d88813880ae3e40e9724fa9bc86e438c1f5ddb3d b/src/generated/resources/.cache/d88813880ae3e40e9724fa9bc86e438c1f5ddb3d index 4106df1..d3e9368 100644 --- a/src/generated/resources/.cache/d88813880ae3e40e9724fa9bc86e438c1f5ddb3d +++ b/src/generated/resources/.cache/d88813880ae3e40e9724fa9bc86e438c1f5ddb3d @@ -1,2 +1,3 @@ -// 1.21 2024-08-10T17:02:48.5453931 Tags for minecraft:block mod id lingshi +// 1.21 2024-08-11T19:15:15.9707849 Tags for minecraft:block mod id lingshi +8f3ae1f87856cf69d686ec0be92f6b700f51bd30 data/lingshi/tags/block/heat_source.json e00d57f2828f9f55903e8c8c9f4b95dfeca4135d data/minecraft/tags/block/mineable/axe.json diff --git a/src/generated/resources/assets/lingshi/lang/zh_cn.json b/src/generated/resources/assets/lingshi/lang/zh_cn.json index cdf7b64..535ad79 100644 --- a/src/generated/resources/assets/lingshi/lang/zh_cn.json +++ b/src/generated/resources/assets/lingshi/lang/zh_cn.json @@ -3,6 +3,7 @@ "block.lingshi.rice": "稻米", "block.lingshi.rice_seedling": "稻苗", "block.lingshi.tea_tree": "茶树", + "item.lingshi.iron_knife": "铁菜刀", "item.lingshi.rice_of_ear": "稻穗", "item.lingshi.tea_leaf": "茶叶", "lingshi.lingshi_tab": "灵食" diff --git a/src/generated/resources/data/lingshi/tags/block/heat_source.json b/src/generated/resources/data/lingshi/tags/block/heat_source.json new file mode 100644 index 0000000..a2d2fb8 --- /dev/null +++ b/src/generated/resources/data/lingshi/tags/block/heat_source.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:campfire", + "minecraft:magma_block" + ] +} \ No newline at end of file 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 2c2d7cf..87b87d7 100644 --- a/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java +++ b/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java @@ -23,5 +23,6 @@ protected void addTranslations() { this.add(ModItems.TEA_LEAF.get(), "茶叶"); this.add(ModItems.CHOPPING_BOARD.get(), "砧板"); + this.add(ModItems.IRON_KNIFE.get(), "铁菜刀"); } } diff --git a/src/main/java/mczme/lingshi/common/data/tag/BlockTags.java b/src/main/java/mczme/lingshi/common/data/tag/BlockTags.java index 8d6af74..28ef9db 100644 --- a/src/main/java/mczme/lingshi/common/data/tag/BlockTags.java +++ b/src/main/java/mczme/lingshi/common/data/tag/BlockTags.java @@ -4,6 +4,7 @@ import mczme.lingshi.lingshi; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; +import net.minecraft.world.level.block.Blocks; import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.NotNull; @@ -11,6 +12,7 @@ import java.util.concurrent.CompletableFuture; +import static mczme.lingshi.common.tag.ModTags.*; import static net.minecraft.tags.BlockTags.*; public class BlockTags extends BlockTagsProvider { @@ -22,5 +24,9 @@ public BlockTags(PackOutput output, CompletableFuture loo protected void addTags(HolderLookup.@NotNull Provider pProvider) { // 斧 可挖掘 tag(MINEABLE_WITH_AXE).add(ModBlocks.CHOPPING_BOARD.get()); + +// 热源方块 + tag(HEAT_SOURCE).add(Blocks.CAMPFIRE, + Blocks.MAGMA_BLOCK); } } diff --git a/src/main/java/mczme/lingshi/common/item/KnifeItem.java b/src/main/java/mczme/lingshi/common/item/KnifeItem.java index 0400697..bdbd3f9 100644 --- a/src/main/java/mczme/lingshi/common/item/KnifeItem.java +++ b/src/main/java/mczme/lingshi/common/item/KnifeItem.java @@ -1,13 +1,11 @@ package mczme.lingshi.common.item; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.DiggerItem; +import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.Tier; -import net.minecraft.world.level.block.Block; -public class KnifeItem extends DiggerItem { +public class KnifeItem extends SwordItem { - public KnifeItem(Tier pTier, TagKey pBlocks, Properties pProperties) { - super(pTier, pBlocks, pProperties); + public KnifeItem(Tier pTier, Properties pProperties) { + super(pTier, pProperties); } } diff --git a/src/main/java/mczme/lingshi/common/registry/ModItems.java b/src/main/java/mczme/lingshi/common/registry/ModItems.java index 9aaaea4..4af14d0 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModItems.java +++ b/src/main/java/mczme/lingshi/common/registry/ModItems.java @@ -1,8 +1,11 @@ package mczme.lingshi.common.registry; +import mczme.lingshi.common.item.KnifeItem; import mczme.lingshi.lingshi; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; +import net.minecraft.world.item.SwordItem; +import net.minecraft.world.item.Tiers; import net.neoforged.bus.api.IEventBus; import net.neoforged.neoforge.registries.DeferredRegister; @@ -23,6 +26,8 @@ public class ModItems { public static final Supplier CHOPPING_BOARD = registerWithCreateTab("chopping_board", () -> new BlockItem(ModBlocks.CHOPPING_BOARD.get(), 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)))); + 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/tag/ModTags.java b/src/main/java/mczme/lingshi/common/tag/ModTags.java new file mode 100644 index 0000000..156da6e --- /dev/null +++ b/src/main/java/mczme/lingshi/common/tag/ModTags.java @@ -0,0 +1,17 @@ +package mczme.lingshi.common.tag; + +import mczme.lingshi.lingshi; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.block.Block; + +public class ModTags { + + public static final TagKey HEAT_SOURCE = modTag(Registries.BLOCK, "heat_source"); + + private static TagKey modTag(net.minecraft.resources.ResourceKey> pRegistry, String name) { + return TagKey.create(pRegistry, ResourceLocation.fromNamespaceAndPath(lingshi.MODID, name)); + } + +} diff --git a/src/main/java/mczme/lingshi/common/tag/NeoforgeTags.java b/src/main/java/mczme/lingshi/common/tag/NeoforgeTags.java new file mode 100644 index 0000000..8a5528b --- /dev/null +++ b/src/main/java/mczme/lingshi/common/tag/NeoforgeTags.java @@ -0,0 +1,16 @@ +package mczme.lingshi.common.tag; + +import mczme.lingshi.lingshi; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; + +public class NeoforgeTags { + + public static final TagKey KNIFE = neoforgeTag(Registries.ITEM, "knife"); + + private static TagKey neoforgeTag(net.minecraft.resources.ResourceKey> pRegistry, String name) { + return TagKey.create(pRegistry, ResourceLocation.fromNamespaceAndPath("neoforge", name)); + } +}