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:
SyncedDataHolder,TraceableEntity,EntityAccess,Nameable,ScoreHolder,IAttachmentHolder,IEntityExtension,INBTSerializable<CompoundTag>
- 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 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.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, ID_TAG, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, minorHorizontalCollision, moveDist, noPhysics, PASSENGERS_TAG, portalProcess, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, 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> p_331098_, Level p_331626_) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalSaveData(CompoundTag pCompound) private voidaddBubbleParticles(Vec3 pPos) private voidapplyInertia(float pInertia) protected booleancanHitEntity(Entity p_36743_) protected voiddefineSynchedData(SynchedEntityData.Builder p_325945_) protected voiddoKnockback(LivingEntity pEntity, DamageSource pDamageSource) protected voiddoPostHurtEffects(LivingEntity pTarget) protected EntityHitResultfindHitEntity(Vec3 pStartVec, Vec3 pEndVec) Gets the EntityRayTraceResult representing the entity hitdoubleprotected doubleprotected SoundEventprotected abstract ItemStackprotected final SoundEventprotected Entity.MovementEmissionprotected ItemStackbytegetSlot(int p_341328_) protected floatprotected voidhitBlockEnchantmentEffects(ServerLevel pLevel, BlockHitResult pHitResult, ItemStack pStack) booleanbooleanprotected booleanbooleanbooleanvoidlerpMotion(double pX, double pY, double pZ) Updates the entity motion clientside, called by packets from the servervoidlerpTo(double p_36728_, double p_36729_, double p_36730_, float p_36731_, float p_36732_, int p_36733_) voidprotected voidonHitBlock(BlockHitResult p_36755_) protected voidonHitEntity(EntityHitResult pResult) Called when the arrow hits an entityvoidonInsideBubbleColumn(boolean p_382819_) protected voidonItemBreak(Item p_365372_) voidonSyncedDataUpdated(EntityDataAccessor<?> p_381707_) voidplayerTouch(Player pEntity) Called by a player entity when they collide with an entityvoidpush(double p_383096_, double p_383174_, double p_383161_) Adds to the current velocity of the entity, and setsto true.invalid reference
#isAirBornevoidreadAdditionalSaveData(CompoundTag pCompound) (abstract) Protected helper method to read subclass entity data from NBT.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 pPickupItemStack) 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, findOwner, getAddEntityPacket, getDimensionChangingDelay, getEffectSource, getMovementToShoot, getOwner, getPickRadius, hitTargetOrDeflectSelf, hurtServer, lerpRotation, mayBreak, mayInteract, onDeflection, onHit, ownedBy, recreateFromPacket, restoreFrom, setOwnerThroughUUID, shootFromRotation, spawnProjectile, spawnProjectile, spawnProjectileFromRotation, spawnProjectileUsingShoot, spawnProjectileUsingShoot, updateRotationMethods inherited from class net.minecraft.world.entity.Entity
absMoveTo, absMoveTo, absRotateTo, addDeltaMovement, addPassenger, addTag, adjustSpawnLocation, animateHurt, applyEffectsFromBlocks, applyEffectsFromBlocks, applyGravity, awardKillScore, baseTick, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, cancelLerp, canCollideWith, canControlVehicle, canFreeze, canRide, canSpawnSprintParticle, canSprint, canTeleport, canTrample, canUsePortal, captureDrops, captureDrops, causeFallDamage, checkBelowWorld, checkDespawn, checkFallDamage, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, collideBoundingBox, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, getAirSupply, getAttachments, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockSpeedFactor, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getCapability, getCapability, getCollisionHorizontalEscapeVector, getCommandSenderWorld, 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, getKnownMovement, getLeashOffset, getLeashOffset, 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, getRandom, getRandomX, getRandomY, getRandomZ, getRelativePortalPosition, getRemainingFireTicks, getRemovalReason, 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, 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, isColliding, isControlledByClient, isControlledByLocalInstance, isControlledByOrIsLocalPlayer, isCrouching, isCurrentlyGlowing, isCustomNameVisible, isDescending, isDiscrete, isEffectiveAi, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInLiquid, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableToBase, isInWall, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushable, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, killedEntity, lavaHurt, lerpHeadTo, lerpPositionAndRotationStep, lerpTargetX, lerpTargetXRot, lerpTargetY, lerpTargetYRot, lerpTargetZ, level, limitPistonMovement, load, lookAt, makeBoundingBox, makeBoundingBox, makeStuckInBlock, markHurt, maxUpStep, maybeBackOffFromEdge, mirror, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, oldPosition, onAboveBubbleCol, onAddedToLevel, onBelowWorld, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onPassengerTurned, onRemoval, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, processFlappingMovement, processPortalCooldown, push, push, reapplyPosition, recordMovementThroughBlocks, refreshDimensions, registryAccess, remove, removeAfterChangingDimensions, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, revive, rideTick, rotate, save, saveAsPassenger, saveWithoutId, setAirSupply, setAsInsidePortal, setBoundingBox, 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, setRot, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSprinting, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYBodyRot, setYHeadRot, setYRot, shouldBeSaved, shouldBlockExplode, shouldPlayLavaHurtSound, shouldRender, shouldShowName, showVehicleHealth, skipAttackInteraction, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, syncPacketPositionCodec, teleport, teleportRelative, teleportSetPosition, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSoundMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingData, hasAttachments, hasData, removeData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canSwimInFluidType, copyAttachmentsFrom, deserializeNBT, getClassification, getFluidFallDistanceModifier, getFluidMotionScale, getParts, getSoundFromFluidType, hasCustomOutlineRendering, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, sendPairingData, serializeNBT, 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:
-
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
-
lerpTo
public void lerpTo(double p_36728_, double p_36729_, double p_36730_, float p_36731_, float p_36732_, int p_36733_) -
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) -
move
-
tickDespawn
protected void tickDespawn() -
resetPiercedEntities
private void resetPiercedEntities() -
onItemBreak
- Overrides:
onItemBreakin classProjectile
-
onInsideBubbleColumn
public void onInsideBubbleColumn(boolean p_382819_) - Overrides:
onInsideBubbleColumnin classEntity
-
push
public void push(double p_383096_, double p_383174_, double p_383161_) Description copied from class:EntityAdds 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
(abstract) Protected helper method to read subclass entity data from NBT.- 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) -
getBaseDamage
public double getBaseDamage() -
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
-