Package me.tnoctua.nmodutils.util
Class Utils
java.lang.Object
me.tnoctua.nmodutils.util.Utils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doubleVoxel width for use in VoxelShape mathCommon side translations for use in data generation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.text.MutableTextaddTranslation(String translationKey) Add a translation key with a missing translation and returns the translated text.static net.minecraft.text.MutableTextaddTranslation(String translationKey, String value) Adds a translation key and returns the translated text.static Optional<net.minecraft.item.ItemStack> fromNbt(net.minecraft.registry.RegistryWrapper.WrapperLookup registries, net.minecraft.nbt.NbtElement nbt) Returns an item stack from a provided nbt compound, without logging errors.
-
Field Details
-
P
public static double PVoxel width for use in VoxelShape math -
TRANSLATIONS
Common side translations for use in data generation.
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
addTranslation
Add a translation key with a missing translation and returns the translated text.This should ideally be called once per unique translation key, other than those automatically registered.
For example this call can be used in place of Minecraft's translatable text calls.
- Parameters:
translationKey- translation key
-
addTranslation
Adds a translation key and returns the translated text.- Parameters:
translationKey- translation keyvalue- translation value
-
fromNbt
public static Optional<net.minecraft.item.ItemStack> fromNbt(net.minecraft.registry.RegistryWrapper.WrapperLookup registries, net.minecraft.nbt.NbtElement nbt) Returns an item stack from a provided nbt compound, without logging errors.NOTE: The error is important, so make sure the item stack you're setting is NEVER null or brave the desync.
- Parameters:
registries- registry lookupnbt- item stack as nbt compound- Returns:
- item stack if it could be parsed from nbt
-