Package net.minecraft.item
Class MusicDiscItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.MusicDiscItem
- All Implemented Interfaces:
ItemConvertible
public class MusicDiscItem extends Item
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings
-
Field Summary
Fields Modifier and Type Field Description private int
comparatorOutput
private static Map<SoundEvent,MusicDiscItem>
MUSIC_DISCS
private SoundEvent
sound
Fields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group, RANDOM
-
Constructor Summary
Constructors Modifier Constructor Description protected
MusicDiscItem(int comparatorOutput, SoundEvent sound, Item.Settings settings)
-
Method Summary
Modifier and Type Method Description void
appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context)
static MusicDiscItem
bySound(SoundEvent sound)
int
getComparatorOutput()
MutableText
getDescription()
SoundEvent
getSound()
ActionResult
useOnBlock(ItemUsageContext context)
Called when an item is used on a block.Methods inherited from class net.minecraft.item.Item
appendStacks, asItem, byRawId, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getGroup, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEffectiveOn, isEnchantable, isFireproof, isFood, isIn, isIn, isNetworkSynced, isUsedOnRelease, onCraft, onStoppedUsing, postHit, postMine, postProcessTag, raycast, shouldSyncTagToClient, toString, usageTick, use, useOnEntity
-
Field Details
-
MUSIC_DISCS
-
comparatorOutput
private final int comparatorOutput -
sound
-
-
Constructor Details
-
MusicDiscItem
-
-
Method Details
-
useOnBlock
Called when an item is used on a block.This method is called on both the logical client and logical server, so take caution when using this method. The logical side can be checked using
context.getWorld().isClient()
.- Overrides:
useOnBlock
in classItem
- Parameters:
context
- the usage context- Returns:
- an action result that specifies if using the item on a block was successful.
-
getComparatorOutput
public int getComparatorOutput() -
appendTooltip
@Environment(CLIENT) public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context)- Overrides:
appendTooltip
in classItem
-
getDescription
-
bySound
-
getSound
-