Class AbstractArrow
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.entity.Entity
net.minecraft.world.entity.projectile.Projectile
net.minecraft.world.entity.projectile.arrow.AbstractArrow
- All Implemented Interfaces:
DataComponentGetter, TypedInstance<EntityType<?>>, SyncedDataHolder, DebugValueSource, ItemOwner, SlotProvider, TraceableEntity, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension
- Direct Known Subclasses:
Arrow, SpectralArrow, ThrownTrident
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Projectile
Projectile.ProjectileFactory<T>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 static final doubleprivate doubleprivate static final booleanprivate static final booleanprivate static final shortprivate static final byteprivate static final byteprivate @Nullable ItemStackprivate static final intprivate static final intprivate static final EntityDataAccessor<Byte> private static final EntityDataAccessor<Boolean> private static final floatprotected intprivate @Nullable BlockStateprivate intprivate ItemStackprivate static final EntityDataAccessor<Byte> private @Nullable it.unimi.dsi.fastutil.ints.IntOpenHashSetprivate static final intintprivate SoundEventprivate static final floatFields inherited from class Projectile
ownerFields 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
ConstructorsModifierConstructorDescriptionprotectedAbstractArrow(EntityType<? extends AbstractArrow> type, double x, double y, double z, Level level, ItemStack pickupItemStack, @Nullable ItemStack firedFromWeapon) protectedAbstractArrow(EntityType<? extends AbstractArrow> type, LivingEntity mob, Level level, ItemStack pickupItemStack, @Nullable ItemStack firedFromWeapon) protectedAbstractArrow(EntityType<? extends AbstractArrow> type, Level level) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalSaveData(ValueOutput output) private voidaddBubbleParticles(Vec3 position) private voidapplyInertia(float inertia) protected booleancanHitEntity(Entity entity) protected voiddefineSynchedData(SynchedEntityData.Builder entityData) protected voiddoKnockback(LivingEntity mob, DamageSource damageSource) protected voidprotected Collection<EntityHitResult> findHitEntities(Vec3 from, Vec3 to) protected @Nullable EntityHitResultfindHitEntity(Vec3 from, Vec3 to) Gets the EntityRayTraceResult representing the entity hitprotected doubleprotected SoundEventprotected abstract ItemStackprotected final SoundEventprotected Entity.MovementEmissionprotected ItemStackbyte@Nullable SlotAccessgetSlot(int slot) protected float@Nullable ItemStackprotected voidhitBlockEnchantmentEffects(ServerLevel serverLevel, BlockHitResult hitResult, ItemStack weapon) private ProjectileDeflectionhitTargetsOrDeflectSelf(Collection<EntityHitResult> entityHitResults) booleanbooleanprotected booleanbooleanbooleanbooleanvoidlerpMotion(Vec3 movement) voidvoidonAboveBubbleColumn(boolean dragDown, BlockPos pos) protected voidonHitBlock(BlockHitResult hitResult) protected voidonHitEntity(EntityHitResult hitResult) Called when the arrow hits an entityvoidonInsideBubbleColumn(boolean dragDown) voidonItemBreak(Item item) voidonSyncedDataUpdated(EntityDataAccessor<?> accessor) voidplayerTouch(Player player) Called by a player entity when they collide with an entityvoidpush(double xa, double ya, double za) Adds to the current velocity of the entity, and setsto true.invalid reference
#isAirBorneprotected voidreadAdditionalSaveData(ValueInput input) private voidvoidsetBaseDamage(double baseDamage) voidsetBaseDamageFromMob(float power) voidsetCritArrow(boolean critArrow) Whether the arrow has a stream of critical hit particles flying behind it.private voidsetFlag(int flag, boolean value) protected voidsetInGround(boolean inGround) voidsetNoPhysics(boolean noPhysics) Sets if this arrow can noClipvoidprotected voidsetPickupItemStack(ItemStack itemStack) private voidsetPierceLevel(byte pieceLevel) voidsetSoundEvent(SoundEvent soundEvent) voidshoot(double xd, double yd, double zd, float pow, float uncertainty) Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.protected booleanprivate booleanbooleanshouldRenderAtSqrDistance(double distance) Checks if the entity is in range to render.private voidprivate voidstepMoveAndHit(BlockHitResult blockHitResult) voidtick()protected voidprotected booleanMethods inherited from class Projectile
applyOnProjectileSpawned, calculateHorizontalHurtKnockbackDirection, checkLeftOwner, deflect, getAddEntityPacket, getDimensionChangingDelay, getEffectSource, getMovementToShoot, getOwner, getPickRadius, hitTargetOrDeflectSelf, hurtServer, lerpRotation, mayBreak, mayInteract, onDeflection, onHit, ownedBy, recreateFromPacket, restoreFrom, setOwner, shootFromRotation, spawnProjectile, spawnProjectile, spawnProjectileFromRotation, spawnProjectileUsingShoot, spawnProjectileUsingShoot, updateRotationMethods 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, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, dropAllLeashConnections, ejectPassengers, entityTags, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, get, getAirSupply, getAttachments, getAvailableSpaceBelow, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockSpeedFactor, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getCapability, getCapability, getCollisionHorizontalEscapeVector, getControlledVehicle, getControllingPassenger, getCustomName, getDefaultPassengerAttachmentPoint, getDeltaMovement, 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, getName, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, getPassengerRidingPosition, getPassengers, getPassengersAndSelf, getPercentFrozen, getPersistentData, getPickResult, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPreciseBodyRotation, getPrimaryStepSoundBlockPos, getQuadLeashHolderOffsets, getRandom, getRandomX, getRandomY, getRandomZ, getRelativePortalPosition, getRemainingFireTicks, getRemovalReason, getRequiresPrecisePosition, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getTypeName, getUpVector, getUUID, getVehicle, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getViewYRot, getVisualRotationYInDegrees, 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, hurtClient, hurtOrSimulate, igniteForSeconds, igniteForTicks, ignoreExplosion, 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, isPushable, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, killedEntity, lavaHurt, lavaIgnite, lerpHeadTo, lerpPositionAndRotationStep, level, limitPistonMovement, load, lookAt, makeBoundingBox, makeBoundingBox, makeStuckInBlock, markHurt, maxUpStep, maybeBackOffFromEdge, mirror, moveOrInterpolateTo, moveOrInterpolateTo, moveOrInterpolateTo, moveOrInterpolateTo, moveRelative, moveTowardsClosestSpace, nextStep, notifyLeasheeRemoved, notifyLeashHolder, oldPosition, onAddedToLevel, onBelowWorld, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onPassengerTurned, onRemoval, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, problemPath, processFlappingMovement, processPortalCooldown, propagateFallToPassengers, push, push, reapplyPosition, 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, shouldPlayLavaHurtSound, shouldRender, shouldShowName, showVehicleHealth, skipAttackInteraction, snapTo, snapTo, snapTo, snapTo, snapTo, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, supportQuadLeashAsHolder, syncData, syncPacketPositionCodec, teleport, 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
-
ARROW_BASE_DAMAGE
private static final double ARROW_BASE_DAMAGE- See Also:
-
SHAKE_TIME
private static final int SHAKE_TIME- See Also:
-
WATER_INERTIA
private static final float WATER_INERTIA- See Also:
-
INERTIA
private static final float INERTIA- See Also:
-
DEFAULT_LIFE
private static final short DEFAULT_LIFE- See Also:
-
DEFAULT_SHAKE
private static final byte DEFAULT_SHAKE- See Also:
-
DEFAULT_IN_GROUND
private static final boolean DEFAULT_IN_GROUND- See Also:
-
DEFAULT_CRIT
private static final boolean DEFAULT_CRIT- See Also:
-
DEFAULT_PIERCE_LEVEL
private static final byte DEFAULT_PIERCE_LEVEL- See Also:
-
ID_FLAGS
-
PIERCE_LEVEL
-
IN_GROUND
-
FLAG_CRIT
private static final int FLAG_CRIT- See Also:
-
FLAG_NOPHYSICS
private static final int FLAG_NOPHYSICS- See Also:
-
lastState
-
inGroundTime
protected int inGroundTime -
pickup
-
shakeTime
public int shakeTime -
life
private int life -
baseDamage
private double baseDamage -
soundEvent
-
piercingIgnoreEntityIds
private @Nullable it.unimi.dsi.fastutil.ints.IntOpenHashSet piercingIgnoreEntityIds -
piercedAndKilledEntities
-
pickupItemStack
-
firedFromWeapon
-
-
Constructor Details
-
AbstractArrow
-
AbstractArrow
protected AbstractArrow(EntityType<? extends AbstractArrow> type, double x, double y, double z, Level level, ItemStack pickupItemStack, @Nullable ItemStack firedFromWeapon) -
AbstractArrow
protected AbstractArrow(EntityType<? extends AbstractArrow> type, LivingEntity mob, Level level, ItemStack pickupItemStack, @Nullable ItemStack firedFromWeapon)
-
-
Method Details
-
setSoundEvent
-
shouldRenderAtSqrDistance
public boolean shouldRenderAtSqrDistance(double distance) Checks if the entity is in range to render.- Overrides:
shouldRenderAtSqrDistancein classEntity
-
defineSynchedData
- Specified by:
defineSynchedDatain classEntity
-
shoot
public void shoot(double xd, double yd, double zd, float pow, float uncertainty) Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.- Overrides:
shootin classProjectile
-
lerpMotion
- Overrides:
lerpMotionin classEntity
-
onSyncedDataUpdated
- Specified by:
onSyncedDataUpdatedin interfaceSyncedDataHolder- Overrides:
onSyncedDataUpdatedin classEntity
-
tick
public void tick()- Overrides:
tickin classProjectile
-
stepMoveAndHit
-
hitTargetsOrDeflectSelf
-
applyInertia
private void applyInertia(float inertia) -
addBubbleParticles
-
getDefaultGravity
protected double getDefaultGravity()- Overrides:
getDefaultGravityin classEntity
-
shouldFall
private boolean shouldFall() -
startFalling
private void startFalling() -
isInGround
protected boolean isInGround() -
setInGround
protected void setInGround(boolean inGround) -
isPushedByFluid
public boolean isPushedByFluid()- Overrides:
isPushedByFluidin classEntity
-
move
-
tickDespawn
protected void tickDespawn() -
resetPiercedEntities
private void resetPiercedEntities() -
onItemBreak
- Overrides:
onItemBreakin classProjectile
-
onAboveBubbleColumn
- Overrides:
onAboveBubbleColumnin classProjectile
-
onInsideBubbleColumn
public void onInsideBubbleColumn(boolean dragDown) - Overrides:
onInsideBubbleColumnin classProjectile
-
push
-
onHitEntity
Called when the arrow hits an entity- Overrides:
onHitEntityin classProjectile
-
doKnockback
-
onHitBlock
- Overrides:
onHitBlockin classProjectile
-
hitBlockEnchantmentEffects
protected void hitBlockEnchantmentEffects(ServerLevel serverLevel, BlockHitResult hitResult, ItemStack weapon) -
getWeaponItem
- Overrides:
getWeaponItemin classEntity
-
getDefaultHitGroundSoundEvent
-
getHitGroundSoundEvent
-
doPostHurtEffects
-
findHitEntity
Gets the EntityRayTraceResult representing the entity hit -
findHitEntities
-
canHitEntity
- Overrides:
canHitEntityin classProjectile
-
addAdditionalSaveData
- Overrides:
addAdditionalSaveDatain classProjectile
-
readAdditionalSaveData
- Overrides:
readAdditionalSaveDatain classProjectile
-
setOwner
- Overrides:
setOwnerin classProjectile
-
playerTouch
Called by a player entity when they collide with an entity- Overrides:
playerTouchin classEntity
-
tryPickup
-
getPickupItem
-
getDefaultPickupItem
-
getMovementEmission
- Overrides:
getMovementEmissionin classEntity
-
getPickupItemStackOrigin
-
setBaseDamage
public void setBaseDamage(double baseDamage) -
isAttackable
public boolean isAttackable()- Overrides:
isAttackablein classEntity
-
setCritArrow
public void setCritArrow(boolean critArrow) Whether the arrow has a stream of critical hit particles flying behind it. -
setPierceLevel
private void setPierceLevel(byte pieceLevel) -
setFlag
private void setFlag(int flag, boolean value) -
setPickupItemStack
-
isCritArrow
public boolean isCritArrow() -
getPierceLevel
public byte getPierceLevel() -
setBaseDamageFromMob
public void setBaseDamageFromMob(float power) -
getWaterInertia
protected float getWaterInertia() -
setNoPhysics
public void setNoPhysics(boolean noPhysics) Sets if this arrow can noClip -
isNoPhysics
public boolean isNoPhysics() -
isPickable
public boolean isPickable()- Overrides:
isPickablein classProjectile
-
getSlot
- Specified by:
getSlotin interfaceSlotProvider- Overrides:
getSlotin classEntity
-
shouldBounceOnWorldBorder
protected boolean shouldBounceOnWorldBorder()- Overrides:
shouldBounceOnWorldBorderin classProjectile
-