generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
# Conflicts: # src/main/java/org/hiedacamellia/whispergrove/core/data/Data.java # src/main/java/org/hiedacamellia/whispergrove/core/data/provider/ModelProvider.java # src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGRecipeProvider.java # src/main/java/org/hiedacamellia/whispergrove/registers/WGItem.java
- Loading branch information
Showing
19 changed files
with
290 additions
and
73 deletions.
There are no files selected for viewing
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
63 changes: 63 additions & 0 deletions
63
src/main/java/org/hiedacamellia/whispergrove/core/data/provider/WGLootTableProvider.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,63 @@ | ||
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<HolderLookup.Provider> registries) { | ||
super(output, Set.of(), List.of( | ||
new SubProviderEntry(WGBlockLoot::new, LootContextParamSets.BLOCK)), | ||
registries); | ||
} | ||
|
||
@Override | ||
protected void validate(WritableRegistry<LootTable> 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() { | ||
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<Block> getKnownBlocks() { | ||
// 模组自定义的方块战利品表必须覆盖此方法,以绕过对原版方块战利品表的检查(此处返回该模组的所有方块) | ||
return Iterables.transform(BLOCKS.getEntries(), DeferredHolder::get); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.