Package org.bukkit.entity
Interface Item
- All Superinterfaces:
Audience
,CommandSender
,Entity
,Frictional
,HoverEventSource<HoverEvent.ShowEntity>
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,Pointered
,ServerOperator
,Sound.Emitter
Represents a dropped item.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.entity.Entity
Entity.Spigot
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets if non-player entities can pick this Item upboolean
Gets whether the player can pickup the item or notint
Gets the health of item stack.Gets the item stack associated with this item drop.getOwner()
Get the owner of this item.int
Gets the delay before this Item is available to be picked up by playersGet the thrower of this item.boolean
Check if item is immune to cactusboolean
Check if item is immune to explosionsboolean
Check if item is immune to fireboolean
Check if item is immune to lightningboolean
Gets if this Item lives forevervoid
setCanMobPickup
(boolean canMobPickup) Sets if non-player entities can pick this Item upvoid
setCanPlayerPickup
(boolean canPlayerPickup) Sets whether the item can be picked up or not.void
setHealth
(int health) Sets the health of the item stack.void
setImmuneToCactus
(boolean immuneToCactus) Set whether or not this item is immune to cactusvoid
setImmuneToExplosion
(boolean immuneToExplosion) Set whether or not this item is immune to explosionsvoid
setImmuneToFire
(boolean immuneToFire) Set whether or not this item is immune to firevoid
setImmuneToLightning
(boolean immuneToLightning) Set whether or not this item is immune to lightningvoid
setItemStack
(@NotNull ItemStack stack) Sets the item stack associated with this item drop.void
Sets the owner of this item.void
setPickupDelay
(int delay) Sets the delay before this Item is available to be picked up by playersvoid
setThrower
(@Nullable UUID uuid) Set the thrower of this item.void
setUnlimitedLifetime
(boolean unlimited) Sets if this Item should live forevervoid
setWillAge
(boolean willAge) Sets whether the item will age or not.boolean
willAge()
Gets whether the item will age and despawn from being on the ground too longMethods inherited from interface net.kyori.adventure.audience.Audience
clearResourcePacks, clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showTitle, stopSound, stopSound
Methods inherited from interface org.bukkit.command.CommandSender
getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage, sendRichMessage
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, asHoverEvent, collidesAt, copy, copy, createSnapshot, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPitch, getPortalCooldown, getPose, getRider, getScheduler, getScoreboardEntryName, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, getX, getY, getYaw, getZ, hasFixedPose, hasGravity, hasRider, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isInBubbleColumn, isInDaylight, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isInWorld, isOnGround, isPersistent, isRidable, isRidableInWater, isSilent, isSneaking, isTicking, isUnderWater, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setImmuneToFire, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setPose, setPose, setRotation, setSilent, setSneaking, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spawnAt, spawnAt, spigot, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, wouldCollideUsing
Methods inherited from interface io.papermc.paper.entity.Frictional
getFrictionState, setFrictionState
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.Nameable
customName, customName, getCustomName, setCustomName
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
getItemStack
Gets the item stack associated with this item drop.- Returns:
- An item stack.
-
setItemStack
Sets the item stack associated with this item drop.- Parameters:
stack
- An item stack.
-
getPickupDelay
int getPickupDelay()Gets the delay before this Item is available to be picked up by players- Returns:
- Remaining delay
-
setPickupDelay
void setPickupDelay(int delay) Sets the delay before this Item is available to be picked up by players- Parameters:
delay
- New delay
-
setUnlimitedLifetime
void setUnlimitedLifetime(boolean unlimited) Sets if this Item should live forever- Parameters:
unlimited
- true if the lifetime is unlimited
-
isUnlimitedLifetime
boolean isUnlimitedLifetime()Gets if this Item lives forever- Returns:
- true if the lifetime is unlimited
-
setOwner
Sets the owner of this item. Other entities will not be able to pickup this item when an owner is set.- Parameters:
owner
- UUID of new owner
-
getOwner
Get the owner of this item.- Returns:
- UUID of owner
-
setThrower
Set the thrower of this item. The thrower is the entity which dropped the item. This affects the trigger criteria for item pickups, for things such as advancements.- Parameters:
uuid
- UUID of thrower
-
getThrower
Get the thrower of this item. The thrower is the entity which dropped the item.- Returns:
- UUID of thrower
-
canMobPickup
boolean canMobPickup()Gets if non-player entities can pick this Item up- Returns:
- True if non-player entities can pickup
-
setCanMobPickup
void setCanMobPickup(boolean canMobPickup) Sets if non-player entities can pick this Item up- Parameters:
canMobPickup
- True to allow non-player entity pickup
-
canPlayerPickup
boolean canPlayerPickup()Gets whether the player can pickup the item or not- Returns:
- True if a player can pickup the item
-
setCanPlayerPickup
void setCanPlayerPickup(boolean canPlayerPickup) Sets whether the item can be picked up or not. Modifies the pickup delay value to do so.- Parameters:
canPlayerPickup
- True if the player can pickup the item
-
willAge
boolean willAge()Gets whether the item will age and despawn from being on the ground too long- Returns:
- True if the item will age
-
setWillAge
void setWillAge(boolean willAge) Sets whether the item will age or not. If the item is not ageing, it will not despawn by being on the ground for too long.- Parameters:
willAge
- True if the item should age
-
getHealth
int getHealth()Gets the health of item stack.Currently the default max health is 5.
- Returns:
- the health
-
setHealth
void setHealth(int health) Sets the health of the item stack. If the value is non-positive the itemstack's normal "on destroy" functionality will be run.Currently, the default max health is 5.
- Parameters:
health
- the health, a non-positive value will destroy the entity
-
setImmuneToCactus
void setImmuneToCactus(boolean immuneToCactus) Set whether or not this item is immune to cactus- Parameters:
immuneToCactus
- True to make immune to cactus
-
isImmuneToCactus
boolean isImmuneToCactus()Check if item is immune to cactus- Returns:
- True if immune to cactus
-
setImmuneToExplosion
void setImmuneToExplosion(boolean immuneToExplosion) Set whether or not this item is immune to explosions- Parameters:
immuneToExplosion
- True to make immune to explosions
-
isImmuneToExplosion
boolean isImmuneToExplosion()Check if item is immune to explosions- Returns:
- True if immune to explosions
-
setImmuneToFire
void setImmuneToFire(boolean immuneToFire) Set whether or not this item is immune to fire- Parameters:
immuneToFire
- True to make immune to fire
-
isImmuneToFire
boolean isImmuneToFire()Check if item is immune to fire- Specified by:
isImmuneToFire
in interfaceEntity
- Returns:
- True if immune to fire
-
setImmuneToLightning
void setImmuneToLightning(boolean immuneToLightning) Set whether or not this item is immune to lightning- Parameters:
immuneToLightning
- True to make immune to lightning
-
isImmuneToLightning
boolean isImmuneToLightning()Check if item is immune to lightning- Returns:
- True if immune to lightning
-