diff --git a/src/main/java/org/hiedacamellia/whispergrove/core/data/Data.java b/src/main/java/org/hiedacamellia/whispergrove/core/data/Data.java index 891240c..1b4fed4 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/core/data/Data.java +++ b/src/main/java/org/hiedacamellia/whispergrove/core/data/Data.java @@ -6,6 +6,7 @@ import org.hiedacamellia.whispergrove.core.data.lang.EnglishLanguageProvider; import org.hiedacamellia.whispergrove.core.data.provider.ModelProvider; import org.hiedacamellia.whispergrove.core.data.provider.StateProvider; +import org.hiedacamellia.whispergrove.core.data.provider.WGLootTableProvider; import org.hiedacamellia.whispergrove.core.data.provider.WGRecipeProvider; public class Data { @@ -13,11 +14,13 @@ public static void onGatherData(GatherDataEvent event) { var gen = event.getGenerator(); var packOutput = gen.getPackOutput(); var helper = event.getExistingFileHelper(); + var lookupProvider = event.getLookupProvider(); gen.addProvider(event.includeClient(), new EnglishLanguageProvider(packOutput)); gen.addProvider(event.includeClient(), new ChineseLanguageProvider(packOutput)); gen.addProvider(event.includeClient(), new ClassicalChineseLanguageProvider(packOutput)); gen.addProvider(event.includeClient(), new ModelProvider(packOutput, helper)); gen.addProvider(event.includeClient(), new StateProvider(packOutput, helper)); - gen.addProvider(event.includeServer(), new WGRecipeProvider(packOutput, event.getLookupProvider())); + gen.addProvider(event.includeServer(), new WGRecipeProvider(packOutput, lookupProvider)); + gen.addProvider(event.includeClient(),new WGLootTableProvider(packOutput, lookupProvider)); } } diff --git a/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/ModelProvider.java b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/ModelProvider.java index 2caf083..cc6d9bd 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/ModelProvider.java +++ b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/ModelProvider.java @@ -48,7 +48,7 @@ protected void registerModels() { "sliced_ren_shen", "sliced_long_dan_cao" ,"mo_yu_gu", - //"shu_fu_pian", + "shu_fu_pian", "bone_fragment" ).forEach(s -> this.singleTexture(s, ResourceLocation.withDefaultNamespace("item/generated"), "layer0", diff --git a/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGLootTableProvider.java b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGLootTableProvider.java new file mode 100644 index 0000000..43097c6 --- /dev/null +++ b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGLootTableProvider.java @@ -0,0 +1,39 @@ +package org.hiedacamellia.whispergrove.core.data.provider; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.WritableRegistry; +import net.minecraft.data.PackOutput; +import net.minecraft.data.loot.BlockLootSubProvider; +import net.minecraft.data.loot.LootTableProvider; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.ValidationContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; + +public class WGLootTableProvider extends LootTableProvider { + public WGLootTableProvider(PackOutput output, CompletableFuture registries) { + super(output, Set.of(), List.of(new SubProviderEntry(WGBlockLoot::new, LootContextParamSets.BLOCK)), registries); + } + + @Override + protected void validate(WritableRegistry registry, ValidationContext context, ProblemReporter.Collector collector) { + // FIXME 需要核实正确写法 + // map.forEach((key, value) -> LootTables.validate(context, key, value)); + } + + public static class WGBlockLoot extends BlockLootSubProvider { + protected WGBlockLoot(HolderLookup.Provider lookupProvider) { + super(Set.of(), FeatureFlags.REGISTRY.allFlags(), lookupProvider); + } + + @Override + protected void generate() { + + } + } +} diff --git a/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGRecipeProvider.java b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGRecipeProvider.java index d0b06d0..b8f3ffc 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGRecipeProvider.java +++ b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGRecipeProvider.java @@ -46,6 +46,7 @@ protected void buildRecipes(RecipeOutput output) { .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) .save(output); + //熔炉配方 SimpleCookingRecipeBuilder.smelting( Ingredient.of(MO_YU_GU),//输入 RecipeCategory.MISC,//配方类型 @@ -65,5 +66,6 @@ protected void buildRecipes(RecipeOutput output) { ) .unlockedBy("has_lilac", has(Items.BONE)) .save(output, "duan_long_gu_smelting"); + } } diff --git a/src/main/resources/assets/whispergrove/textures/item/shu_fu_pian.png b/src/main/resources/assets/whispergrove/textures/item/shu_fu_pian.png new file mode 100644 index 0000000..8fa3a7d Binary files /dev/null and b/src/main/resources/assets/whispergrove/textures/item/shu_fu_pian.png differ