From c65d6ea12b4a5434ba426ac24c0689cc4682d91a Mon Sep 17 00:00:00 2001 From: MORIMORI0317 Date: Sat, 10 Aug 2024 17:06:53 +0900 Subject: [PATCH] nna --- .../yajusenpai/server/level/YJLootTables.java | 15 ++++++- .../data/YajuSenpaiDataGeneratorFabric.java | 4 +- .../neoforge/handler/DataGenHandler.java | 42 +++++++++++++++++++ .../neoforge/item/YJItemTagsNeoForge.java | 40 +++++++++++------- .../resources/META-INF/neoforge.mods.toml | 2 +- 5 files changed, 85 insertions(+), 18 deletions(-) diff --git a/common/src/main/java/net/morimori0317/yajusenpai/server/level/YJLootTables.java b/common/src/main/java/net/morimori0317/yajusenpai/server/level/YJLootTables.java index ccb0310..d44c573 100644 --- a/common/src/main/java/net/morimori0317/yajusenpai/server/level/YJLootTables.java +++ b/common/src/main/java/net/morimori0317/yajusenpai/server/level/YJLootTables.java @@ -19,6 +19,7 @@ public class YJLootTables { private static final ResourceLocation ZOMBIE = ResourceLocation.withDefaultNamespace("entities/zombie"); private static final ResourceLocation ZOMBIE_VILLAGER = ResourceLocation.withDefaultNamespace("entities/zombie_villager"); private static final ResourceLocation HUSK = ResourceLocation.withDefaultNamespace("entities/husk"); + private static final ResourceLocation END_CITY_TREASURE = ResourceLocation.withDefaultNamespace("chests/end_city_treasure"); public static void onLootTableModify(ResourceKey key, LootEvent.LootTableModificationContext context, boolean builtin) { ResourceLocation id = key.location(); @@ -32,7 +33,12 @@ public static void onLootTableModify(ResourceKey key, LootEvent.LootT context.addPool(pool); } - if (id.getPath().startsWith("chests/") || id.getPath().startsWith("gameplay/")) { + if (id.getPath().startsWith("chests/") || + id.getPath().startsWith("gameplay/") || + id.getPath().startsWith("archaeology/") || + id.getPath().startsWith("pots/") || + id.getPath().startsWith("spawners/")) { + var pool = LootPool.lootPool().setRolls(UniformGenerator.between(1, 3)) .when(LootItemRandomChanceCondition.randomChance(0.114514f)); @@ -45,5 +51,12 @@ public static void onLootTableModify(ResourceKey key, LootEvent.LootT context.addPool(pool); } + + if (END_CITY_TREASURE.equals(id)) { + LootPool.Builder pool = LootPool.lootPool().setRolls(ConstantValue.exactly(1)) + .when(LootItemRandomChanceCondition.randomChance(0.0110f)); + + context.addPool(pool); + } } } diff --git a/fabric/src/main/java/net/morimori0317/yajusenpai/fabric/data/YajuSenpaiDataGeneratorFabric.java b/fabric/src/main/java/net/morimori0317/yajusenpai/fabric/data/YajuSenpaiDataGeneratorFabric.java index f57b40e..a5479ac 100644 --- a/fabric/src/main/java/net/morimori0317/yajusenpai/fabric/data/YajuSenpaiDataGeneratorFabric.java +++ b/fabric/src/main/java/net/morimori0317/yajusenpai/fabric/data/YajuSenpaiDataGeneratorFabric.java @@ -96,13 +96,13 @@ public static void generateItemTag(ItemTagProviderWrapper.ItemTagProviderAccess providerAccess.copy(YJBlockTagsFabric.STORAGE_BLOCKS_RAW_YAJUSENPAI, YJItemTagsFabric.STORAGE_BLOCKS_RAW_YAJUSENPAI); providerAccess.tag(ConventionalItemTags.FOODS) - .add(YJItems.ICE_TEA.get()); + .add(YJItems.ICE_TEA.get(), YJItems.BAKED_POTATO_SENPAI.get()); providerAccess.tag(ConventionalItemTags.FRUITS_FOODS) .add(YJItems.APPLE_INM.get()); providerAccess.tag(ConventionalItemTags.VEGETABLES_FOODS) - .add(YJItems.POTATO_SENPAI.get(), YJItems.BAKED_POTATO_SENPAI.get()); + .add(YJItems.POTATO_SENPAI.get()); providerAccess.tag(YJItemTagsFabric.GLOWSTONE_BLOCKS) .add(Items.GLOWSTONE); diff --git a/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/handler/DataGenHandler.java b/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/handler/DataGenHandler.java index d784d6d..27218c9 100644 --- a/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/handler/DataGenHandler.java +++ b/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/handler/DataGenHandler.java @@ -198,6 +198,48 @@ public static void generateItemTag(ItemTagProviderWrapper.ItemTagProviderAccess providerAccess.tag(Tags.Items.TOOLS) .add(YJItems.SOFT_SMARTPHONE.get()); + + providerAccess.tag(Tags.Items.FOODS) + .add(YJItems.ICE_TEA.get(), YJItems.BAKED_POTATO_SENPAI.get()); + + providerAccess.tag(Tags.Items.FOODS_FRUITS) + .add(YJItems.APPLE_INM.get()); + + providerAccess.tag(Tags.Items.FOODS_VEGETABLES) + .add(YJItems.POTATO_SENPAI.get()); + + providerAccess.tag(YJItemTagsNeoForge.DRINKS) + .addTags(ImmutableList.of( + YJItemTagsNeoForge.TEA, + YJItemTagsNeoForge.ICE_TEA, + YJItemTagsNeoForge.ICETEA, + YJItemTagsNeoForge.DRINKS_TEA, + YJItemTagsNeoForge.DRINKS_ICE_TEA, + YJItemTagsNeoForge.DRINKS_ICETEA + )); + + providerAccess.tag(YJItemTagsNeoForge.TEA) + .add(YJItems.ICE_TEA.get()); + providerAccess.tag(YJItemTagsNeoForge.ICE_TEA) + .add(YJItems.ICE_TEA.get()); + providerAccess.tag(YJItemTagsNeoForge.ICETEA) + .add(YJItems.ICE_TEA.get()); + providerAccess.tag(YJItemTagsNeoForge.DRINKS_TEA) + .add(YJItems.ICE_TEA.get()); + providerAccess.tag(YJItemTagsNeoForge.DRINKS_ICE_TEA) + .add(YJItems.ICE_TEA.get()); + providerAccess.tag(YJItemTagsNeoForge.DRINKS_ICETEA) + .add(YJItems.ICE_TEA.get()); + + providerAccess.tag(YJItemTagsNeoForge.FRUITS) + .addTags(ImmutableList.of( + YJItemTagsNeoForge.APPLE, + YJItemTagsNeoForge.FRUITS_APPLE + )); + providerAccess.tag(YJItemTagsNeoForge.APPLE) + .add(YJItems.APPLE_INM.get()); + providerAccess.tag(YJItemTagsNeoForge.FRUITS_APPLE) + .add(YJItems.APPLE_INM.get()); } public static void generateBiomeTag(TagProviderWrapper.TagProviderAccess> providerAccess) { diff --git a/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/item/YJItemTagsNeoForge.java b/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/item/YJItemTagsNeoForge.java index e028933..9a403e5 100644 --- a/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/item/YJItemTagsNeoForge.java +++ b/neoforge/src/main/java/net/morimori0317/yajusenpai/neoforge/item/YJItemTagsNeoForge.java @@ -6,20 +6,32 @@ import net.minecraft.world.item.Item; public class YJItemTagsNeoForge { - public static final TagKey ORES_YJNIUM = fgBind("ores/yjnium"); - public static final TagKey ORES_YJSNPI = fgBind("ores/yjsnpi"); - public static final TagKey STORAGE_BLOCKS_YJNIUM = fgBind("storage_blocks/yjnium"); - public static final TagKey STORAGE_BLOCKS_RAW_YJNIUM = fgBind("storage_blocks/raw_yjnium"); - public static final TagKey STORAGE_BLOCKS_RAW_YJSNPI = fgBind("storage_blocks/raw_yjsnpi"); - public static final TagKey CROPS_POTATO_SENPAI = fgBind("crops/potato_senpai"); - public static final TagKey INGOTS_YJNIUM = fgBind("ingots/yjnium"); - public static final TagKey INGOTS_YJSNPI = fgBind("ingots/yjsnpi"); - public static final TagKey NUGGETS_YJNIUM = fgBind("nuggets/yjnium"); - public static final TagKey NUGGETS_YJSNPI = fgBind("nuggets/yjsnpi"); - public static final TagKey RAW_MATERIALS_YJNIUM = fgBind("raw_materials/yjnium"); - public static final TagKey RAW_MATERIALS_YJSNPI = fgBind("raw_materials/yjsnpi"); + public static final TagKey ORES_YJNIUM = bind("ores/yjnium"); + public static final TagKey ORES_YJSNPI = bind("ores/yjsnpi"); + public static final TagKey STORAGE_BLOCKS_YJNIUM = bind("storage_blocks/yjnium"); + public static final TagKey STORAGE_BLOCKS_RAW_YJNIUM = bind("storage_blocks/raw_yjnium"); + public static final TagKey STORAGE_BLOCKS_RAW_YJSNPI = bind("storage_blocks/raw_yjsnpi"); + public static final TagKey CROPS_POTATO_SENPAI = bind("crops/potato_senpai"); + public static final TagKey INGOTS_YJNIUM = bind("ingots/yjnium"); + public static final TagKey INGOTS_YJSNPI = bind("ingots/yjsnpi"); + public static final TagKey NUGGETS_YJNIUM = bind("nuggets/yjnium"); + public static final TagKey NUGGETS_YJSNPI = bind("nuggets/yjsnpi"); + public static final TagKey RAW_MATERIALS_YJNIUM = bind("raw_materials/yjnium"); + public static final TagKey RAW_MATERIALS_YJSNPI = bind("raw_materials/yjsnpi"); - private static TagKey fgBind(String id) { - return TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("neoforge", id)); + public static final TagKey DRINKS = bind("drinks"); + public static final TagKey TEA = bind("tea"); + public static final TagKey ICE_TEA = bind("ice_tea"); + public static final TagKey ICETEA = bind("icetea"); + public static final TagKey DRINKS_TEA = bind("drinks/tea"); + public static final TagKey DRINKS_ICE_TEA = bind("drinks/ice_tea"); + public static final TagKey DRINKS_ICETEA = bind("drinks/icetea"); + + public static final TagKey FRUITS = bind("fruits"); + public static final TagKey APPLE = bind("apple"); + public static final TagKey FRUITS_APPLE = bind("fruits/apple"); + + private static TagKey bind(String id) { + return TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", id)); } } diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index dd1af1d..ed33468 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -8,7 +8,7 @@ modId = "yajusenpai" version = "${version}" displayName = "Yaju Senpai" authors = "MORIMORI0317, toranpfan6433" -displayURL = "https://www.curseforge.com/minecraft/mc-mods/the-yjsnpi-mod" +displayURL = "https://modrinth.com/mod/yaju-senpai" issueTrackerURL = "https://github.com/MORIMORI0317/YajuSenpaiMOD/issues" updateJSONURL = "https://raw.githubusercontent.com/MORIMORI0317/YajuSenpaiMOD/master/neoforge_version_check.json" description = '''