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 index 43097c6..8cb79c6 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGLootTableProvider.java +++ b/src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGLootTableProvider.java @@ -1,23 +1,34 @@ package org.hiedacamellia.whispergrove.core.data.provider; +import com.google.common.collect.Iterables; 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.EntityLootSubProvider; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.util.ProblemReporter; +import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; 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 net.neoforged.neoforge.registries.DeferredHolder; +import javax.annotation.Nonnull; import java.util.List; import java.util.Set; import java.util.concurrent.CompletableFuture; +import static org.hiedacamellia.whispergrove.registers.WGBlock.*; + public class WGLootTableProvider extends LootTableProvider { public WGLootTableProvider(PackOutput output, CompletableFuture registries) { - super(output, Set.of(), List.of(new SubProviderEntry(WGBlockLoot::new, LootContextParamSets.BLOCK)), registries); + super(output, Set.of(), List.of( + new SubProviderEntry(WGBlockLoot::new, LootContextParamSets.BLOCK)), + registries); } @Override @@ -33,7 +44,20 @@ protected WGBlockLoot(HolderLookup.Provider lookupProvider) { @Override protected void generate() { + this.dropSelf(RouGuiLog.get()); + this.dropSelf(RouGuiStrippedLog.get()); + this.dropSelf(RouGuiPlanks.get()); + this.dropSelf(RouGuiSlab.get()); + this.dropSelf(RouGuiLeaves.get()); + this.dropSelf(RouGuiStair.get()); + this.dropSelf(Roller.get()); + } + @Nonnull + @Override + protected Iterable getKnownBlocks() { + // 模组自定义的方块战利品表必须覆盖此方法,以绕过对原版方块战利品表的检查(此处返回该模组的所有方块) + return Iterables.transform(BLOCKS.getEntries(), DeferredHolder::get); } } }