Package net.minecraft.world.entity
Class Entity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.entity.Entity
- All Implemented Interfaces:
DataComponentGetter,SyncedDataHolder,EntityAccess,UniquelyIdentifyable,Nameable,ScoreHolder,IAttachmentHolder,IEntityExtension
- Direct Known Subclasses:
AreaEffectCloud,BlockAttachedEntity,Display,EndCrystal,EvokerFangs,ExperienceOrb,EyeOfEnder,FallingBlockEntity,Interaction,ItemEntity,LightningBolt,LivingEntity,Marker,OminousItemSpawner,PartEntity,PrimedTnt,Projectile,VehicleEntity
public abstract class Entity
extends AttachmentHolder
implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter, IEntityExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface(package private) static final recordstatic enumstatic enumNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intprivate AABBprivate BlockPosbooleanstatic final intprotected intprivate Collection<ItemEntity> Neo: Short-lived holder of dropped item entities.private ChunkPosstatic final intprivate floatprivate CustomDataprivate static final EntityDataAccessor<Integer> private static final EntityDataAccessor<Optional<Component>> private static final EntityDataAccessor<Boolean> private static final EntityDataAccessor<Boolean> protected static final EntityDataAccessor<Pose> protected static final EntityDataAccessor<Byte> private static final EntityDataAccessor<Boolean> private static final Stringprivate static final EntityDataAccessor<Integer> static final floatstatic final floatstatic final floatstatic final doublestatic final doubleprivate Vec3private EntityDimensionsprotected static final AtomicIntegerprotected final SynchedEntityDataprivate floatdoubleprivate final List<Entity.Movement> protected booleanprotected static final intprotected static final intprivate static final intprotected static final intprivate static final intprivate static final intprivate static final intDeprecated.Deprecated.floatprotected it.unimi.dsi.fastutil.objects.Object2DoubleMap<FluidType> private FluidTypestatic final intprivate booleanbooleanprivate booleanbooleanbooleanprivate intstatic final Stringprivate BlockStateprivate static final AABBprivate final InsideBlockEffectApplier.StepBasedCollectorprivate booleanintprivate booleanNeo: Internal use for keeping track of entities that are tracked by a world, to allow guarantees that entity position changes will force a chunk load, avoiding potential issues with entity desyncing and bad chunk data.booleanprivate intprivate static final doubleprivate static final doubleprivate Levelprivate EntityInLevelCallbackstatic final intbooleanfloatprivate final List<List<Entity.Movement>> private floatbooleanprivate booleanprivate booleanprivate final VecDeltaCodecprivate ImmutableList<Entity> static final Stringprivate CompoundTagprivate final double[]private longprivate intprivate Vec3protected final RandomSourceprivate intprivate Entity.RemovalReasonprotected Stringprotected Vec3intstatic final intprivate final EntityType<?> Deprecated.protected UUIDstatic final Stringprivate Entitybooleanbooleanprivate static doubleprivate final it.unimi.dsi.fastutil.longs.LongSetprotected booleanbooleanprotected booleanprivate static final doubledoubledoubleprivate floatfloatdoubledoubleprivate floatfloatprivate static final ImmutableList<Direction.Axis> private static final ImmutableList<Direction.Axis> doubledoubleFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabsSnapRotationTo(float yRot, float xRot) voidabsSnapTo(double x, double y, double z) voidabsSnapTo(double x, double y, double z, float yRot, float xRot) protected abstract voidvoidaddDeltaMovement(Vec3 addend) protected voidaddPassenger(Entity passenger) booleanadjustSpawnLocation(ServerLevel level, BlockPos pos) voidanimateHurt(float yaw) final voidprotected voidprivate voidapplyEffectsFromBlocks(List<Entity.Movement> movements) voidapplyEffectsFromBlocks(Vec3 oldPosition, Vec3 position) protected voidprotected <T> booleanapplyImplicitComponent(DataComponentType<T> component, T value) protected <T> booleanapplyImplicitComponentIfPresent(DataComponentGetter componentGetter, DataComponentType<T> component) protected voidapplyImplicitComponents(DataComponentGetter componentGetter) private voidapplyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) private doubleapplyPistonMovementRestriction(Direction.Axis axis, double distance) voidawardKillScore(Entity entity, DamageSource damageSource) private static Iterable<Direction.Axis> axisStepOrder(Vec3 deltaMovement) voidbaseTick()booleanbroadcastToPlayer(ServerPlayer player) private TeleportTransitioncalculatePassengerTransition(TeleportTransition teleportTransition, Entity entity) protected final Vec3calculateUpVector(float xRot, float yRot) final Vec3calculateViewVector(float xRot, float yRot) Calculates the view vector using the X and Y rotation of an entity.protected booleancanAddPassenger(Entity passenger) booleanbooleanbooleancanCollideWith(Entity entity) booleanbooleanprotected booleanbooleanbooleanbooleanbooleancanTeleport(Level fromLevel, Level toLevel) booleancanTrample(ServerLevel level, BlockState state, BlockPos pos, double fallDistance) booleancanUsePortal(boolean allowPassengers) captureDrops(Collection<ItemEntity> value) protected static <T> TcastComponentValue(DataComponentType<T> componentType, Object value) booleancauseFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) voidvoidprotected voidcheckFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) private voidcheckInsideBlocks(List<Entity.Movement> movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) voidprotected voidcheckSupportingBlock(boolean onGround, Vec3 movement) voidvoidbooleancloserThan(Entity entity, double distance) booleancloserThan(Entity entity, double horizontalDistance, double verticalDistance) private static float[]collectCandidateStepUpHeights(AABB box, List<VoxelShape> colliders, float deltaY, float maxUpStep) private static List<VoxelShape> collectColliders(Entity entity, Level level, List<VoxelShape> collisions, AABB boundingBox) private Vec3Given a motion vector, return an updated vector that takes into account restrictions such as collisions (from all directions) and step-up from stepHeightstatic Vec3collideBoundingBox(Entity entity, Vec3 vec, AABB collisionBox, Level level, List<VoxelShape> potentialHits) private booleancollidedWithFluid(FluidState fluid, BlockPos pos, Vec3 from, Vec3 to) private booleancollidedWithShapeMovingFrom(Vec3 from, Vec3 to, List<AABB> boxes) private static Vec3collideWithShapes(Vec3 deltaMovement, AABB entityBB, List<VoxelShape> shapes) protected booleanconsidersEntityAsAlly(Entity entity) voidcopyPosition(Entity entity) Sets this entity's location and angles to the location and angles of the passed in entity.protected booleanDeprecated.intprotected HoverEventbooleanprotected abstract voiddeflection(Projectile projectile) final voiddiscard()booleanvoiddismountTo(double x, double y, double z) booleanfloatdistanceTo(Entity entity) Returns the distance to the entity.doubledistanceToSqr(double x, double y, double z) Gets the squared distance to the position.doubledistanceToSqr(Entity entity) Returns the squared distance to the entity.doubledistanceToSqr(Vec3 vec) final voiddoCheckFallDamage(double x, double y, double z, boolean onGround) protected voidvoidbooleanvoidvoidfillCrashReportCategory(CrashReportCategory category) booleanprotected voidDeprecated.voidforceSetRotation(float yRot, float xRot) booleanfudgePositionAfterSizeChange(EntityDimensions dimensions) voidvoid<T> Tget(DataComponentType<? extends T> p_397010_) getAddEntityPacket(ServerEntity entity) intfinal EntityAttachmentsfinal floatfinal floatfloatgetBlockExplosionResistance(Explosion explosion, BlockGetter level, BlockPos pos, BlockState blockState, FluidState fluidState, float explosionPower) Explosion resistance of a block relative to this entityprotected floatprotected floatprotected BlockStateDeprecated.final intfinal intfinal intfinal AABBfinal <T,C extends @Nullable Object>
TgetCapability(EntityCapability<T, C> capability, C context) final <T> TgetCapability(EntityCapability<T, @Nullable Void> capability) protected static Vec3getCollisionHorizontalEscapeVector(double vehicleWidth, double passengerWidth, float yRot) protected doubleprotected static Vec3getDefaultPassengerAttachmentPoint(Entity vehicle, Entity passenger, EntityAttachments attachments) intgetDimensions(Pose pose) getDismountLocationForPassenger(LivingEntity passenger) final Stringfinal floatfinal floatgetEyeHeight(Pose pose) final FluidTypeReturns the fluid that is on the entity's eyes.final Vec3final Vec3getEyePosition(float partialTick) doublegetEyeY()protected intdoublegetFluidHeight(TagKey<Fluid> fluidTag) Deprecated.doublefinal doublegetFluidTypeHeight(FluidType type) Returns the height of the fluid type in relation to the bounding box of the entity.final doublegetHandHoldingItemAngle(Item item) intgetId()protected static Vec3getInputVector(Vec3 relative, float motionScaler, float facing) protected Vec3getLeashOffset(float partialTick) floatDeprecated.getLightProbePosition(float partialTicks) intintReturns the fluid type which is the highest on the bounding box of the entity.protected Entity.MovementEmissiongetName()getOnPos()protected BlockPosgetOnPos(float yOffset) Deprecated.protected Vec3getPassengerAttachmentPoint(Entity entity, EntityDimensions dimensions, float partialTick) getPassengerRidingPosition(Entity entity) floatReturns a NBTTagCompound that can be used to store custom data for this entity.floatintgetPose()final Vec3getPosition(float partialTicks) floatgetPreciseBodyRotation(float partialTick) protected BlockPosdoublegetRandomX(double scale) doubledoublegetRandomZ(double scale) getRelativePortalPosition(Direction.Axis axis, BlockUtil.FoundRectangle portal) intgetRopeHoldPosition(float partialTicks) protected booleangetSharedFlag(int flag) Returnstrueif the flag is active for the entity.getSlot(int slot) protected SoundEventprotected SoundEventprotected SoundEventgetTags()getTeam()intintintEntityType<?> getType()protected Componentfinal Vec3getUpVector(float partialTick) getUUID()getVehicleAttachmentPoint(Entity entity) static doublefinal Vec3getViewVector(float partialTicks) Gets the interpolated look vector.floatgetViewXRot(float partialTicks) Returns the current X rotation of the entity.floatgetViewYRot(float partialTick) Returns the current Y rotation of the entity.floatfinal doublegetX()doublegetX(double scale) floatgetXRot()floatgetXRot(float partialTick) final doublegetY()doublegetY(double scale) floatfloatgetYRot()floatgetYRot(float partialTick) final doublegetZ()doublegetZ(double scale) voidhandleDamageEvent(DamageSource damageSource) voidhandleEntityEvent(byte id) Handles an entity event received from aClientboundEntityEventPacket.protected static voidhandleOnAboveBubbleColumn(Entity entity, boolean downwards, BlockPos pos) protected static voidhandleOnInsideBubbleColumn(Entity entity, boolean downwards) protected voidfinal booleanbooleanbooleanfinal booleaninthashCode()booleanhasIndirectPassenger(Entity entity) booleanhasPassenger(Predicate<Entity> predicate) booleanhasPassenger(Entity entity) booleanfinal voidhurt(DamageSource damageSource, float amount) Deprecated.booleanhurtClient(DamageSource damageSource) final booleanhurtOrSimulate(DamageSource damageSource, float amount) Deprecated.abstract booleanhurtServer(ServerLevel level, DamageSource damageSource, float amount) final voidigniteForSeconds(float seconds) voidigniteForTicks(int ticks) booleanignoreExplosion(Explosion explosion) interact(Player player, InteractionHand hand) interactAt(Player player, Vec3 vec, InteractionHand hand) Applies the given player interaction to this Entity.booleanReturnstrueif Entity argument is equal to this Entityfinal booleanGets whether this entity has been added to a world (for tracking).protected booleanbooleanisAlive()final booleanisAlliedTo(Entity entity) Returns whether this Entity is on the same team as the given Entity.booleanisAlliedTo(Team team) Returns whether this Entity is on the given scoreboard team.booleanbooleanbooleanbooleanisColliding(BlockPos pos, BlockState state) booleanbooleanbooleanbooleanbooleanbooleanbooleanisEyeInFluid(TagKey<Fluid> fluidTag) Deprecated.protected booleanbooleanisFree(double x, double y, double z) Checks if the offset position from the entity's current position has a collision with a block or a liquid.private booleanDetermines if the entity has no collision with a block or a liquid within the specified bounding box.booleanbooleanprotected booleanisHorizontalCollisionMinor(Vec3 deltaMovement) booleanfinal booleanReturns whether the entity is in a fluid.final booleanisInFluidType(BiPredicate<FluidType, Double> predicate, boolean forAllTypes) Returns whether the fluid type the entity is currently in matches the specified condition.booleanisInLava()boolean(package private) booleanisInRain()final booleanbooleanbooleanisInvisibleTo(Player player) Only used by renderer in EntityLivingBase subclasses.booleanprotected final booleanisInvulnerableToBase(DamageSource damageSource) booleanisInWall()booleanbooleanprotected booleanfinal booleanbooleanbooleanisOnFire()booleanbooleanbooleanbooleanisPassengerOfSameVehicle(Entity entity) booleanbooleanbooleanDeprecated.final booleanbooleanbooleanisSilent()booleanbooleanprivate booleanisStateClimbable(BlockState state) booleanbooleanisSupportedBy(BlockPos pos) booleanbooleanbooleanbooleanbooleanbooleanvoidkill(ServerLevel level) booleankilledEntity(ServerLevel level, LivingEntity entity) voidlavaHurt()voidvoidlerpHeadTo(float yaw, int pitch) voidlerpMotion(double x, double y, double z) Updates the entity motion clientside, called by packets from the serverprotected voidlerpPositionAndRotationStep(int steps, double targetX, double targetY, double targetZ, double targetYRot, double targetXRot) level()protected Vec3limitPistonMovement(Vec3 pos) voidload(CompoundTag compound) Reads the entity from NBT (calls an abstract helper method to read specialized data)voidlookAt(EntityAnchorArgument.Anchor anchor, Vec3 target) protected final AABBprotected AABBmakeBoundingBox(Vec3 position) voidmakeStuckInBlock(BlockState state, Vec3 motionMultiplier) protected voidmarkHurt()floatprotected Vec3maybeBackOffFromEdge(Vec3 vec, MoverType mover) booleanmayInteract(ServerLevel level, BlockPos pos) floatTransforms the entity's current yaw with the given Mirror and returns it.voidfinal voidmoveOrInterpolateTo(Vec3 pos, float yRot, float xRot) voidmoveRelative(float amount, Vec3 relative) protected voidmoveTowardsClosestSpace(double x, double y, double z) protected floatnextStep()final Vec3voidonAboveBubbleColumn(boolean downwards, BlockPos pos) voidCalled after the entity has been added to the world's ticking list.protected voidvoidvoidonExplosionHit(Entity entity) protected voidonFlap()booleanonGround()protected voidonInsideBlock(BlockState state) voidonInsideBubbleColumn(boolean downwards) voidonPassengerTurned(Entity entityToUpdate) Applies this entity's orientation to another entity.voidonRemoval(Entity.RemovalReason reason) voidCalled after the entity has been removed to the world's ticking list.voidonSyncedDataUpdated(List<SynchedEntityData.DataValue<?>> dataValues) voidpick(double hitDistance, float partialTicks, boolean hitFluids) voidprivate voidprotected voidplayCombinationStepSounds(BlockState primaryState, BlockState secondaryState, BlockPos primaryPos, BlockPos secondaryPos) protected voidvoidplayerTouch(Player player) Called by a player entity when they collide with an entityprotected voidplayMuffledStepSound(BlockState state, BlockPos pos) voidplaySound(SoundEvent sound) voidplaySound(SoundEvent sound, float volume, float pitch) protected voidplayStepSound(BlockPos pos, BlockState state) protected voidplaySwimSound(float volume) position()final voidpositionRider(Entity passenger) protected voidpositionRider(Entity passenger, Entity.MoveFunction callback) protected voidprotected voidprotected voidpropagateFallToPassengers(double fallDistance, float damageMultiplier, DamageSource damageSource) voidpush(double x, double y, double z) Adds to the current velocity of the entity, and setsto true.invalid reference
#isAirBornevoidApplies a velocity to the entities, to push them away from each other.voidprotected abstract void(abstract) Protected helper method to read subclass entity data from NBT.protected voidvoidvoidvoidremove(Entity.RemovalReason reason) private static ComponentremoveAction(Component name) protected voidvoidprotected voidremovePassenger(Entity passenger) booleanvoidprotected booleanvoidvoidrestoreFrom(Entity entity) Prepares this entity in new dimension by copying NBT data from entity in old dimensionvoidrevive()Revives an entity that has been removed from a world.voidrideTick()floatTransforms the entity's current yaw with the given Rotation and returns it.booleansave(CompoundTag compound) Writes this entity to NBT, unless it has been removed or it is a passenger.booleansaveAsPassenger(CompoundTag compound) Writes this entity to NBT, unless it has been removed.saveWithoutId(CompoundTag compound) Writes this entity, including passengers, to NBT, regardless as to whether it is removed or a passenger.protected static voidsendBubbleColumnParticles(Level level, BlockPos pos) private voidsendTeleportTransitionToRidingPlayers(TeleportTransition teleportTransition) voidsetAirSupply(int air) voidsetAsInsidePortal(Portal portal, BlockPos pos) final voidsetBoundingBox(AABB bb) <T> voidsetComponent(DataComponentType<T> component, T value) voidsetCustomName(Component name) voidsetCustomNameVisible(boolean alwaysRenderNameTag) final <T> TsetData(AttachmentType<T> type, T data) Sets the data attachment of the given type.voidsetDeltaMovement(double x, double y, double z) voidsetDeltaMovement(Vec3 deltaMovement) protected final voidsetFluidTypeHeight(FluidType type, double height) final voidsetGlowingTag(boolean hasGlowingTag) voidsetId(int id) voidsetInvisible(boolean invisible) voidsetInvulnerable(boolean isInvulnerable) Sets whether this Entity is invulnerable.voidsetIsInPowderSnow(boolean isInPowderSnow) protected voidvoidsetLevelCallback(EntityInLevelCallback p_146849_) voidsetNoGravity(boolean noGravity) protected voidprivate voidfinal voidfinal voidsetOldPosAndRot(Vec3 pos, float yRot, float xRot) voidprivate voidsetOldRot(float yRot, float xRot) voidsetOnGround(boolean onGround) voidsetOnGroundWithMovement(boolean onGround, boolean horizontalCollision, Vec3 movement) voidsetOnGroundWithMovement(boolean onGround, Vec3 movement) voidvoidsetPortalCooldown(int portalCooldown) voidsetPos(double x, double y, double z) Sets the x,y,z of the entity from the given parameters.final voidvoidfinal voidsetPosRaw(double x, double y, double z) Directly updates the,invalid reference
#posX, andinvalid reference
posYfields, without performing any collision checks, updating the bounding box position, or sending any packets.invalid reference
posZvoidsetRemainingFireTicks(int remainingFireTicks) final voidsetRemoved(Entity.RemovalReason p_146876_) protected voidsetRot(float yRot, float xRot) Sets the rotation of the entity.protected voidsetSharedFlag(int flag, boolean set) Enable or disable an entity flag, seeto read the known flags.invalid reference
#getEntityFlagvoidsetSharedFlagOnFire(boolean isOnFire) voidsetShiftKeyDown(boolean keyDown) voidsetSilent(boolean isSilent) When set to true the entity will not play sounds.voidsetSprinting(boolean sprinting) Set sprinting switch for Entity.voidsetSwimming(boolean swimming) voidsetTicksFrozen(int ticksFrozen) voidstatic voidsetViewScale(double renderDistWeight) voidsetXRot(float xRot) voidsetYBodyRot(float yBodyRot) Set the body Y rotation of the entity.voidsetYHeadRot(float yHeadRot) Sets the head's Y rotation of the entity.voidsetYRot(float yRot) booleanbooleanshouldBlockExplode(Explosion explosion, BlockGetter level, BlockPos pos, BlockState blockState, float explosionPower) private booleanprotected booleanbooleanshouldRender(double x, double y, double z) booleanshouldRenderAtSqrDistance(double distance) Checks if the entity is in range to render.booleanbooleanbooleanskipAttackInteraction(Entity entity) Called when a player attacks an entity.voidsnapTo(double x, double y, double z) voidsnapTo(double x, double y, double z, float yRot, float xRot) voidvoidvoidspawnAtLocation(ServerLevel level, ItemStack stack) spawnAtLocation(ServerLevel level, ItemStack stack, float yOffset) spawnAtLocation(ServerLevel level, ItemLike item) spawnAtLocation(ServerLevel level, ItemLike item, int yOffset) protected voidbooleanstartRiding(Entity vehicle) booleanstartRiding(Entity vehicle, boolean force) voidstartSeenByPlayer(ServerPlayer serverPlayer) Add the given player to the list of players tracking this entity.voidvoidstopSeenByPlayer(ServerPlayer serverPlayer) Removes the given player from the list of players tracking this entity.voidsyncPacketPositionCodec(double x, double y, double z) teleport(TeleportTransition teleportTransition) private EntityteleportCrossDimension(ServerLevel level, TeleportTransition teleportTransition) private voidvoidteleportRelative(double dx, double dy, double dz) private EntityteleportSameDimension(ServerLevel level, TeleportTransition teleportTransition) voidteleportSetPosition(PositionMoveRotation positionMovementRotation, Set<Relative> relatives) voidteleportTo(double x, double y, double z) Sets the position of the entity and updates the 'last' variablesbooleanteleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera) voidthunderHit(ServerLevel level, LightningBolt lightning) voidtick()toString()booleanvoidturn(double yRot, double xRot) final voidunRide()protected voidvoidupdateDynamicGameEventListener(BiConsumer<DynamicGameEventListener<?>, ServerLevel> listenerConsumer) voidbooleanupdateFluidHeightAndDoFluidPushing(TagKey<Fluid> fluidTag, double motionScale) Deprecated.private voidprotected boolean(package private) voidvoidprivate booleanvibrationAndSoundEffectsFromBlock(BlockPos pos, BlockState state, boolean playStepSound, boolean broadcastGameEvent, Vec3 entityPos) private voidwalkingStepSound(BlockPos pos, BlockState state) protected voidMethods 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, setDataMethods 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
-
ID_TAG
- See Also:
-
PASSENGERS_TAG
- See Also:
-
DATA_TAG
- See Also:
-
ENTITY_COUNTER
-
CONTENTS_SLOT_INDEX
public static final int CONTENTS_SLOT_INDEX- See Also:
-
BOARDING_COOLDOWN
public static final int BOARDING_COOLDOWN- See Also:
-
TOTAL_AIR_SUPPLY
public static final int TOTAL_AIR_SUPPLY- See Also:
-
MAX_ENTITY_TAG_COUNT
public static final int MAX_ENTITY_TAG_COUNT- See Also:
-
TAG_LIST_CODEC
-
DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2
public static final float DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2- See Also:
-
DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5
public static final double DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5- See Also:
-
DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0
public static final double DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0- See Also:
-
BASE_TICKS_REQUIRED_TO_FREEZE
public static final int BASE_TICKS_REQUIRED_TO_FREEZE- See Also:
-
FREEZE_HURT_FREQUENCY
public static final int FREEZE_HURT_FREQUENCY- See Also:
-
BASE_SAFE_FALL_DISTANCE
public static final int BASE_SAFE_FALL_DISTANCE- See Also:
-
YXZ_AXIS_ORDER
-
YZX_AXIS_ORDER
-
INITIAL_AABB
-
WATER_FLOW_SCALE
private static final double WATER_FLOW_SCALE- See Also:
-
LAVA_FAST_FLOW_SCALE
private static final double LAVA_FAST_FLOW_SCALE- See Also:
-
LAVA_SLOW_FLOW_SCALE
private static final double LAVA_SLOW_FLOW_SCALE- See Also:
-
UUID_TAG
- See Also:
-
viewScale
private static double viewScale -
type
Deprecated. -
id
private int id -
blocksBuilding
public boolean blocksBuilding -
passengers
-
boardingCooldown
protected int boardingCooldown -
vehicle
-
level
-
xo
public double xo -
yo
public double yo -
zo
public double zo -
position
-
blockPosition
-
chunkPosition
-
deltaMovement
-
yRot
private float yRot -
xRot
private float xRot -
yRotO
public float yRotO -
xRotO
public float xRotO -
bb
-
onGround
private boolean onGround -
horizontalCollision
public boolean horizontalCollision -
verticalCollision
public boolean verticalCollision -
verticalCollisionBelow
public boolean verticalCollisionBelow -
minorHorizontalCollision
public boolean minorHorizontalCollision -
hurtMarked
public boolean hurtMarked -
stuckSpeedMultiplier
-
removalReason
-
DEFAULT_BB_WIDTH
public static final float DEFAULT_BB_WIDTH- See Also:
-
DEFAULT_BB_HEIGHT
public static final float DEFAULT_BB_HEIGHT- See Also:
-
moveDist
public float moveDist -
flyDist
public float flyDist -
fallDistance
public double fallDistance -
nextStep
private float nextStep -
xOld
public double xOld -
yOld
public double yOld -
zOld
public double zOld -
noPhysics
public boolean noPhysics -
random
-
tickCount
public int tickCount -
remainingFireTicks
private int remainingFireTicks -
wasTouchingWater
protected boolean wasTouchingWater -
fluidHeight
Deprecated. -
wasEyeInWater
protected boolean wasEyeInWater -
fluidOnEyes
Deprecated. -
invulnerableTime
public int invulnerableTime -
firstTick
protected boolean firstTick -
entityData
-
DATA_SHARED_FLAGS_ID
-
FLAG_ONFIRE
protected static final int FLAG_ONFIRE- See Also:
-
FLAG_SHIFT_KEY_DOWN
private static final int FLAG_SHIFT_KEY_DOWN- See Also:
-
FLAG_SPRINTING
private static final int FLAG_SPRINTING- See Also:
-
FLAG_SWIMMING
private static final int FLAG_SWIMMING- See Also:
-
FLAG_INVISIBLE
private static final int FLAG_INVISIBLE- See Also:
-
FLAG_GLOWING
protected static final int FLAG_GLOWING- See Also:
-
FLAG_FALL_FLYING
protected static final int FLAG_FALL_FLYING- See Also:
-
DATA_AIR_SUPPLY_ID
-
DATA_CUSTOM_NAME
-
DATA_CUSTOM_NAME_VISIBLE
-
DATA_SILENT
-
DATA_NO_GRAVITY
-
DATA_POSE
-
DATA_TICKS_FROZEN
-
levelCallback
-
packetPositionCodec
-
hasImpulse
public boolean hasImpulse -
portalProcess
-
portalCooldown
private int portalCooldown -
invulnerable
private boolean invulnerable -
uuid
-
stringUUID
-
hasGlowingTag
private boolean hasGlowingTag -
tags
-
pistonDeltas
private final double[] pistonDeltas -
pistonDeltasGameTime
private long pistonDeltasGameTime -
dimensions
-
eyeHeight
private float eyeHeight -
isInPowderSnow
public boolean isInPowderSnow -
wasInPowderSnow
public boolean wasInPowderSnow -
mainSupportingBlockPos
-
onGroundNoBlocks
private boolean onGroundNoBlocks -
crystalSoundIntensity
private float crystalSoundIntensity -
lastCrystalSoundPlayTick
private int lastCrystalSoundPlayTick -
hasVisualFire
private boolean hasVisualFire -
inBlockState
-
movementThisTick
-
finalMovementsThisTick
-
visitedBlocks
private final it.unimi.dsi.fastutil.longs.LongSet visitedBlocks -
insideEffectCollector
-
customData
-
captureDrops
Neo: Short-lived holder of dropped item entities. Used mainly for Neo hooks and event logic.When not null, records all item entities from
andinvalid reference
#spawnAtLocation(ItemStack, float)ServerPlayer.drop(ItemStack, boolean, boolean)instead of adding them to the world. -
persistentData
-
isAddedToLevel
private boolean isAddedToLevelNeo: Internal use for keeping track of entities that are tracked by a world, to allow guarantees that entity position changes will force a chunk load, avoiding potential issues with entity desyncing and bad chunk data. -
forgeFluidTypeHeight
-
forgeFluidTypeOnEyes
-
-
Constructor Details
-
Entity
-
-
Method Details
-
isColliding
-
getTeamColor
public int getTeamColor() -
isSpectator
public boolean isSpectator() -
unRide
public final void unRide() -
syncPacketPositionCodec
public void syncPacketPositionCodec(double x, double y, double z) -
getPositionCodec
-
getType
-
getId
public int getId()- Specified by:
getIdin interfaceEntityAccess
-
setId
public void setId(int id) -
getTags
-
addTag
-
removeTag
-
kill
-
discard
public final void discard() -
defineSynchedData
-
getEntityData
-
equals
-
hashCode
public int hashCode() -
remove
-
onClientRemoval
public void onClientRemoval() -
onRemoval
-
setPose
-
getPose
-
hasPose
-
closerThan
-
closerThan
-
setRot
protected void setRot(float yRot, float xRot) Sets the rotation of the entity. -
setPos
-
setPos
public void setPos(double x, double y, double z) Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box. -
makeBoundingBox
-
makeBoundingBox
-
reapplyPosition
protected void reapplyPosition() -
turn
public void turn(double yRot, double xRot) -
tick
public void tick() -
baseTick
public void baseTick() -
checkBelowWorld
public void checkBelowWorld() -
setPortalCooldown
public void setPortalCooldown() -
setPortalCooldown
public void setPortalCooldown(int portalCooldown) -
getPortalCooldown
public int getPortalCooldown() -
isOnPortalCooldown
public boolean isOnPortalCooldown() -
processPortalCooldown
protected void processPortalCooldown() -
lavaIgnite
public void lavaIgnite() -
lavaHurt
public void lavaHurt() -
shouldPlayLavaHurtSound
protected boolean shouldPlayLavaHurtSound() -
igniteForSeconds
public final void igniteForSeconds(float seconds) -
igniteForTicks
public void igniteForTicks(int ticks) -
setRemainingFireTicks
public void setRemainingFireTicks(int remainingFireTicks) -
getRemainingFireTicks
public int getRemainingFireTicks() -
clearFire
public void clearFire() -
onBelowWorld
protected void onBelowWorld() -
isFree
public boolean isFree(double x, double y, double z) Checks if the offset position from the entity's current position has a collision with a block or a liquid. -
isFree
Determines if the entity has no collision with a block or a liquid within the specified bounding box. -
setOnGround
public void setOnGround(boolean onGround) -
setOnGroundWithMovement
-
setOnGroundWithMovement
-
isSupportedBy
-
checkSupportingBlock
-
onGround
public boolean onGround() -
move
-
applyMovementEmissionAndPlaySound
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) -
applyEffectsFromBlocks
protected void applyEffectsFromBlocks() -
removeLatestMovementRecordingBatch
public void removeLatestMovementRecordingBatch() -
applyEffectsFromBlocks
-
applyEffectsFromBlocks
-
isAffectedByBlocks
protected boolean isAffectedByBlocks() -
isStateClimbable
-
vibrationAndSoundEffectsFromBlock
private boolean vibrationAndSoundEffectsFromBlock(BlockPos pos, BlockState state, boolean playStepSound, boolean broadcastGameEvent, Vec3 entityPos) -
isHorizontalCollisionMinor
-
playEntityOnFireExtinguishedSound
protected void playEntityOnFireExtinguishedSound() -
extinguishFire
public void extinguishFire() -
processFlappingMovement
protected void processFlappingMovement() -
getOnPosLegacy
Deprecated. -
getBlockPosBelowThatAffectsMyMovement
-
getOnPos
-
getOnPos
-
getBlockJumpFactor
protected float getBlockJumpFactor() -
getBlockSpeedFactor
protected float getBlockSpeedFactor() -
maybeBackOffFromEdge
-
limitPistonMovement
-
applyPistonMovementRestriction
-
collide
Given a motion vector, return an updated vector that takes into account restrictions such as collisions (from all directions) and step-up from stepHeight -
collectCandidateStepUpHeights
private static float[] collectCandidateStepUpHeights(AABB box, List<VoxelShape> colliders, float deltaY, float maxUpStep) -
collideBoundingBox
-
collectColliders
private static List<VoxelShape> collectColliders(@Nullable Entity entity, Level level, List<VoxelShape> collisions, AABB boundingBox) -
collideWithShapes
-
axisStepOrder
-
nextStep
protected float nextStep() -
getSwimSound
-
getSwimSplashSound
-
getSwimHighSpeedSplashSound
-
checkInsideBlocks
private void checkInsideBlocks(List<Entity.Movement> movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) -
collidedWithFluid
-
collidedWithShapeMovingFrom
-
onInsideBlock
-
adjustSpawnLocation
-
gameEvent
-
gameEvent
-
walkingStepSound
-
waterSwimSound
protected void waterSwimSound() -
getPrimaryStepSoundBlockPos
-
playCombinationStepSounds
protected void playCombinationStepSounds(BlockState primaryState, BlockState secondaryState, BlockPos primaryPos, BlockPos secondaryPos) -
playMuffledStepSound
-
playStepSound
-
shouldPlayAmethystStepSound
-
playAmethystStepSound
private void playAmethystStepSound() -
playSwimSound
protected void playSwimSound(float volume) -
onFlap
protected void onFlap() -
isFlapping
protected boolean isFlapping() -
playSound
-
playSound
-
isSilent
public boolean isSilent() -
setSilent
public void setSilent(boolean isSilent) When set to true the entity will not play sounds. -
isNoGravity
public boolean isNoGravity() -
setNoGravity
public void setNoGravity(boolean noGravity) -
getDefaultGravity
protected double getDefaultGravity() -
getGravity
public final double getGravity() -
applyGravity
protected void applyGravity() -
getMovementEmission
-
dampensVibrations
public boolean dampensVibrations() -
doCheckFallDamage
public final void doCheckFallDamage(double x, double y, double z, boolean onGround) -
checkFallDamage
-
fireImmune
public boolean fireImmune() -
causeFallDamage
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) -
propagateFallToPassengers
protected void propagateFallToPassengers(double fallDistance, float damageMultiplier, DamageSource damageSource) -
isInWater
public boolean isInWater() -
isInRain
boolean isInRain() -
isInWaterOrRain
public boolean isInWaterOrRain() -
isInLiquid
public boolean isInLiquid() -
isUnderWater
public boolean isUnderWater() -
updateSwimming
public void updateSwimming() -
updateInWaterStateAndDoFluidPushing
protected boolean updateInWaterStateAndDoFluidPushing() -
updateInWaterStateAndDoWaterCurrentPushing
void updateInWaterStateAndDoWaterCurrentPushing() -
updateFluidOnEyes
private void updateFluidOnEyes() -
doWaterSplashEffect
protected void doWaterSplashEffect() -
getBlockStateOnLegacy
Deprecated. -
getBlockStateOn
-
canSpawnSprintParticle
public boolean canSpawnSprintParticle() -
spawnSprintParticle
protected void spawnSprintParticle() -
isEyeInFluid
Deprecated. -
isInLava
public boolean isInLava() -
moveRelative
-
getInputVector
-
getLightLevelDependentMagicValue
Deprecated. -
absSnapTo
public void absSnapTo(double x, double y, double z, float yRot, float xRot) -
absSnapRotationTo
public void absSnapRotationTo(float yRot, float xRot) -
absSnapTo
public void absSnapTo(double x, double y, double z) -
snapTo
-
snapTo
public void snapTo(double x, double y, double z) -
snapTo
-
snapTo
-
snapTo
public void snapTo(double x, double y, double z, float yRot, float xRot) -
setOldPosAndRot
public final void setOldPosAndRot() -
setOldPosAndRot
-
setOldPos
protected void setOldPos() -
setOldRot
public void setOldRot() -
setOldPos
-
setOldRot
private void setOldRot(float yRot, float xRot) -
oldPosition
-
distanceTo
Returns the distance to the entity. -
distanceToSqr
public double distanceToSqr(double x, double y, double z) Gets the squared distance to the position. -
distanceToSqr
Returns the squared distance to the entity. -
distanceToSqr
-
playerTouch
Called by a player entity when they collide with an entity -
push
Applies a velocity to the entities, to push them away from each other. -
push
-
push
public void push(double x, double y, double z) Adds to the current velocity of the entity, and setsto true.invalid reference
#isAirBorne -
markHurt
protected void markHurt() -
hurt
Deprecated. -
hurtOrSimulate
Deprecated. -
hurtServer
-
hurtClient
-
getViewVector
Gets the interpolated look vector. -
getNearestViewDirection
-
getViewXRot
public float getViewXRot(float partialTicks) Returns the current X rotation of the entity. -
getViewYRot
public float getViewYRot(float partialTick) Returns the current Y rotation of the entity. -
getXRot
public float getXRot(float partialTick) -
getYRot
public float getYRot(float partialTick) -
calculateViewVector
Calculates the view vector using the X and Y rotation of an entity. -
getUpVector
-
calculateUpVector
-
getEyePosition
-
getEyePosition
-
getLightProbePosition
-
getPosition
-
pick
-
canBeHitByProjectile
public boolean canBeHitByProjectile() -
isPickable
public boolean isPickable() -
isPushable
public boolean isPushable() -
awardKillScore
-
shouldRender
public boolean shouldRender(double x, double y, double z) -
shouldRenderAtSqrDistance
public boolean shouldRenderAtSqrDistance(double distance) Checks if the entity is in range to render. -
saveAsPassenger
Writes this entity to NBT, unless it has been removed. Also writes this entity's passengers, and the entity type ID (so the produced NBT is sufficient to recreate the entity). Generally,orinvalid reference
#writeUnlessPassengershould be used instead of this method.invalid reference
#writeWithoutTypeId- Returns:
- True if the entity was written (and the passed compound should be saved)" false if the entity was not written.
-
save
Writes this entity to NBT, unless it has been removed or it is a passenger. Also writes this entity's passengers, and the entity type ID (so the produced NBT is sufficient to recreate the entity). To always write the entity, use.invalid reference
#writeWithoutTypeId- Returns:
- True if the entity was written (and the passed compound should be saved)" false if the entity was not written.
-
saveWithoutId
Writes this entity, including passengers, to NBT, regardless as to whether it is removed or a passenger. Does not include the entity's type ID, so the NBT is insufficient to recreate the entity using. Useinvalid reference
AnvilChunkLoader#readWorldEntityfor that purpose.invalid reference
#writeUnlessPassenger -
load
Reads the entity from NBT (calls an abstract helper method to read specialized data) -
repositionEntityAfterLoad
protected boolean repositionEntityAfterLoad() -
getEncodeId
-
readAdditionalSaveData
(abstract) Protected helper method to read subclass entity data from NBT. -
addAdditionalSaveData
-
spawnAtLocation
-
spawnAtLocation
-
spawnAtLocation
-
spawnAtLocation
-
isAlive
public boolean isAlive() -
isInWall
public boolean isInWall() -
interact
-
canCollideWith
-
canBeCollidedWith
public boolean canBeCollidedWith() -
rideTick
public void rideTick() -
positionRider
-
positionRider
-
onPassengerTurned
Applies this entity's orientation to another entity. Used to update passenger orientation. -
getVehicleAttachmentPoint
-
getPassengerRidingPosition
-
getPassengerAttachmentPoint
protected Vec3 getPassengerAttachmentPoint(Entity entity, EntityDimensions dimensions, float partialTick) -
getDefaultPassengerAttachmentPoint
protected static Vec3 getDefaultPassengerAttachmentPoint(Entity vehicle, Entity passenger, EntityAttachments attachments) -
startRiding
-
showVehicleHealth
public boolean showVehicleHealth() -
startRiding
-
canRide
-
ejectPassengers
public void ejectPassengers() -
removeVehicle
public void removeVehicle() -
stopRiding
public void stopRiding() -
addPassenger
-
removePassenger
-
canAddPassenger
-
couldAcceptPassenger
Deprecated.Forge: Userider sensitive version -
isInterpolating
public final boolean isInterpolating() -
moveOrInterpolateTo
-
getInterpolation
-
lerpHeadTo
public void lerpHeadTo(float yaw, int pitch) -
getPickRadius
public float getPickRadius() -
getLookAngle
-
getHandHoldingItemAngle
-
getRotationVector
-
getForward
-
setAsInsidePortal
-
handlePortal
protected void handlePortal() -
getDimensionChangingDelay
public int getDimensionChangingDelay() -
lerpMotion
public void lerpMotion(double x, double y, double z) Updates the entity motion clientside, called by packets from the server -
handleDamageEvent
-
handleEntityEvent
public void handleEntityEvent(byte id) Handles an entity event received from aClientboundEntityEventPacket. -
animateHurt
public void animateHurt(float yaw) -
isOnFire
public boolean isOnFire() -
isPassenger
public boolean isPassenger() -
isVehicle
public boolean isVehicle() -
dismountsUnderwater
public boolean dismountsUnderwater() -
canControlVehicle
public boolean canControlVehicle() -
setShiftKeyDown
public void setShiftKeyDown(boolean keyDown) -
isShiftKeyDown
public boolean isShiftKeyDown() -
isSteppingCarefully
public boolean isSteppingCarefully() -
isSuppressingBounce
public boolean isSuppressingBounce() -
isDiscrete
public boolean isDiscrete() -
isDescending
public boolean isDescending() -
isCrouching
public boolean isCrouching() -
isSprinting
public boolean isSprinting() -
setSprinting
public void setSprinting(boolean sprinting) Set sprinting switch for Entity. -
isSwimming
public boolean isSwimming() -
isVisuallySwimming
public boolean isVisuallySwimming() -
isVisuallyCrawling
public boolean isVisuallyCrawling() -
setSwimming
public void setSwimming(boolean swimming) -
hasGlowingTag
public final boolean hasGlowingTag() -
setGlowingTag
public final void setGlowingTag(boolean hasGlowingTag) -
isCurrentlyGlowing
public boolean isCurrentlyGlowing() -
isInvisible
public boolean isInvisible() -
isInvisibleTo
Only used by renderer in EntityLivingBase subclasses. Determines if an entity is visible or not to a specific player, if the entity is normally invisible. For EntityLivingBase subclasses, returning false when invisible will render the entity semi-transparent. -
isOnRails
public boolean isOnRails() -
updateDynamicGameEventListener
public void updateDynamicGameEventListener(BiConsumer<DynamicGameEventListener<?>, ServerLevel> listenerConsumer) -
getTeam
-
isAlliedTo
Returns whether this Entity is on the same team as the given Entity. -
considersEntityAsAlly
-
isAlliedTo
Returns whether this Entity is on the given scoreboard team. -
setInvisible
public void setInvisible(boolean invisible) -
getMaxAirSupply
public int getMaxAirSupply() -
getAirSupply
public int getAirSupply() -
setAirSupply
public void setAirSupply(int air) -
clearFreeze
public void clearFreeze() -
getTicksFrozen
public int getTicksFrozen() -
setTicksFrozen
public void setTicksFrozen(int ticksFrozen) -
getPercentFrozen
public float getPercentFrozen() -
isFullyFrozen
public boolean isFullyFrozen() -
getTicksRequiredToFreeze
public int getTicksRequiredToFreeze() -
thunderHit
-
onAboveBubbleColumn
-
handleOnAboveBubbleColumn
-
sendBubbleColumnParticles
-
onInsideBubbleColumn
public void onInsideBubbleColumn(boolean downwards) -
handleOnInsideBubbleColumn
-
killedEntity
-
checkSlowFallDistance
public void checkSlowFallDistance() -
resetFallDistance
public void resetFallDistance() -
moveTowardsClosestSpace
protected void moveTowardsClosestSpace(double x, double y, double z) -
makeStuckInBlock
-
removeAction
-
getName
-
getTypeName
-
is
Returnstrueif Entity argument is equal to this Entity -
getYHeadRot
public float getYHeadRot() -
setYHeadRot
public void setYHeadRot(float yHeadRot) Sets the head's Y rotation of the entity. -
setYBodyRot
public void setYBodyRot(float yBodyRot) Set the body Y rotation of the entity. -
isAttackable
public boolean isAttackable() -
skipAttackInteraction
Called when a player attacks an entity. If this returns true the attack will not happen. -
toString
-
isInvulnerableToBase
-
isInvulnerable
public boolean isInvulnerable() -
setInvulnerable
public void setInvulnerable(boolean isInvulnerable) Sets whether this Entity is invulnerable. -
copyPosition
Sets this entity's location and angles to the location and angles of the passed in entity. -
restoreFrom
Prepares this entity in new dimension by copying NBT data from entity in old dimension -
teleport
-
teleportSameDimension
-
teleportCrossDimension
-
calculatePassengerTransition
private TeleportTransition calculatePassengerTransition(TeleportTransition teleportTransition, Entity entity) -
sendTeleportTransitionToRidingPlayers
-
teleportSetPosition
public void teleportSetPosition(PositionMoveRotation positionMovementRotation, Set<Relative> relatives) -
forceSetRotation
public void forceSetRotation(float yRot, float xRot) -
placePortalTicket
-
removeAfterChangingDimensions
protected void removeAfterChangingDimensions() -
getRelativePortalPosition
-
canUsePortal
public boolean canUsePortal(boolean allowPassengers) -
canTeleport
-
getBlockExplosionResistance
public float getBlockExplosionResistance(Explosion explosion, BlockGetter level, BlockPos pos, BlockState blockState, FluidState fluidState, float explosionPower) Explosion resistance of a block relative to this entity -
shouldBlockExplode
public boolean shouldBlockExplode(Explosion explosion, BlockGetter level, BlockPos pos, BlockState blockState, float explosionPower) -
getMaxFallDistance
public int getMaxFallDistance() -
isIgnoringBlockTriggers
public boolean isIgnoringBlockTriggers() -
fillCrashReportCategory
-
displayFireAnimation
public boolean displayFireAnimation() -
setUUID
-
getUUID
- Specified by:
getUUIDin interfaceUniquelyIdentifyable
-
getStringUUID
-
getScoreboardName
- Specified by:
getScoreboardNamein interfaceScoreHolder
-
isPushedByFluid
Deprecated. -
getViewScale
public static double getViewScale() -
setViewScale
public static void setViewScale(double renderDistWeight) -
getDisplayName
- Specified by:
getDisplayNamein interfaceNameable- Specified by:
getDisplayNamein interfaceScoreHolder
-
setCustomName
-
getCustomName
- Specified by:
getCustomNamein interfaceNameable
-
hasCustomName
public boolean hasCustomName()- Specified by:
hasCustomNamein interfaceNameable
-
setCustomNameVisible
public void setCustomNameVisible(boolean alwaysRenderNameTag) -
isCustomNameVisible
public boolean isCustomNameVisible() -
teleportTo
public boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera) -
dismountTo
public void dismountTo(double x, double y, double z) -
teleportTo
public void teleportTo(double x, double y, double z) Sets the position of the entity and updates the 'last' variables -
teleportPassengers
private void teleportPassengers() -
teleportRelative
public void teleportRelative(double dx, double dy, double dz) -
shouldShowName
public boolean shouldShowName() -
onSyncedDataUpdated
- Specified by:
onSyncedDataUpdatedin interfaceSyncedDataHolder
-
onSyncedDataUpdated
- Specified by:
onSyncedDataUpdatedin interfaceSyncedDataHolder
-
fixupDimensions
Deprecated. -
refreshDimensions
public void refreshDimensions() -
fudgePositionAfterSizeChange
-
getDirection
-
getMotionDirection
-
createHoverEvent
-
broadcastToPlayer
-
getBoundingBox
- Specified by:
getBoundingBoxin interfaceEntityAccess
-
setBoundingBox
-
getEyeHeight
-
getEyeHeight
public final float getEyeHeight() -
getLeashOffset
-
getLeashOffset
-
getSlot
-
getCommandSenderWorld
-
getServer
-
interactAt
Applies the given player interaction to this Entity. -
ignoreExplosion
-
startSeenByPlayer
Add the given player to the list of players tracking this entity. For instance, a player may track a boss in order to view its associated boss bar. -
stopSeenByPlayer
Removes the given player from the list of players tracking this entity. Seefor more information on tracking.invalid reference
Entity#addTrackingPlayer -
rotate
Transforms the entity's current yaw with the given Rotation and returns it. This does not have a side-effect. -
mirror
Transforms the entity's current yaw with the given Mirror and returns it. This does not have a side-effect. -
deflection
-
getControllingPassenger
-
hasControllingPassenger
public final boolean hasControllingPassenger() -
getPassengers
-
getFirstPassenger
-
hasPassenger
-
hasPassenger
-
getIndirectPassengersStream
-
getSelfAndPassengers
- Specified by:
getSelfAndPassengersin interfaceEntityAccess
-
getPassengersAndSelf
- Specified by:
getPassengersAndSelfin interfaceEntityAccess
-
getIndirectPassengers
-
countPlayerPassengers
public int countPlayerPassengers() -
hasExactlyOnePlayerPassenger
public boolean hasExactlyOnePlayerPassenger() -
getRootVehicle
-
isPassengerOfSameVehicle
-
hasIndirectPassenger
-
isLocalInstanceAuthoritative
public final boolean isLocalInstanceAuthoritative() -
isLocalClientAuthoritative
protected boolean isLocalClientAuthoritative() -
isClientAuthoritative
public boolean isClientAuthoritative() -
canSimulateMovement
public boolean canSimulateMovement() -
isEffectiveAi
public boolean isEffectiveAi() -
getCollisionHorizontalEscapeVector
protected static Vec3 getCollisionHorizontalEscapeVector(double vehicleWidth, double passengerWidth, float yRot) -
getDismountLocationForPassenger
-
getVehicle
-
getControlledVehicle
-
getPistonPushReaction
-
getSoundSource
-
getFireImmuneTicks
protected int getFireImmuneTicks() -
createCommandSourceStackForNameResolution
-
lookAt
-
getPreciseBodyRotation
public float getPreciseBodyRotation(float partialTick) -
updateFluidHeightAndDoFluidPushing
@Deprecated public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> fluidTag, double motionScale) Deprecated. -
updateFluidHeightAndDoFluidPushing
public void updateFluidHeightAndDoFluidPushing() -
touchingUnloadedChunk
public boolean touchingUnloadedChunk() -
getFluidHeight
Deprecated. -
getFluidJumpThreshold
public double getFluidJumpThreshold() -
getBbWidth
public final float getBbWidth() -
getBbHeight
public final float getBbHeight() -
getAddEntityPacket
-
getDimensions
-
getAttachments
-
position
-
trackingPosition
-
blockPosition
- Specified by:
blockPositionin interfaceEntityAccess
-
getInBlockState
-
chunkPosition
-
getDeltaMovement
-
setDeltaMovement
-
addDeltaMovement
-
setDeltaMovement
public void setDeltaMovement(double x, double y, double z) -
getBlockX
public final int getBlockX() -
getX
public final double getX() -
getX
public double getX(double scale) -
getRandomX
public double getRandomX(double scale) -
getBlockY
public final int getBlockY() -
getY
public final double getY() -
getY
public double getY(double scale) -
getRandomY
public double getRandomY() -
getEyeY
public double getEyeY() -
getBlockZ
public final int getBlockZ() -
getZ
public final double getZ() -
getZ
public double getZ(double scale) -
getRandomZ
public double getRandomZ(double scale) -
setPosRaw
public final void setPosRaw(double x, double y, double z) Directly updates the,invalid reference
#posX, andinvalid reference
posYfields, without performing any collision checks, updating the bounding box position, or sending any packets. In general, this is not what you want andinvalid reference
posZis better, as that handles the bounding box.invalid reference
#setPosition -
checkDespawn
public void checkDespawn() -
getRopeHoldPosition
-
recreateFromPacket
-
getPickResult
-
setIsInPowderSnow
public void setIsInPowderSnow(boolean isInPowderSnow) -
canFreeze
public boolean canFreeze() -
isFreezing
public boolean isFreezing() -
getYRot
public float getYRot() -
getVisualRotationYInDegrees
public float getVisualRotationYInDegrees() -
setYRot
public void setYRot(float yRot) -
getXRot
public float getXRot() -
setXRot
public void setXRot(float xRot) -
canSprint
public boolean canSprint() -
maxUpStep
public float maxUpStep() -
onExplosionHit
-
isRemoved
public final boolean isRemoved()- Specified by:
isRemovedin interfaceUniquelyIdentifyable
-
getRemovalReason
-
setRemoved
- Specified by:
setRemovedin interfaceEntityAccess
-
unsetRemoved
protected void unsetRemoved() -
setLevelCallback
- Specified by:
setLevelCallbackin interfaceEntityAccess
-
shouldBeSaved
public boolean shouldBeSaved()- Specified by:
shouldBeSavedin interfaceEntityAccess
-
isAlwaysTicking
public boolean isAlwaysTicking()- Specified by:
isAlwaysTickingin interfaceEntityAccess
-
mayInteract
-
captureDrops
- Specified by:
captureDropsin interfaceIEntityExtension
-
captureDrops
- Specified by:
captureDropsin interfaceIEntityExtension
-
getPersistentData
Description copied from interface:IEntityExtensionReturns a NBTTagCompound that can be used to store custom data for this entity. It will be written, and read from disc, so it persists over world saves.- Specified by:
getPersistentDatain interfaceIEntityExtension- Returns:
- A NBTTagCompound
-
canTrample
Description copied from interface:IEntityExtension- Specified by:
canTramplein interfaceIEntityExtension- Parameters:
pos- The block posfallDistance- The fall distance- Returns:
trueif this entity can trample,falseotherwise
-
isAddedToLevel
public final boolean isAddedToLevel()Description copied from interface:IEntityExtensionGets whether this entity has been added to a world (for tracking). Specifically between the times when an entity is added to a world and the entity being removed from the world's tracked lists.- Specified by:
isAddedToLevelin interfaceIEntityExtension- Returns:
- True if this entity is being tracked by a world
-
onAddedToLevel
public void onAddedToLevel()Description copied from interface:IEntityExtensionCalled after the entity has been added to the world's ticking list.- Specified by:
onAddedToLevelin interfaceIEntityExtension
-
onRemovedFromLevel
public void onRemovedFromLevel()Description copied from interface:IEntityExtensionCalled after the entity has been removed to the world's ticking list.- Specified by:
onRemovedFromLevelin interfaceIEntityExtension
-
revive
public void revive()Description copied from interface:IEntityExtensionRevives an entity that has been removed from a world. Used as replacement for entity.removed = true. Having it as a function allows the entity to react to being revived.- Specified by:
revivein interfaceIEntityExtension
-
setFluidTypeHeight
-
getFluidTypeHeight
Description copied from interface:IEntityExtensionReturns the height of the fluid type in relation to the bounding box of the entity. If the entity is not in the fluid type, then0is returned.- Specified by:
getFluidTypeHeightin interfaceIEntityExtension- Parameters:
type- the type of the fluid- Returns:
- the height of the fluid compared to the entity
-
isInFluidType
Description copied from interface:IEntityExtensionReturns whether the fluid type the entity is currently in matches the specified condition.- Specified by:
isInFluidTypein interfaceIEntityExtension- Parameters:
predicate- a test taking in the fluid type and its heightforAllTypes-trueif all fluid types should match the condition instead of at least one- Returns:
trueif a fluid type meets the condition,falseotherwise
-
isInFluidType
public final boolean isInFluidType()Description copied from interface:IEntityExtensionReturns whether the entity is in a fluid.- Specified by:
isInFluidTypein interfaceIEntityExtension- Returns:
trueif the entity is in a fluid,falseotherwise
-
getEyeInFluidType
Description copied from interface:IEntityExtensionReturns the fluid that is on the entity's eyes.- Specified by:
getEyeInFluidTypein interfaceIEntityExtension- Returns:
- the fluid that is on the entity's eyes
-
getMaxHeightFluidType
Description copied from interface:IEntityExtensionReturns the fluid type which is the highest on the bounding box of the entity.- Specified by:
getMaxHeightFluidTypein interfaceIEntityExtension- Returns:
- the fluid type which is the highest on the bounding box of the entity
-
setData
Description copied from interface:IAttachmentHolderSets the data attachment of the given type.- Specified by:
setDatain interfaceIAttachmentHolder- Overrides:
setDatain classAttachmentHolder- Returns:
- the previous value for that attachment type, if any, or
nullif there was none
-
getCapability
@Nullable public final <T,C extends @Nullable Object> T getCapability(EntityCapability<T, C> capability, C context) -
getCapability
-
level
-
setLevel
-
damageSources
-
registryAccess
-
lerpPositionAndRotationStep
protected void lerpPositionAndRotationStep(int steps, double targetX, double targetY, double targetZ, double targetYRot, double targetXRot) -
getRandom
-
getKnownMovement
-
getWeaponItem
-
getLootTable
-
applyImplicitComponents
-
applyComponentsFromItemStack
-
get
- Specified by:
getin interfaceDataComponentGetter
-
castComponentValue
@Nullable @Contract("_,!null->!null;_,_->_") protected static <T> T castComponentValue(DataComponentType<T> componentType, @Nullable Object value) -
setComponent
-
applyImplicitComponent
-
applyImplicitComponentIfPresent
protected <T> boolean applyImplicitComponentIfPresent(DataComponentGetter componentGetter, DataComponentType<T> component)
-
rider sensitive version