Package net.minecraft.world.item
Class SpawnEggItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.SpawnEggItem
- All Implemented Interfaces:
FeatureElement,ItemLike,IItemExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties, Item.TooltipContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<EntityType<?>, SpawnEggItem> static final DispenseItemBehaviorFields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, APPROXIMATELY_INFINITE_USE_DURATION, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canCombineRepair, CODEC, DEFAULT_MAX_STACK_SIZE, descriptionId, MAX_BAR_WIDTH, STREAM_CODECFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable SpawnEggItembyId(@Nullable EntityType<?> pType) protected @Nullable DispenseItemBehaviorReturns the dispense behavior to register by default.static Iterable<SpawnEggItem> eggs()@Nullable EntityType<?> private static voidbooleanshouldPrintOpWarning(ItemStack p_390471_, @Nullable Player p_390407_) private InteractionResultspawnMob(@Nullable LivingEntity pSource, ItemStack pStack, Level pLevel, BlockPos pPos, boolean pShouldOffsetY, boolean pShouldOffsetYMore) spawnOffspringFromSpawnEgg(Player pPlayer, Mob pMob, EntityType<? extends Mob> pEntityType, ServerLevel pServerLevel, Vec3 pPos, ItemStack pStack) booleanspawnsEntity(ItemStack pStack, EntityType<?> pEntityType) use(Level p_43225_, Player p_43226_, InteractionHand p_43227_) useOn(UseOnContext pContext) Called when this item is used when targeting a BlockMethods inherited from class net.minecraft.world.item.Item
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canDestroyBlock, canFitInsideContainerItems, components, computeDefaultResource, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getCraftingRemainder, getDefaultInstance, getDefaultMaxStackSize, getDescriptionId, getDestroySpeed, getId, getItemDamageSource, getName, getName, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hurtEnemy, interactLivingEntity, inventoryTick, isBarVisible, isCombineRepairable, isCorrectToolForDrops, isFoil, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, toString, useOnReleaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
applyEnchantments, canBeHurtBy, canContinueUsing, canEquip, canFitInsideContainerItems, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, getAllEnchantments, getBurnTime, getCraftingRemainder, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEntityLifespan, getEquipmentSlot, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCustomEntity, isDamageable, isDamaged, isGazeDisguise, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, supportsEnchantment
-
Field Details
-
BY_ID
-
DEFAULT_DISPENSE_BEHAVIOR
-
-
Constructor Details
-
SpawnEggItem
-
-
Method Details
-
useOn
Called when this item is used when targeting a Block -
spawnMob
private InteractionResult spawnMob(@Nullable LivingEntity pSource, ItemStack pStack, Level pLevel, BlockPos pPos, boolean pShouldOffsetY, boolean pShouldOffsetYMore) -
use
-
spawnsEntity
-
byId
-
eggs
-
getType
-
requiredFeatures
- Specified by:
requiredFeaturesin interfaceFeatureElement- Overrides:
requiredFeaturesin classItem
-
spawnOffspringFromSpawnEgg
public Optional<Mob> spawnOffspringFromSpawnEgg(Player pPlayer, Mob pMob, EntityType<? extends Mob> pEntityType, ServerLevel pServerLevel, Vec3 pPos, ItemStack pStack) -
shouldPrintOpWarning
- Overrides:
shouldPrintOpWarningin classItem
-
createDispenseBehavior
Returns the dispense behavior to register by default.- Returns:
- the dispense behavior to register by default
-
registerDispenseBehavior
-