-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9d42dc
commit 95be990
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...ta/minecraft/tags/block/mineable/axe.json → ...ta/minecraft/tags/block/mineable/axe.json
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"hollow:stripped_oak_hollow_log", | ||
"hollow:oak_hollow_log", | ||
|
36 changes: 36 additions & 0 deletions
36
src/main/java/dev/spiritstudios/hollow/datagen/BlockTagProvider.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,36 @@ | ||
package dev.spiritstudios.hollow.datagen; | ||
|
||
import dev.spiritstudios.hollow.HollowTags; | ||
import dev.spiritstudios.hollow.block.HollowLogBlock; | ||
import dev.spiritstudios.hollow.registry.HollowBlockRegistrar; | ||
import dev.spiritstudios.specter.api.core.util.ReflectionHelper; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.RegistryWrapper; | ||
import net.minecraft.registry.tag.BlockTags; | ||
import net.minecraft.registry.tag.TagBuilder; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class BlockTagProvider extends FabricTagProvider.BlockTagProvider { | ||
public BlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { | ||
super(output, registriesFuture); | ||
} | ||
|
||
@Override | ||
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) { | ||
TagBuilder hollowLogs = getTagBuilder(HollowTags.HOLLOW_LOGS); | ||
TagBuilder axeMineable = getTagBuilder(BlockTags.AXE_MINEABLE); | ||
|
||
ReflectionHelper.forEachStaticField( | ||
HollowBlockRegistrar.class, | ||
HollowLogBlock.class, | ||
(block, name, field) -> { | ||
Identifier id = Registries.BLOCK.getId(block); | ||
hollowLogs.add(id); | ||
axeMineable.add(id); | ||
}); | ||
} | ||
} |
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