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.AbstractArrow
- All Implemented Interfaces:
DataComponentGetter,SyncedDataHolder,TraceableEntity,EntityAccess,UniquelyIdentifyable,Nameable,ScoreHolder,IAttachmentHolder,IEntityExtension
- Direct Known Subclasses:
Arrow,SpectralArrow,ThrownTrident
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.minecraft.world.entity.projectile.Projectile
Projectile.ProjectileFactory<T extends Projectile>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.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleprivate doubleprivate static final booleanprivate static final booleanprivate static final shortprivate static final byteprivate static final byteprivate ItemStackprivate static final intprivate static final intprivate static final EntityDataAccessor<Byte> private static final EntityDataAccessor<Boolean> private static final floatprotected intprivate BlockStateprivate intprivate ItemStackprivate static final EntityDataAccessor<Byte> private it.unimi.dsi.fastutil.ints.IntOpenHashSetprivate static final intintprivate SoundEventprivate static final floatFields inherited from class net.minecraft.world.entity.projectile.Projectile
ownerFields 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_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
ConstructorsModifierConstructorDescriptionprotectedAbstractArrow(EntityType<? extends AbstractArrow> pEntityType, double pX, double pY, double pZ, Level pLevel, ItemStack pPickupItemStack, ItemStack pFiredFromWeapon) protectedAbstractArrow(EntityType<? extends AbstractArrow> pEntityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, ItemStack pFiredFromWeapon) protectedAbstractArrow(EntityType<? extends AbstractArrow> pEntityType, Level pLevel) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalSaveData(ValueOutput pOutput) private voidaddBubbleParticles(Vec3 pPos) private voidapplyInertia(float pInertia) protected booleancanHitEntity(Entity p_36743_) protected voiddefineSynchedData(SynchedEntityData.Builder pBuilder) protected voiddoKnockback(LivingEntity pEntity, DamageSource pDamageSource) protected voiddoPostHurtEffects(LivingEntity pTarget) protected EntityHitResultfindHitEntity(Vec3 pStartVec, Vec3 pEndVec) Gets the EntityRayTraceResult representing the entity hitprotected doubleprotected SoundEventprotected abstract ItemStackprotected final SoundEventprotected Entity.MovementEmissionprotected ItemStackbytegetSlot(int pSlot) protected floatprotected voidhitBlockEnchantmentEffects(ServerLevel pLevel, BlockHitResult pHitResult, ItemStack pStack) booleanbooleanprotected booleanbooleanbooleanbooleanvoidlerpMotion(double pX, double pY, double pZ) Updates the entity motion clientside, called by packets from the servervoidvoidonAboveBubbleColumn(boolean pDownwards, BlockPos pPos) protected voidonHitBlock(BlockHitResult pResult) protected voidonHitEntity(EntityHitResult pResult) Called when the arrow hits an entityvoidonInsideBubbleColumn(boolean pDownwards) protected voidonItemBreak(Item pItem) voidonSyncedDataUpdated(EntityDataAccessor<?> pKey) voidplayerTouch(Player pEntity) Called by a player entity when they collide with an entityvoidpush(double pX, double pY, double pZ) Adds to the current velocity of the entity, and setsto true.invalid reference
#isAirBorneprotected voidreadAdditionalSaveData(ValueInput pInput) private voidvoidsetBaseDamage(double pBaseDamage) voidsetBaseDamageFromMob(float pVelocity) voidsetCritArrow(boolean pCritArrow) Whether the arrow has a stream of critical hit particles flying behind it.private voidsetFlag(int pId, boolean pValue) protected voidsetInGround(boolean pInGround) voidsetNoPhysics(boolean pNoPhysics) Sets if this arrow can noClipvoidprotected voidsetPickupItemStack(ItemStack p_331486_) private voidsetPierceLevel(byte pPierceLevel) voidsetSoundEvent(SoundEvent pSoundEvent) voidshoot(double pX, double pY, double pZ, float pVelocity, float pInaccuracy) Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.protected booleanprivate booleanbooleanshouldRenderAtSqrDistance(double pDistance) Checks if the entity is in range to render.private voidprivate voidstepMoveAndHit(BlockHitResult pHitResult) voidtick()protected voidprotected booleanMethods inherited from class net.minecraft.world.entity.projectile.Projectile
applyOnProjectileSpawned, calculateHorizontalHurtKnockbackDirection, 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 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, canRide, canSimulateMovement, canSpawnSprintParticle, canSprint, canTeleport, canTrample, canUsePortal, captureDrops, captureDrops, castComponentValue, causeFallDamage, checkBelowWorld, checkDespawn, checkFallDamage, checkFallDistanceAccumulation, checkSupportingBlock, chunkPosition, clearFire, clearFreeze, clearMovementThisTick, closerThan, closerThan, collideBoundingBox, collidedWithFluid, collidedWithShapeMovingFrom, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, dropAllLeashConnections, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, get, getAirSupply, getAttachments, 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, getId, getInBlockState, getIndirectPassengers, getInputVector, getInterpolation, getKnownMovement, 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, getServer, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, 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, hasPassenger, hasPassenger, hasPose, hurt, hurtClient, hurtOrSimulate, igniteForSeconds, igniteForTicks, ignoreExplosion, 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, 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, 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, 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, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, supportQuadLeashAsHolder, syncData, syncPacketPositionCodec, teleport, teleportRelative, 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.scores.ScoreHolder
getFeedbackDisplayName
-
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
@Nullable private it.unimi.dsi.fastutil.ints.IntOpenHashSet piercingIgnoreEntityIds -
piercedAndKilledEntities
-
pickupItemStack
-
firedFromWeapon
-
-
Constructor Details
-
AbstractArrow
-
AbstractArrow
protected AbstractArrow(EntityType<? extends AbstractArrow> pEntityType, double pX, double pY, double pZ, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon) -
AbstractArrow
protected AbstractArrow(EntityType<? extends AbstractArrow> pEntityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon)
-
-
Method Details
-
setSoundEvent
-
shouldRenderAtSqrDistance
public boolean shouldRenderAtSqrDistance(double pDistance) Checks if the entity is in range to render.- Overrides:
shouldRenderAtSqrDistancein classEntity
-
defineSynchedData
- Specified by:
defineSynchedDatain classEntity
-
shoot
public void shoot(double pX, double pY, double pZ, float pVelocity, float pInaccuracy) Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.- Overrides:
shootin classProjectile
-
lerpMotion
public void lerpMotion(double pX, double pY, double pZ) Updates the entity motion clientside, called by packets from the server- Overrides:
lerpMotionin classEntity
-
onSyncedDataUpdated
- Specified by:
onSyncedDataUpdatedin interfaceSyncedDataHolder- Overrides:
onSyncedDataUpdatedin classEntity
-
tick
public void tick()- Overrides:
tickin classProjectile
-
stepMoveAndHit
-
applyInertia
private void applyInertia(float pInertia) -
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 pInGround) -
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 pDownwards) - Overrides:
onInsideBubbleColumnin classProjectile
-
push
public void push(double pX, double pY, double pZ) Adds to the current velocity of the entity, and setsto true.invalid reference
#isAirBorne -
onHitEntity
Called when the arrow hits an entity- Overrides:
onHitEntityin classProjectile
-
doKnockback
-
onHitBlock
- Overrides:
onHitBlockin classProjectile
-
hitBlockEnchantmentEffects
protected void hitBlockEnchantmentEffects(ServerLevel pLevel, BlockHitResult pHitResult, ItemStack pStack) -
getWeaponItem
- Overrides:
getWeaponItemin classEntity
-
getDefaultHitGroundSoundEvent
-
getHitGroundSoundEvent
-
doPostHurtEffects
-
findHitEntity
Gets the EntityRayTraceResult representing the entity hit -
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 pBaseDamage) -
isAttackable
public boolean isAttackable()- Overrides:
isAttackablein classEntity
-
setCritArrow
public void setCritArrow(boolean pCritArrow) Whether the arrow has a stream of critical hit particles flying behind it. -
setPierceLevel
private void setPierceLevel(byte pPierceLevel) -
setFlag
private void setFlag(int pId, boolean pValue) -
setPickupItemStack
-
isCritArrow
public boolean isCritArrow() -
getPierceLevel
public byte getPierceLevel() -
setBaseDamageFromMob
public void setBaseDamageFromMob(float pVelocity) -
getWaterInertia
protected float getWaterInertia() -
setNoPhysics
public void setNoPhysics(boolean pNoPhysics) Sets if this arrow can noClip -
isNoPhysics
public boolean isNoPhysics() -
isPickable
public boolean isPickable()- Overrides:
isPickablein classProjectile
-
getSlot
-
shouldBounceOnWorldBorder
protected boolean shouldBounceOnWorldBorder()- Overrides:
shouldBounceOnWorldBorderin classProjectile
-