Package dev.jaxydog.astral.content.item
Class AstralBlockItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.BlockItem
dev.jaxydog.astral.content.item.AstralBlockItem
- All Implemented Interfaces:
Custom,LoreHolder,Registered,Registered.Common,net.fabricmc.fabric.api.item.v1.FabricItem,net.minecraft.item.ItemConvertible,net.minecraft.resource.featuretoggle.ToggleableFeature
An extension of a
BlockItem that provides commonly used functionality.
This is one of the various instances of already-provided wrapper classes for commonly used types.
In future code, you should prefer to extend this class over BlockItem if at all possible.
This type is automatically registered.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
net.minecraft.item.Item.SettingsNested classes/interfaces inherited from interface dev.jaxydog.astral.register.Registered
Registered.All, Registered.Client, Registered.Common, Registered.Generated, Registered.Server -
Field Summary
Fields inherited from class net.minecraft.item.BlockItem
BLOCK_ENTITY_TAG_KEY, BLOCK_STATE_TAG_KEYFields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_MAX_COUNT, DEFAULT_MAX_USE_TIME, ITEM_BAR_STEPSFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
ConstructorsConstructorDescriptionAstralBlockItem(AstralBlock block, net.minecraft.item.Item.Settings settings) Creates a new block item using the given settings.AstralBlockItem(AstralBlock block, net.minecraft.item.Item.Settings settings, @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup) Creates a new block item using the given settings.AstralBlockItem(String path, net.minecraft.block.Block block, net.minecraft.item.Item.Settings settings) Creates a new block item using the given settings.AstralBlockItem(String path, net.minecraft.block.Block block, net.minecraft.item.Item.Settings settings, @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup) Creates a new block item using the given settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTooltip(net.minecraft.item.ItemStack stack, @Nullable net.minecraft.world.World world, List<net.minecraft.text.Text> tooltip, net.minecraft.client.item.TooltipContext context) Optional<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> Returns this item's preferred item group.Returns this value's associated registry identifier path.Methods inherited from class net.minecraft.item.BlockItem
appendBlocks, canBeNested, canPlace, checkStatePlacement, getBlock, getBlockEntityNbt, getPlacementContext, getPlacementState, getPlaceSound, getRequiredFeatures, getTranslationKey, onItemEntityDestroyed, place, place, postPlacement, setBlockEntityNbt, useOnBlock, writeNbtToBlockEntityMethods inherited from class net.minecraft.item.Item
asItem, byRawId, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getItemBarColor, getItemBarStep, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getRegistryEntry, getTooltipData, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isItemBarVisible, isNbtSynced, isNetworkSynced, isSuitableFor, isUsedOnRelease, onClicked, onCraft, onStackClicked, onStoppedUsing, postHit, postMine, postProcessNbt, raycast, toString, usageTick, use, useOnEntityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.jaxydog.astral.content.item.Custom
registerCommonMethods inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem
allowContinuingBlockBreaking, allowNbtUpdateAnimation, getAttributeModifiers, getRecipeRemainder, isSuitableForMethods inherited from interface net.minecraft.item.ItemConvertible
asItemMethods inherited from interface dev.jaxydog.astral.content.item.LoreHolder
formatLoreText, getLoreTooltipsMethods inherited from interface dev.jaxydog.astral.register.Registered
getRegistryIdMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Constructor Details
-
AstralBlockItem
public AstralBlockItem(String path, net.minecraft.block.Block block, net.minecraft.item.Item.Settings settings, @Nullable @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup) Creates a new block item using the given settings.If the
preferredGroupsupplier isnull, this item will not be added to any item groups.- Parameters:
path- The item's identifier path.block- The item's associated block.settings- The item's settings.preferredGroup- The item's preferred item group.- Since:
- 2.0.0
-
AstralBlockItem
public AstralBlockItem(AstralBlock block, net.minecraft.item.Item.Settings settings, @Nullable @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup) Creates a new block item using the given settings.If the
preferredGroupsupplier isnull, this item will not be added to any item groups.- Parameters:
block- The item's associated block.settings- The item's settings.preferredGroup- The item's preferred item group.- Since:
- 2.0.0
-
AstralBlockItem
public AstralBlockItem(String path, net.minecraft.block.Block block, net.minecraft.item.Item.Settings settings) Creates a new block item using the given settings.This item will be added to the default item group.
- Parameters:
path- The item's identifier path.block- The item's associated block.settings- The item's settings.- Since:
- 2.0.0
-
AstralBlockItem
Creates a new block item using the given settings.This item will be added to the default item group.
- Parameters:
block- The item's associated block.settings- The item's settings.- Since:
- 2.0.0
-
-
Method Details
-
appendTooltip
public void appendTooltip(net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.world.World world, List<net.minecraft.text.Text> tooltip, net.minecraft.client.item.TooltipContext context) - Overrides:
appendTooltipin classnet.minecraft.item.BlockItem
-
getItemGroup
Description copied from interface:CustomReturns this item's preferred item group.- Specified by:
getItemGroupin interfaceCustom- Returns:
- A reference to an item group.
-
getRegistryPath
Description copied from interface:RegisteredReturns this value's associated registry identifier path.This is by default used to determine the
Identifierprovided byRegistered.getRegistryId(). For example, returning"my_item"will cause the associated identifier to beastral:my_item.- Specified by:
getRegistryPathin interfaceRegistered- Returns:
- An identifier path.
-