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, TypedInstance<EntityType<?>>, SyncedDataHolder, DebugValueSource, ItemOwner, SlotProvider, TraceableEntity, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class Entity
Entity.Flags, Entity.MoveFunction, Entity.MovementEmission, Entity.RemovalReasonNested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T>Nested classes/interfaces inherited from interface 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 @Nullable UUIDprivate @Nullable EntityReference<Entity> Fields inherited from class 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, horizontalCollision, hurtMarked, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, MAX_MOVEMENTS_HANDELED_PER_TICK, minorHorizontalCollision, moveDist, needsSync, 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 AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface ScoreHolder
WILDCARD, WILDCARD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionItemEntity(EntityType<? extends ItemEntity> type, Level level) ItemEntity(Level level, double x, double y, double z, ItemStack itemStack) ItemEntity(Level level, double x, double y, double z, ItemStack itemStack, double deltaX, double deltaY, double deltaZ) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalSaveData(ValueOutput output) static booleanareMergable(ItemStack thisItemStack, ItemStack otherItemStack) booleanprotected voiddefineSynchedData(SynchedEntityData.Builder entityData) booleanintgetAge()protected doublegetItem()protected Entity.MovementEmissiongetName()@Nullable EntitygetOwner()@Nullable SlotAccessgetSlot(int slot) static floatgetSpin(float ageInTicks, float bobOffset) @Nullable UUIDNeo: Add getter for ItemEntity'starget.floatbooleanfinal booleanhurtClient(DamageSource source) final booleanhurtServer(ServerLevel level, DamageSource source, float damage) booleanignoreExplosion(Explosion explosion) booleanprivate booleanvoidprivate static voidmerge(ItemEntity toItem, ItemStack toStack, ItemEntity fromItem, ItemStack fromStack) private static voidmerge(ItemEntity toItem, ItemStack toStack, ItemStack fromStack) static ItemStackprivate voidvoidplayerTouch(Player player) Called by a player entity when they collide with an entityprotected voidreadAdditionalSaveData(ValueInput input) voidrestoreFrom(Entity oldEntity) Prepares this entity in new dimension by copying NBT data from entity in old dimensionvoidvoidprivate voidsetFluidMovement(double multiplier) voidSets the item that this entity represents.voidvoidvoidsetPickUpDelay(int ticks) voidvoidsetThrower(Entity thrower) private voidprivate voidvoidprotected boolean@Nullable Entityteleport(TeleportTransition transition) voidtick()private voidtryToMerge(ItemEntity other) Methods inherited from class 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, computeSpeed, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, dropAllLeashConnections, ejectPassengers, entityTags, 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, getHeadLookAngle, getId, getInBlockState, getIndirectPassengers, getInputVector, getInterpolation, getKnownMovement, getKnownSpeed, 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, 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, hasMovedHorizontallyRecently, hasPassenger, hasPassenger, hasPose, hurt, hurtOrSimulate, igniteForSeconds, igniteForTicks, interact, 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, 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, typeHolder, unRide, unsetRemoved, updateDataBeforeSync, updateDynamicGameEventListener, updateFluidHeightAndDoCanPushEntityFluidPushing, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSoundMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachmentsMethods inherited from interface DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, has, hasMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface 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 ItemOwner
asLivingEntityMethods inherited from interface Nameable
getPlainTextNameMethods inherited from interface ScoreHolder
getFeedbackDisplayNameMethods inherited from interface SlotProvider
getSlotsFromRange
-
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
-
getBlockPosBelowThatAffectsMyMovement
- Overrides:
getBlockPosBelowThatAffectsMyMovementin classEntity
-
setUnderwaterMovement
private void setUnderwaterMovement() -
setUnderLavaMovement
private void setUnderLavaMovement() -
setFluidMovement
private void setFluidMovement(double multiplier) -
mergeWithNeighbours
private void mergeWithNeighbours() -
isMergable
private boolean isMergable() -
tryToMerge
-
areMergable
-
merge
-
merge
-
merge
private static void merge(ItemEntity toItem, ItemStack toStack, ItemEntity fromItem, ItemStack fromStack) -
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. -
setTarget
-
getTarget
-
setThrower
-
getAge
public int getAge() -
setDefaultPickUpDelay
public void setDefaultPickUpDelay() -
setNoPickUpDelay
public void setNoPickUpDelay() -
setNeverPickUp
public void setNeverPickUp() -
setPickUpDelay
public void setPickUpDelay(int ticks) -
hasPickUpDelay
public boolean hasPickUpDelay() -
setUnlimitedLifetime
public void setUnlimitedLifetime() -
setExtendedLifetime
public void setExtendedLifetime() -
makeFakeItem
public void makeFakeItem() -
getSpin
public static float getSpin(float ageInTicks, float bobOffset) -
getSoundSource
- Overrides:
getSoundSourcein classEntity
-
getVisualRotationYInDegrees
public float getVisualRotationYInDegrees()- Specified by:
getVisualRotationYInDegreesin interfaceItemOwner- Overrides:
getVisualRotationYInDegreesin classEntity
-
getSlot
- Specified by:
getSlotin interfaceSlotProvider- Overrides:
getSlotin classEntity
-