Package net.minecraft.entity
Class ItemEntity
java.lang.Object
net.minecraft.entity.Entity
net.minecraft.entity.ItemEntity
- All Implemented Interfaces:
CommandOutput,Nameable
public class ItemEntity extends Entity
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.PositionUpdater -
Field Summary
Fields Modifier and Type Field Description private inthealthprivate intitemAgeThe number of ticks since this item entity has been created.private UUIDownerprivate intpickupDelayprivate static TrackedData<ItemStack>STACKprivate UUIDthrowerfloatuniqueOffsetFields inherited from class net.minecraft.entity.Entity
age, chunkX, chunkY, chunkZ, dataTracker, distanceTraveled, fallDistance, field_25599, firstUpdate, FLAGS, fluidHeight, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inNetherPortal, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, removed, ridingCooldown, stepHeight, submergedInWater, teleporting, timeUntilRegen, touchingWater, updateNeeded, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, world, yawFields inherited from interface net.minecraft.server.command.CommandOutput
DUMMY -
Constructor Summary
Constructors Modifier Constructor Description ItemEntity(EntityType<? extends ItemEntity> type, World world)privateItemEntity(ItemEntity itemEntity)ItemEntity(World world, double x, double y, double z)ItemEntity(World world, double x, double y, double z, ItemStack stack) -
Method Summary
Modifier and Type Method Description private voidapplyWaterBuoyancy()protected booleancanClimb()private booleancanMerge()static booleancanMerge(ItemStack stack1, ItemStack stack2)booleancannotPickup()Returns whether the pickup delay of this item entity is greater than 0.Packet<?>createSpawnPacket()booleandamage(DamageSource source, float amount)intgetItemAge()Returns the number of ticks since this item entity has been created.TextgetName()UUIDgetOwner()Returns the UUID of the entity to which belongs this item entity, ornullif there is not.ItemStackgetStack()Returns the item stack contained in this item entity.UUIDgetThrower()Returns the UUID of the entity which created this item entity by throwing an item, ornullif it was created otherwise.protected voidinitDataTracker()booleanisAttackable()booleanisFireImmune()private static voidmerge(ItemEntity targetEntity, ItemStack targetStack, ItemEntity sourceEntity, ItemStack sourceStack)private static voidmerge(ItemEntity targetEntity, ItemStack stack1, ItemStack stack2)static ItemStackmerge(ItemStack stack1, ItemStack stack2, int maxCount)private voidmethod_24348()floatmethod_27314(float float2)ItemEntitymethod_29271()EntitymoveToWorld(ServerWorld destination)Moves this entity to another world.voidonPlayerCollision(PlayerEntity player)voidonTrackedDataSet(TrackedData<?> data)voidreadCustomDataFromNbt(NbtCompound nbt)voidresetPickupDelay()Sets the number of ticks before this item entity can be picked up to 0.voidsetCovetedItem()voidsetDespawnImmediately()voidsetOwner(UUID uuid)Sets the owner of this item entity touuid.voidsetPickupDelay(int pickupDelay)Sets the number of ticks before this item entity can be picked up topickupDelay.voidsetPickupDelayInfinite()Makes this item entity impossible to be picked up by setting its pickup delay to 32767.voidsetStack(ItemStack stack)Sets the item stack contained in this item entity tostack.voidsetThrower(UUID uuid)Sets the thrower of this item entity touuid.voidsetToDefaultPickupDelay()Sets the number of ticks before this item entity can be picked up to the default value of 10.voidtick()private voidtryMerge()private voidtryMerge(ItemEntity other)voidwriteCustomDataToNbt(NbtCompound nbt)Methods inherited from class net.minecraft.entity.Entity
addPassenger, addScoreboardTag, addVelocity, adjustMovementForCollisions, adjustMovementForCollisions, adjustMovementForPiston, adjustMovementForSneaking, adjustSingleAxisMovementForCollisions, afterSpawn, animateDamage, applyMirror, applyRotation, baseTick, bypassesLandingEffects, bypassesSteppingEffects, calculateBoundsForPose, calculateDimensions, calculateNextStepSoundDistance, canAddPassenger, canAvoidTraps, canBeRiddenInWater, canBeSpectated, canExplosionDestroyBlock, canStartRiding, canUsePortals, changeLookDirection, checkBlockCollision, checkDespawn, checkWaterState, collides, collidesWith, copyFrom, copyPositionAndRotation, dealDamage, detach, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, equip, equipStack, extinguish, fall, getAir, getArmorItems, getBlockPos, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getClientCameraPosVec, getCommandSource, getCustomName, getDataTracker, getDefaultName, getDefaultNetherPortalCooldown, getDimensions, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeHeight, getEyeY, getFireTicks, getFlag, getFluidHeight, getHeadYaw, getHeight, getHeightOffset, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getItemsHand, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMaxNetherPortalTime, getMountedHeightOffset, getMovementDirection, getOppositeRotationVector, getOppositeRotationVector, getParticleX, getParticleZ, getPassengerDismountOffset, getPassengerList, getPassengersDeep, getPermissionLevel, getPistonBehavior, getPitch, getPos, getPose, getPrimaryPassenger, getRandomBodyY, getRenderDistanceMultiplier, getRootVehicle, getRotationClient, getRotationVec, getRotationVecClient, getRotationVector, getRotationVector, getSafeFallDistance, getSavedEntityId, getScoreboardTags, getScoreboardTeam, getServer, getSoundCategory, getSplashSound, getStandingEyeHeight, getSwimSound, getTargetingMargin, getTeamColorValue, getTeleportTarget, getTrackedPosition, getType, getUuid, getUuidAsString, getVehicle, getVelocity, getVelocityAffectingPos, getVelocityMultiplier, getVisibilityBoundingBox, getWidth, getX, getY, getYaw, getZ, handleAttack, handleFallDamage, handleStatus, hasCustomName, hashCode, hasNetherPortalCooldown, hasNoGravity, hasPassenger, hasPassengerDeep, hasPassengers, hasPassengerType, hasPermissionLevel, hasPlayerRider, hasVehicle, hasWings, interact, interactAt, isAlive, isChunkPosUpdateRequested, isCollidable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWall, isInsideWaterOrBubbleColumn, isInSneakingPose, isInSwimmingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isLogicalSideForUpdatingMovement, isOnFire, isOnGround, isPartOf, isPushable, isPushedByFluids, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, kill, lookAt, method_29239, method_29241, method_29919, method_30076, method_30330, method_30632, method_30633, method_30950, method_30951, move, moveToBoundingBoxCenter, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onStartedTrackingBy, onStoppedTrackingBy, onStruckByLightning, onSwimmingStart, playFlySound, playSound, playStepSound, playSwimSound, populateCrashReport, pushAwayFrom, pushOutOfBlocks, raycast, readNbt, refreshPosition, refreshPositionAfterTeleport, refreshPositionAfterTeleport, refreshPositionAndAngles, refreshPositionAndAngles, remove, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetNetherPortalCooldown, resetPosition, saveNbt, saveSelfNbt, scheduleVelocityUpdate, sendSystemMessage, setAir, setBodyYaw, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, setFireTicks, setFlag, setGlowing, setHeadYaw, setInNetherPortal, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setOnGround, setPos, setPose, setPosition, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSprinting, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, setWorld, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldRenderName, shouldSetPositionOnLoad, shouldSpawnSprintingParticles, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, startRiding, stopRiding, streamPassengersRecursively, teleport, teleportRequested, tickInVoid, tickNetherPortal, tickNetherPortalCooldown, tickRiding, toNbtList, toNbtList, toString, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateSwimming, updateTrackedHeadRotation, updateTrackedPosition, updateTrackedPosition, updateTrackedPositionAndAngles, updateVelocity, updateWaterState, wouldPoseNotCollide, writeNbt
-
Field Details
-
STACK
-
itemAge
private int itemAgeThe number of ticks since this item entity has been created. It is a short value with keyAgein the NBT structure.It differs from
Entity.age. -
pickupDelay
private int pickupDelay -
health
private int health -
thrower
-
owner
-
uniqueOffset
public final float uniqueOffset
-
-
Constructor Details
-
ItemEntity
-
ItemEntity
-
ItemEntity
-
ItemEntity
-
-
Method Details
-
canClimb
protected boolean canClimb() -
initDataTracker
protected void initDataTracker()- Specified by:
initDataTrackerin classEntity
-
tick
public void tick() -
applyWaterBuoyancy
private void applyWaterBuoyancy() -
method_24348
private void method_24348() -
tryMerge
private void tryMerge() -
canMerge
private boolean canMerge() -
tryMerge
-
canMerge
-
merge
-
merge
-
merge
private static void merge(ItemEntity targetEntity, ItemStack targetStack, ItemEntity sourceEntity, ItemStack sourceStack) -
isFireImmune
public boolean isFireImmune()- Overrides:
isFireImmunein classEntity
-
damage
-
writeCustomDataToNbt
- Specified by:
writeCustomDataToNbtin classEntity
-
readCustomDataFromNbt
- Specified by:
readCustomDataFromNbtin classEntity
-
onPlayerCollision
- Overrides:
onPlayerCollisionin classEntity
-
getName
-
isAttackable
public boolean isAttackable()- Overrides:
isAttackablein classEntity
-
moveToWorld
Moves this entity to another world.Note all entities except server player entities are completely recreated at the destination.
- Overrides:
moveToWorldin classEntity- Returns:
- the entity in the other world
-
getStack
Returns the item stack contained in this item entity. -
setStack
Sets the item stack contained in this item entity tostack. -
onTrackedDataSet
- Overrides:
onTrackedDataSetin classEntity
-
getOwner
Returns the UUID of the entity to which belongs this item entity, ornullif there is not.If there is one, the owner is the only entity which can pick up this item entity.
-
setOwner
Sets the owner of this item entity touuid.Used when an item is given to an entity, but this entity does not have enough space in its inventory.
-
getThrower
Returns the UUID of the entity which created this item entity by throwing an item, ornullif it was created otherwise. -
setThrower
Sets the thrower of this item entity touuid. -
getItemAge
@Environment(CLIENT) public int getItemAge()Returns the number of ticks since this item entity has been created.Increases every tick. When it equals to 6000 ticks (5 minutes), this item entity disappears.
Unlike Entity.age, it is persistent and not synchronized between the client and the server.
- See Also:
tick()
-
setToDefaultPickupDelay
public void setToDefaultPickupDelay()Sets the number of ticks before this item entity can be picked up to the default value of 10. -
resetPickupDelay
public void resetPickupDelay()Sets the number of ticks before this item entity can be picked up to 0. -
setPickupDelayInfinite
public void setPickupDelayInfinite()Makes this item entity impossible to be picked up by setting its pickup delay to 32767. -
setPickupDelay
public void setPickupDelay(int pickupDelay)Sets the number of ticks before this item entity can be picked up topickupDelay. -
cannotPickup
public boolean cannotPickup()Returns whether the pickup delay of this item entity is greater than 0. -
setCovetedItem
public void setCovetedItem() -
setDespawnImmediately
public void setDespawnImmediately() -
method_27314
@Environment(CLIENT) public float method_27314(float float2) -
createSpawnPacket
- Specified by:
createSpawnPacketin classEntity
-
method_29271
-