Package net.minecraft.world.entity.item
Class ItemEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.entity.Entity
net.minecraft.world.entity.item.ItemEntity
- All Implemented Interfaces:
DataComponentGetter,SyncedDataHolder,DebugValueSource,ItemOwner,TraceableEntity,EntityAccess,UniquelyIdentifyable,Nameable,ScoreHolder,IAttachmentHolder,IEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.Entity
Entity.MoveFunction, Entity.MovementEmission, Entity.RemovalReasonNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface net.minecraft.util.debug.DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T>Nested classes/interfaces inherited from interface net.minecraft.world.entity.ItemOwner
ItemOwner.OffsetFromOwner -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intfinal floatprivate static final EntityDataAccessor<ItemStack> private static final shortprivate static final intprivate static final shortstatic final floatprivate static final floatprivate intprivate static final intprivate static final intintThe maximum age of this EntityItem.private static final intprivate intprivate UUIDprivate EntityReference<Entity> Fields inherited from class net.minecraft.world.entity.Entity
BASE_SAFE_FALL_DISTANCE, BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, CONTENTS_SLOT_INDEX, DATA_POSE, DATA_SHARED_FLAGS_ID, DEFAULT_BB_HEIGHT, DEFAULT_BB_WIDTH, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5, DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0, ENTITY_COUNTER, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, MAX_MOVEMENTS_HANDELED_PER_TICK, minorHorizontalCollision, moveDist, noPhysics, portalProcess, random, stringUUID, stuckSpeedMultiplier, TAG_AIR, TAG_CUSTOM_NAME, TAG_DATA, TAG_FALL_DISTANCE, TAG_FIRE, TAG_GLOWING, TAG_ID, TAG_INVULNERABLE, TAG_MOTION, TAG_NO_GRAVITY, TAG_ON_GROUND, TAG_PASSENGERS, TAG_PORTAL_COOLDOWN, TAG_POS, TAG_ROTATION, TAG_SILENT, TAG_UUID, tickCount, TOTAL_AIR_SUPPLY, uuid, verticalCollision, verticalCollisionBelow, wasEyeInWater, wasInPowderSnow, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOldFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionItemEntity(EntityType<? extends ItemEntity> p_31991_, Level p_31992_) ItemEntity(Level pLevel, double pPosX, double pPosY, double pPosZ, ItemStack pItemStack) ItemEntity(Level pLevel, double pPosX, double pPosY, double pPosZ, ItemStack pItemStack, double pDeltaX, double pDeltaY, double pDeltaZ) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalSaveData(ValueOutput p_421930_) static booleanareMergable(ItemStack pDestinationStack, ItemStack pOriginStack) booleanprotected voiddefineSynchedData(SynchedEntityData.Builder p_326372_) booleanintgetAge()protected doublegetItem()protected Entity.MovementEmissiongetName()getOwner()getSlot(int p_333779_) static floatgetSpin(float pAge, float pBobOffset) Neo: Add getter for ItemEntity'starget.floatbooleanfinal booleanhurtClient(DamageSource p_376799_) final booleanhurtServer(ServerLevel p_376942_, DamageSource p_376452_, float p_376562_) booleanignoreExplosion(Explosion p_364217_) booleanprivate booleanvoidprivate static voidmerge(ItemEntity pDestinationEntity, ItemStack pDestinationStack, ItemEntity pOriginEntity, ItemStack pOriginStack) private static voidmerge(ItemEntity pDestinationEntity, ItemStack pDestinationStack, ItemStack pOriginStack) static ItemStackprivate voidvoidonSyncedDataUpdated(EntityDataAccessor<?> pKey) voidplayerTouch(Player pEntity) Called by a player entity when they collide with an entityprotected voidreadAdditionalSaveData(ValueInput p_421942_) voidrestoreFrom(Entity p_305965_) Prepares this entity in new dimension by copying NBT data from entity in old dimensionvoidvoidprivate voidsetFluidMovement(double pMultiplier) voidSets the item that this entity represents.voidvoidvoidsetPickUpDelay(int pPickupDelay) voidvoidsetThrower(Entity pThrower) private voidprivate voidvoidprotected booleanteleport(TeleportTransition p_379799_) voidtick()private voidtryToMerge(ItemEntity pItemEntity) Methods inherited from class net.minecraft.world.entity.Entity
absSnapRotationTo, absSnapTo, absSnapTo, addDeltaMovement, addPassenger, addTag, adjustSpawnLocation, animateHurt, applyComponentsFromItemStack, applyEffectsFromBlocks, applyEffectsFromBlocks, applyGravity, applyImplicitComponent, applyImplicitComponentIfPresent, applyImplicitComponents, awardKillScore, baseTick, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canCollideWith, canControlVehicle, canFreeze, canInteractWithLevel, canRide, canSimulateMovement, canSpawnSprintParticle, canSprint, canTeleport, canTrample, canUsePortal, captureDrops, captureDrops, castComponentValue, causeFallDamage, checkBelowWorld, checkDespawn, checkFallDamage, checkFallDistanceAccumulation, checkSupportingBlock, chunkPosition, clearFire, clearFreeze, clearMovementThisTick, closerThan, closerThan, collectAllColliders, collideBoundingBox, collidedWithFluid, collidedWithShapeMovingFrom, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, dropAllLeashConnections, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, get, getAddEntityPacket, getAirSupply, getAttachments, getAvailableSpaceBelow, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockSpeedFactor, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getCapability, getCapability, getCollisionHorizontalEscapeVector, getControlledVehicle, getControllingPassenger, getCustomName, getDefaultPassengerAttachmentPoint, getDeltaMovement, getDimensionChangingDelay, getDimensions, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getEyeHeight, getEyeHeight, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getGravity, getHandHoldingItemAngle, getId, getInBlockState, getIndirectPassengers, getInputVector, getInterpolation, getKnownMovement, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getLootTable, getMaxAirSupply, getMaxFallDistance, getMaxHeightFluidType, getMotionDirection, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, getPassengerRidingPosition, getPassengers, getPassengersAndSelf, getPercentFrozen, getPersistentData, getPickRadius, getPickResult, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPreciseBodyRotation, getPrimaryStepSoundBlockPos, getQuadLeashHolderOffsets, getRandom, getRandomX, getRandomY, getRandomZ, getRelativePortalPosition, getRemainingFireTicks, getRemovalReason, getRequiresPrecisePosition, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getSharedFlag, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getTypeName, getUpVector, getUUID, getVehicle, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getViewYRot, getWeaponItem, getX, getX, getXRot, getXRot, getY, getY, getYHeadRot, getYRot, getYRot, getZ, getZ, handleDamageEvent, handleEntityEvent, handleOnAboveBubbleColumn, handleOnInsideBubbleColumn, handlePortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPose, hurt, hurtOrSimulate, igniteForSeconds, igniteForTicks, interact, interactAt, is, isAddedToLevel, isAffectedByBlocks, isAlive, isAlliedTo, isAlliedTo, isAlwaysTicking, isClientAuthoritative, isColliding, isCrouching, isCurrentlyGlowing, isCustomNameVisible, isDescending, isDiscrete, isEffectiveAi, isEyeInFluid, isFlapping, isFlyingVehicle, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInClouds, isInFluidType, isInFluidType, isInLava, isInLiquid, isInShallowWater, isInterpolating, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableToBase, isInWall, isInWater, isInWaterOrRain, isLocalClientAuthoritative, isLocalInstanceAuthoritative, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPickable, isPushable, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, killedEntity, lavaHurt, lavaIgnite, lerpHeadTo, lerpMotion, lerpPositionAndRotationStep, level, limitPistonMovement, load, lookAt, makeBoundingBox, makeBoundingBox, makeStuckInBlock, markHurt, maxUpStep, maybeBackOffFromEdge, mayInteract, mirror, move, moveOrInterpolateTo, moveOrInterpolateTo, moveOrInterpolateTo, moveOrInterpolateTo, moveRelative, moveTowardsClosestSpace, nextStep, notifyLeasheeRemoved, notifyLeashHolder, oldPosition, onAboveBubbleColumn, onAddedToLevel, onBelowWorld, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onPassengerTurned, onRemoval, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, problemPath, processFlappingMovement, processPortalCooldown, propagateFallToPassengers, push, push, push, reapplyPosition, recreateFromPacket, refreshDimensions, registerDebugValues, registryAccess, remove, removeAfterChangingDimensions, removeLatestMovementRecording, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, revive, rideTick, rotate, save, saveAsPassenger, saveWithoutId, sendBubbleColumnParticles, setAirSupply, setAsInsidePortal, setBoundingBox, setComponent, setCustomName, setCustomNameVisible, setData, setDeltaMovement, setDeltaMovement, setFluidTypeHeight, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setLevel, setLevelCallback, setNoGravity, setOldPos, setOldPosAndRot, setOldPosAndRot, setOldRot, setOnGround, setOnGroundWithMovement, setOnGroundWithMovement, setPortalCooldown, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRequiresPrecisePosition, setRot, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSprinting, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYBodyRot, setYHeadRot, setYRot, shearOffAllLeashConnections, shouldBeSaved, shouldBlockExplode, shouldRender, shouldRenderAtSqrDistance, shouldShowName, showVehicleHealth, skipAttackInteraction, snapTo, snapTo, snapTo, snapTo, snapTo, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, supportQuadLeashAsHolder, syncData, syncPacketPositionCodec, teleportRelative, teleportSetPosition, teleportSetPosition, teleportSpectators, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoCanPushEntityFluidPushing, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSoundMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.core.component.DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, has, hasMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canSwimInFluidType, copyAttachmentsFrom, getClassification, getFluidFallDistanceModifier, getFluidMotionScale, getParts, getSoundFromFluidType, hasCustomOutlineRendering, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, sendPairingData, shouldRiderSitMethods inherited from interface net.minecraft.world.entity.ItemOwner
asLivingEntityMethods inherited from interface net.minecraft.world.Nameable
getPlainTextNameMethods inherited from interface net.minecraft.world.scores.ScoreHolder
getFeedbackDisplayName
-
Field Details
-
DATA_ITEM
-
FLOAT_HEIGHT
private static final float FLOAT_HEIGHT- See Also:
-
EYE_HEIGHT
public static final float EYE_HEIGHT- See Also:
-
LIFETIME
private static final int LIFETIME- See Also:
-
INFINITE_PICKUP_DELAY
private static final int INFINITE_PICKUP_DELAY- See Also:
-
INFINITE_LIFETIME
private static final int INFINITE_LIFETIME- See Also:
-
DEFAULT_HEALTH
private static final int DEFAULT_HEALTH- See Also:
-
DEFAULT_AGE
private static final short DEFAULT_AGE- See Also:
-
DEFAULT_PICKUP_DELAY
private static final short DEFAULT_PICKUP_DELAY- See Also:
-
age
private int age -
pickupDelay
private int pickupDelay -
health
private int health -
thrower
-
target
-
bobOffs
public final float bobOffs -
lifespan
public int lifespanThe maximum age of this EntityItem. The item is expired once this is reached.
-
-
Constructor Details
-
ItemEntity
-
ItemEntity
-
ItemEntity
-
-
Method Details
-
dampensVibrations
public boolean dampensVibrations()- Overrides:
dampensVibrationsin classEntity
-
getOwner
- Specified by:
getOwnerin interfaceTraceableEntity
-
restoreFrom
Description copied from class:EntityPrepares this entity in new dimension by copying NBT data from entity in old dimension- Overrides:
restoreFromin classEntity
-
getMovementEmission
- Overrides:
getMovementEmissionin classEntity
-
defineSynchedData
- Specified by:
defineSynchedDatain classEntity
-
getDefaultGravity
protected double getDefaultGravity()- Overrides:
getDefaultGravityin classEntity
-
tick
public void tick() -
getBlockPosBelowThatAffectsMyMovement
- Overrides:
getBlockPosBelowThatAffectsMyMovementin classEntity
-
setUnderwaterMovement
private void setUnderwaterMovement() -
setUnderLavaMovement
private void setUnderLavaMovement() -
setFluidMovement
private void setFluidMovement(double pMultiplier) -
mergeWithNeighbours
private void mergeWithNeighbours() -
isMergable
private boolean isMergable() -
tryToMerge
-
areMergable
-
merge
-
merge
private static void merge(ItemEntity pDestinationEntity, ItemStack pDestinationStack, ItemStack pOriginStack) -
merge
private static void merge(ItemEntity pDestinationEntity, ItemStack pDestinationStack, ItemEntity pOriginEntity, ItemStack pOriginStack) -
fireImmune
public boolean fireImmune()- Overrides:
fireImmunein classEntity
-
shouldPlayLavaHurtSound
protected boolean shouldPlayLavaHurtSound()- Overrides:
shouldPlayLavaHurtSoundin classEntity
-
hurtClient
- Overrides:
hurtClientin classEntity
-
hurtServer
- Specified by:
hurtServerin classEntity
-
ignoreExplosion
- Overrides:
ignoreExplosionin classEntity
-
addAdditionalSaveData
- Specified by:
addAdditionalSaveDatain classEntity
-
readAdditionalSaveData
- Specified by:
readAdditionalSaveDatain classEntity
-
playerTouch
Called by a player entity when they collide with an entity- Overrides:
playerTouchin classEntity
-
getName
-
isAttackable
public boolean isAttackable()- Overrides:
isAttackablein classEntity
-
teleport
-
getItem
-
setItem
Sets the item that this entity represents. -
onSyncedDataUpdated
- Specified by:
onSyncedDataUpdatedin interfaceSyncedDataHolder- Overrides:
onSyncedDataUpdatedin classEntity
-
setTarget
-
getTarget
Neo: Add getter for ItemEntity'starget.- Returns:
- The
targetthat can pick up this item entity (ifnull, anyone can pick it up)
-
setThrower
-
getAge
public int getAge() -
setDefaultPickUpDelay
public void setDefaultPickUpDelay() -
setNoPickUpDelay
public void setNoPickUpDelay() -
setNeverPickUp
public void setNeverPickUp() -
setPickUpDelay
public void setPickUpDelay(int pPickupDelay) -
hasPickUpDelay
public boolean hasPickUpDelay() -
setUnlimitedLifetime
public void setUnlimitedLifetime() -
setExtendedLifetime
public void setExtendedLifetime() -
makeFakeItem
public void makeFakeItem() -
getSpin
public static float getSpin(float pAge, float pBobOffset) -
getSoundSource
- Overrides:
getSoundSourcein classEntity
-
getVisualRotationYInDegrees
public float getVisualRotationYInDegrees()- Specified by:
getVisualRotationYInDegreesin interfaceItemOwner- Overrides:
getVisualRotationYInDegreesin classEntity
-
getSlot
-