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.RemovalReason
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
private double
private static final boolean
private static final boolean
private static final short
private static final byte
private static final byte
private ItemStack
private static final int
private static final int
private static final EntityDataAccessor
<Byte> private static final EntityDataAccessor
<Boolean> private static final float
protected int
private BlockState
private int
private ItemStack
private static final EntityDataAccessor
<Byte> private it.unimi.dsi.fastutil.ints.IntOpenHashSet
private static final int
int
private SoundEvent
private static final float
Fields inherited from class net.minecraft.world.entity.projectile.Projectile
owner
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_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, zOld
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
Fields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractArrow
(EntityType<? extends AbstractArrow> pEntityType, double pX, double pY, double pZ, Level pLevel, ItemStack pPickupItemStack, ItemStack pFiredFromWeapon) protected
AbstractArrow
(EntityType<? extends AbstractArrow> pEntityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, ItemStack pFiredFromWeapon) protected
AbstractArrow
(EntityType<? extends AbstractArrow> pEntityType, Level pLevel) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalSaveData
(ValueOutput pOutput) private void
addBubbleParticles
(Vec3 pPos) private void
applyInertia
(float pInertia) protected boolean
canHitEntity
(Entity p_36743_) protected void
defineSynchedData
(SynchedEntityData.Builder pBuilder) protected void
doKnockback
(LivingEntity pEntity, DamageSource pDamageSource) protected void
doPostHurtEffects
(LivingEntity pTarget) protected EntityHitResult
findHitEntity
(Vec3 pStartVec, Vec3 pEndVec) Gets the EntityRayTraceResult representing the entity hitprotected double
protected SoundEvent
protected abstract ItemStack
protected final SoundEvent
protected Entity.MovementEmission
protected ItemStack
byte
getSlot
(int pSlot) protected float
protected void
hitBlockEnchantmentEffects
(ServerLevel pLevel, BlockHitResult pHitResult, ItemStack pStack) boolean
boolean
protected boolean
boolean
boolean
boolean
void
lerpMotion
(double pX, double pY, double pZ) Updates the entity motion clientside, called by packets from the servervoid
void
onAboveBubbleColumn
(boolean pDownwards, BlockPos pPos) protected void
onHitBlock
(BlockHitResult pResult) protected void
onHitEntity
(EntityHitResult pResult) Called when the arrow hits an entityvoid
onInsideBubbleColumn
(boolean pDownwards) protected void
onItemBreak
(Item pItem) void
onSyncedDataUpdated
(EntityDataAccessor<?> pKey) void
playerTouch
(Player pEntity) Called by a player entity when they collide with an entityvoid
push
(double pX, double pY, double pZ) Adds to the current velocity of the entity, and setsinvalid reference
#isAirBorne
protected void
readAdditionalSaveData
(ValueInput pInput) private void
void
setBaseDamage
(double pBaseDamage) void
setBaseDamageFromMob
(float pVelocity) void
setCritArrow
(boolean pCritArrow) Whether the arrow has a stream of critical hit particles flying behind it.private void
setFlag
(int pId, boolean pValue) protected void
setInGround
(boolean pInGround) void
setNoPhysics
(boolean pNoPhysics) Sets if this arrow can noClipvoid
protected void
setPickupItemStack
(ItemStack p_331486_) private void
setPierceLevel
(byte pPierceLevel) void
setSoundEvent
(SoundEvent pSoundEvent) 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.protected boolean
private boolean
boolean
shouldRenderAtSqrDistance
(double pDistance) Checks if the entity is in range to render.private void
private void
stepMoveAndHit
(BlockHitResult pHitResult) void
tick()
protected void
protected boolean
Methods 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, updateRotation
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, 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, syncPacketPositionCodec, teleport, teleportRelative, teleportSetPosition, teleportSpectators, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSound
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachments
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.core.component.DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, has, has
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods 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, shouldRiderSit
Methods 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:
shouldRenderAtSqrDistance
in classEntity
-
defineSynchedData
- Specified by:
defineSynchedData
in 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:
shoot
in classProjectile
-
lerpMotion
public void lerpMotion(double pX, double pY, double pZ) Updates the entity motion clientside, called by packets from the server- Overrides:
lerpMotion
in classEntity
-
onSyncedDataUpdated
- Specified by:
onSyncedDataUpdated
in interfaceSyncedDataHolder
- Overrides:
onSyncedDataUpdated
in classEntity
-
tick
public void tick()- Overrides:
tick
in classProjectile
-
stepMoveAndHit
-
applyInertia
private void applyInertia(float pInertia) -
addBubbleParticles
-
getDefaultGravity
protected double getDefaultGravity()- Overrides:
getDefaultGravity
in classEntity
-
shouldFall
private boolean shouldFall() -
startFalling
private void startFalling() -
isInGround
protected boolean isInGround() -
setInGround
protected void setInGround(boolean pInGround) -
isPushedByFluid
public boolean isPushedByFluid()- Overrides:
isPushedByFluid
in classEntity
-
move
-
tickDespawn
protected void tickDespawn() -
resetPiercedEntities
private void resetPiercedEntities() -
onItemBreak
- Overrides:
onItemBreak
in classProjectile
-
onAboveBubbleColumn
- Overrides:
onAboveBubbleColumn
in classProjectile
-
onInsideBubbleColumn
public void onInsideBubbleColumn(boolean pDownwards) - Overrides:
onInsideBubbleColumn
in classProjectile
-
push
public void push(double pX, double pY, double pZ) Adds to the current velocity of the entity, and setsinvalid reference
#isAirBorne
-
onHitEntity
Called when the arrow hits an entity- Overrides:
onHitEntity
in classProjectile
-
doKnockback
-
onHitBlock
- Overrides:
onHitBlock
in classProjectile
-
hitBlockEnchantmentEffects
protected void hitBlockEnchantmentEffects(ServerLevel pLevel, BlockHitResult pHitResult, ItemStack pStack) -
getWeaponItem
- Overrides:
getWeaponItem
in classEntity
-
getDefaultHitGroundSoundEvent
-
getHitGroundSoundEvent
-
doPostHurtEffects
-
findHitEntity
Gets the EntityRayTraceResult representing the entity hit -
canHitEntity
- Overrides:
canHitEntity
in classProjectile
-
addAdditionalSaveData
- Overrides:
addAdditionalSaveData
in classProjectile
-
readAdditionalSaveData
- Overrides:
readAdditionalSaveData
in classProjectile
-
setOwner
- Overrides:
setOwner
in classProjectile
-
playerTouch
Called by a player entity when they collide with an entity- Overrides:
playerTouch
in classEntity
-
tryPickup
-
getPickupItem
-
getDefaultPickupItem
-
getMovementEmission
- Overrides:
getMovementEmission
in classEntity
-
getPickupItemStackOrigin
-
setBaseDamage
public void setBaseDamage(double pBaseDamage) -
isAttackable
public boolean isAttackable()- Overrides:
isAttackable
in 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:
isPickable
in classProjectile
-
getSlot
-
shouldBounceOnWorldBorder
protected boolean shouldBounceOnWorldBorder()- Overrides:
shouldBounceOnWorldBorder
in classProjectile
-