-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Hopefully partially working log gen implementation
- Loading branch information
1 parent
554b35d
commit 2ae5025
Showing
2 changed files
with
34 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.zepalesque.zenith.util; | ||
|
||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.block.Block; | ||
import net.neoforged.neoforge.registries.NeoForgeRegistries; | ||
import org.codehaus.plexus.util.StringUtils; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class DataGenUtil { | ||
|
||
public static <T> ResourceLocation getId(Supplier<? extends T> object, Registry<T> registry) { | ||
return registry.getKey(object.get()); | ||
} | ||
|
||
public static String getNameLocalized(String id) { | ||
return StringUtils.capitalise(id.replace('_', ' ')); | ||
} | ||
|
||
public static <T> String getNameLocalized(Supplier<? extends T> object, Registry<T> registry) { | ||
return getNameLocalized(getId(object, registry).getPath()); | ||
} | ||
} |