Class Mob
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.entity.Entity
net.minecraft.world.entity.LivingEntity
net.minecraft.world.entity.Mob
- All Implemented Interfaces:
DataComponentGetter, TypedInstance<EntityType<?>>, SyncedDataHolder, DebugValueSource, Attackable, EquipmentUser, ItemOwner, Leashable, SlotProvider, Targeting, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, Waypoint, WaypointTransmitter, IAttachmentHolder, IEntityExtension, ILivingEntityExtension
- Direct Known Subclasses:
AmbientCreature, EnderDragon, Ghast, PathfinderMob, Phantom, Slime
-
Nested Class Summary
Nested classes/interfaces inherited from class LivingEntity
LivingEntity.FallsoundsNested classes/interfaces inherited from class Entity
Entity.Flags, Entity.MoveFunction, Entity.MovementEmission, Entity.RemovalReasonNested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T>Nested classes/interfaces inherited from interface ItemOwner
ItemOwner.OffsetFromOwnerNested classes/interfaces inherited from interface Leashable
Leashable.LeashData, Leashable.WrenchNested classes/interfaces inherited from interface Waypoint
Waypoint.IconNested classes/interfaces inherited from interface WaypointTransmitter
WaypointTransmitter.BlockConnection, WaypointTransmitter.ChunkConnection, WaypointTransmitter.Connection, WaypointTransmitter.EntityAzimuthConnection, WaypointTransmitter.EntityBlockConnection, WaypointTransmitter.EntityChunkConnection -
Field Summary
FieldsModifier and TypeFieldDescriptionintprivate final BodyRotationControlprivate booleanprivate static final EntityDataAccessor<Byte> private static final doubleprivate static final booleanprivate static final booleanprivate static final booleanprivate static final booleanprivate DropChancesprivate static final List<EquipmentSlot> final GoalSelectorprivate BlockPosprivate intprivate static final Vec3iprotected JumpControlprivate @Nullable Leashable.LeashDataprotected LookControlprivate Optional<ResourceKey<LootTable>> private longstatic final floatstatic final floatstatic final floatstatic final floatprivate static final intprivate static final intprivate static final intprotected MoveControlprotected PathNavigationprivate booleanprotected static final intprotected booleanNeo: Prevent immediate spawning from conversions to capture conversion results for eventsprotected static final Identifierprivate final Sensingprivate booleanprivate @Nullable EntitySpawnReasonstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate @Nullable LivingEntityfinal GoalSelectorstatic final intstatic final floatstatic final floatprotected intFields inherited from class LivingEntity
ARMOR_SLOT_OFFSET, attackAnim, attackStrengthTicker, autoSpinAttackDmg, autoSpinAttackItemStack, autoSpinAttackTicks, BASE_JUMP_POWER, BODY_ARMOR_OFFSET, brain, currentExplosionCause, currentImpulseImpactPos, damageContainers, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathTime, DEFAULT_BABY_SCALE, DEFAULT_BASE_GRAVITY, DEFAULT_KNOCKBACK, elytraAnimationState, equipment, EQUIPMENT_SLOT_OFFSET, EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT, fallFlyTicks, hurtDuration, hurtTime, INPUT_FRICTION, interpolation, INVULNERABLE_DURATION, itemSwapTicker, jumping, lastHurt, lastHurtByPlayer, lastHurtByPlayerMemoryTime, lerpHeadSteps, lerpYHeadRot, LIVING_ENTITY_FLAG_IS_USING, LIVING_ENTITY_FLAG_OFF_HAND, LIVING_ENTITY_FLAG_SPIN_ATTACK, MIN_MOVEMENT_DISTANCE, noActionTime, oAttackAnim, PLAYER_HURT_EXPERIENCE_TIME, PLAYER_NOT_WEARING_DISGUISE_ITEM, PLAYER_NOT_WEARING_DISGUISE_ITEM_FOR_TARGET, recentKineticEnemies, removeArrowTime, removeStingerTime, SADDLE_OFFSET, SLEEPING_DIMENSIONS, swinging, swingingArm, swingTime, TAG_ATTRIBUTES, TAG_BRAIN, TAG_DEATH_TIME, TAG_EQUIPMENT, TAG_FALL_FLYING, TAG_HEALTH, TAG_HURT_BY_TIMESTAMP, TAG_HURT_TIME, TAG_SLEEPING_POS, useItem, useItemRemaining, walkAnimation, xxa, yBodyRot, yBodyRotO, yHeadRot, yHeadRotO, yya, zzaFields inherited from class Entity
BASE_SAFE_FALL_DISTANCE, BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, CONTENTS_SLOT_INDEX, DATA_POSE, DATA_SHARED_FLAGS_ID, DEFAULT_BB_HEIGHT, DEFAULT_BB_WIDTH, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5, DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0, ENTITY_COUNTER, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, horizontalCollision, hurtMarked, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, MAX_MOVEMENTS_HANDELED_PER_TICK, minorHorizontalCollision, moveDist, needsSync, noPhysics, portalProcess, random, stringUUID, stuckSpeedMultiplier, TAG_AIR, TAG_CUSTOM_NAME, TAG_DATA, TAG_FALL_DISTANCE, TAG_FIRE, TAG_GLOWING, TAG_ID, TAG_INVULNERABLE, TAG_MOTION, TAG_NO_GRAVITY, TAG_ON_GROUND, TAG_PASSENGERS, TAG_PORTAL_COOLDOWN, TAG_POS, TAG_ROTATION, TAG_SILENT, TAG_UUID, tickCount, TOTAL_AIR_SUPPLY, uuid, verticalCollision, verticalCollisionBelow, wasEyeInWater, wasInPowderSnow, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOldFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface Leashable
AXIS_SPECIFIC_ELASTICITY, ENTITY_ATTACHMENT_POINT, LEASH_ELASTIC_DIST, LEASH_TAG, LEASH_TOO_FAR_DIST, LEASHER_ATTACHMENT_POINT, MAXIMUM_ALLOWED_LEASHED_DIST, SHARED_QUAD_ATTACHMENT_POINTS, SPRING_DAMPENING, STIFFNESS, TORSIONAL_ELASTICITYFields inherited from interface ScoreHolder
WILDCARD, WILDCARD_NAMEFields inherited from interface Waypoint
MAX_RANGE, WAYPOINT_TRANSMIT_RANGE_HIDE_MODIFIERFields inherited from interface WaypointTransmitter
REALLY_FAR_DISTANCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalSaveData(ValueOutput output) voidaiStep()protected @Nullable LivingEntityasValidTarget(@Nullable LivingEntity target) voidate()voidbaseTick()private voidbooleancanAttack(LivingEntity target) booleanprotected booleanbooleancanHoldItem(ItemStack itemStack) booleanprotected booleancanReplaceCurrentItem(ItemStack newItemStack, ItemStack currentItemStack, EquipmentSlot slot) booleancanReplaceEqualItem(ItemStack newItemStack, ItemStack currentItemStack) protected booleancanShearEquipment(Player player) booleanfloatprivate InteractionResultcheckAndHandleImportantInteractions(Player player, InteractionHand hand) voidstatic booleancheckMobSpawnRules(EntityType<? extends Mob> type, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) booleancheckSpawnObstruction(LevelReader level) booleancheckSpawnRules(LevelAccessor level, EntitySpawnReason spawnReason) protected voidvoidprivate booleancompareArmor(ItemStack newItemStack, ItemStack currentItemStack, EquipmentSlot slot) private booleancompareWeapons(ItemStack newItemStack, ItemStack currentItemStack, EquipmentSlot slot) <T extends Mob>
@Nullable TconvertTo(EntityType<T> entityType, ConversionParams params, ConversionParams.AfterConversion<T> afterConversion) <T extends Mob>
@Nullable TconvertTo(EntityType<T> entityType, ConversionParams params, EntitySpawnReason spawnReason, ConversionParams.AfterConversion<T> afterConversion) protected BodyRotationControlprivate LootParamscreateEquipmentParams(ServerLevel serverLevel) static AttributeSupplier.Builderprotected PathNavigationcreateNavigation(Level level) protected voidcustomServerAiStep(ServerLevel level) protected voiddefineSynchedData(SynchedEntityData.Builder entityData) booleandoHurtTarget(ServerLevel level, Entity target) protected voiddropCustomDeathLoot(ServerLevel level, DamageSource source, boolean killedByPlayer) protected voiddropFromLootTable(ServerLevel level, DamageSource source, boolean playerKilled) voiddropPreservedEquipment(ServerLevel level, Predicate<ItemStack> shouldDrop) protected voidenchantSpawnedArmor(ServerLevelAccessor level, RandomSource random, EquipmentSlot slot, DifficultyInstance difficulty) private voidenchantSpawnedEquipment(ServerLevelAccessor level, EquipmentSlot slot, RandomSource random, float chance, DifficultyInstance difficulty) protected voidenchantSpawnedWeapon(ServerLevelAccessor level, RandomSource random, DifficultyInstance difficulty) voidequip(ResourceKey<LootTable> lootTable, Map<EquipmentSlot, Float> dropChances) voidequip(EquipmentTable equipment) equipItemIfPossible(ServerLevel level, ItemStack itemStack) @Nullable SpawnGroupDatafinalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData groupData) Deprecated.Override-Only.protected @Nullable SoundEventintprivate doublegetApproximateAttributeWith(ItemStack itemStack, Holder<Attribute> attribute, EquipmentSlot slot) protected AABBgetAttackBoundingBox(double horizontalExpansion) protected int@Nullable LivingEntitystatic @Nullable ItemgetEquipmentForSlot(EquipmentSlot slot, int type) intint@Nullable Leashable.LeashDatafinal Optional<ResourceKey<LootTable>> longintintintintfloatgetPathfindingMalus(PathType pathType) @Nullable ItemStackprotected Vec3ifinal @Nullable EntitySpawnReasonReturns the type of spawn that created this mob, if applicable.@Nullable LivingEntityprotected final @Nullable LivingEntity@Nullable LivingEntityvoidhandleEntityEvent(byte id) Handler forinvalid reference
World#setEntityStatebooleanhasHome()private booleaninteract(Player player, InteractionHand hand, Vec3 location) booleanbooleanbooleanbooleanisMaxGroupSizeReached(int groupSize) booleanisNoAi()booleanbooleanfinal booleanThis method exists so that spawns can be cancelled from theFinalizeSpawnEventwithout needing to hook up an additional handler for theEntityJoinLevelEvent.private booleanbooleanbooleanbooleanisWithinHome(BlockPos pos) booleanisWithinHome(Vec3 pos) booleanisWithinMeleeAttackRange(LivingEntity target) voidjumpInFluid(FluidType type) Performs what to do when an entity attempts to go up or "jump" in a fluid.protected voidjumpInLiquid(TagKey<Fluid> type) Deprecated.private voidjumpInLiquidInternal(Runnable onSuper) voidvoidChanges the X and Y rotation so that this entity is facing the given entity.protected InteractionResultmobInteract(Player player, InteractionHand hand) protected voidonAttributeUpdated(Holder<Attribute> attribute) voidprotected voidonOffspringSpawnedFromEgg(Player spawner, Mob offspring) voidvoidprotected voidpickUpItem(ServerLevel level, ItemEntity entity) voidprotected voidplayHurtSound(DamageSource source) protected voidpopulateDefaultEquipmentEnchantments(ServerLevelAccessor level, RandomSource random, DifficultyInstance localDifficulty) protected voidpopulateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) protected voidreadAdditionalSaveData(ValueInput input) voidregisterDebugValues(ServerLevel level, DebugValueSource.Registration registration) protected voidprotected voidvoidremoveAllGoals(Predicate<Goal> predicate) voidbooleanremoveWhenFarAway(double distSqr) booleanprivate voidprivate voidprivate floatrotlerp(float a, float b, float max) Arguments: current rotation, intended rotation, max increment.protected final voidvoidsetAggressive(boolean flag) voidsetBaby(boolean baby) Set whether this mob is a child.voidsetBodyArmorItem(ItemStack item) voidsetCanPickUpLoot(boolean canPickUpLoot) voidsetDropChance(EquipmentSlot slot, float percent) voidvoidprotected voidsetItemSlotAndDropWhenKilled(EquipmentSlot slot, ItemStack itemStack) voidsetLeashData(@Nullable Leashable.LeashData leashData) voidsetLeftHanded(boolean flag) voidsetNoAi(boolean flag) Set whether this Entity's AI is disabledvoidsetPathfindingMalus(PathType pathType, float cost) voidvoidsetPersistenceRequired(boolean persistenceRequired) final voidsetSpawnCancelled(boolean cancel) Marks this mob as being disallowed to spawn duringLevelWriter.addFreshEntity(Entity).voidsetSpeed(float speed) Sets the movespeed used for the new AI system.voidsetTarget(@Nullable LivingEntity target) Sets the active target the Goal system uses for trackingvoidsetXxa(float xxa) voidsetYya(float yya) voidsetZza(float zza) protected booleanvoidbooleanstartRiding(Entity entity, boolean force, boolean sendEventAndTriggers) voidprotected EquipmentSlotvoidtick()protected voidtickHeadTurn(float yBodyRotT) protected voidprotected voidusePlayerItem(Player player, InteractionHand hand, ItemStack itemStack) booleanwantsToPickUp(ServerLevel level, ItemStack itemStack) Methods inherited from class LivingEntity
activeLocationDependentEnchantments, actuallyHurt, addEffect, addEffect, animateHurt, applyInput, applyItemBlocking, applyPostImpulseGraceTime, areAllEffectsAmbient, asLivingEntity, attackable, blockedByItem, blockUsingItem, calculateEntityAnimation, calculateFallDamage, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canEquipWithDispenser, canFreeze, canGlide, canGlideUsing, canStandOnFluid, canUsePortal, canUseSlot, causeExtraKnockback, causeFallDamage, checkAutoSpinAttack, checkFallDamage, clearSleepingPos, completeUsingItem, createEquipment, createLivingAttributes, createWitherRose, decreaseAirSupply, die, doAutoAttackOnTouch, doesEmitEquipEvent, doHurtEquipment, doPush, drop, dropAllDeathLoot, dropEquipment, dropExperience, dropFromEntityInteractLootTable, dropFromGiftLootTable, dropFromLootTable, dropFromLootTable, dropFromLootTable, dropFromShearingLootTable, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getActiveItem, getAgeScale, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, getAttackRangeWith, getAttribute, getAttributeBaseValue, getAttributes, getAttributeValue, getBedOrientation, getBlockSpeedFactor, getBrain, getCombatTracker, getComfortableFallDistance, getCurrentSwingDuration, getDamageAfterArmorAbsorb, getDamageAfterMagicAbsorb, getDeathSound, getDefaultDimensions, getDefaultGravity, getDimensions, getDismountPoses, getEffect, getEffectBlendFactor, getEffectiveGravity, getEquipmentSlotForItem, getEquipSound, getExperienceReward, getFallFlyingTicks, getFallSounds, getFluidFallingAdjustedMovement, getFlyingSpeed, getHealth, getHitbox, getHurtDir, getHurtSound, getInterpolation, getItemBlockingWith, getItemBySlot, getItemHeldByArm, getItemInHand, getJumpBoostPower, getJumpPower, getJumpPower, getKillCredit, getKnockback, getLastAttacker, getLastClimbablePos, getLastDamageSource, getLastHurtByMob, getLastHurtByMobTimestamp, getLastHurtByPlayer, getLastHurtByPlayerMemoryTime, getLastHurtMob, getLastHurtMobTimestamp, getLiquidCollisionShape, getLocalBoundsForPose, getLuck, getMainHandItem, getMaxAbsorption, getMaxHeadRotationRelativeToBody, getMaxHealth, getNoActionTime, getOffhandItem, getPassengerRidingPosition, getPreciseBodyRotation, getProjectile, getRelativePortalPosition, getRiddenInput, getRiddenSpeed, getScale, getSecondsToDisableBlocking, getSleepingPos, getSlot, getSoundVolume, getSpeed, getStingerCount, getSwimAmount, getTicksSinceLastKineticHitFeedback, getTicksUsingItem, getTicksUsingItem, getUsedItemHand, getUseItem, getUseItemRemainingTicks, getViewYRot, getVisibilityPercent, getVisualRotationYInDegrees, getVoicePitch, getWaterSlowDown, getWeaponItem, getYHeadRot, goDownInWater, handleDamageEvent, handleExtraItemsCreatedOnUse, hasEffect, hasInfiniteMaterials, hasItemInSlot, hasLandedInLiquid, hasLineOfSight, hasLineOfSight, heal, hurtArmor, hurtHelmet, hurtServer, igniteForTicks, increaseAirSupply, indicateDamage, internalSetAbsorptionAmount, isAffectedByFluids, isAffectedByPotions, isAlive, isAlwaysExperienceDropper, isAutoSpinAttack, isBaby, isBlocking, isCurrentlyGlowing, isDeadOrDying, isEquippableInSlot, isFallFlying, isHolding, isHolding, isIgnoringFallDamageFromCurrentImpulse, isImmobile, isInPostImpulseGraceTime, isInvertedHealAndHarm, isInvulnerableTo, isInWall, isJumping, isLookingAtMe, isPickable, isPushable, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isTransmittingWaypoint, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadRotationStep, lerpHeadTo, lookAt, makeBrain, makePoofParticles, makeSound, makeWaypointConnectionWith, maxUpStep, onAttack, onBelowWorld, onChangedBlock, onClimbable, onEffectAdded, onEffectsRemoved, onEffectUpdated, onEnterCombat, onEquipItem, onEquippedItemBroken, onItemPickup, onLeaveCombat, onRemoval, onSyncedDataUpdated, playAttackSound, playBlockFallSound, postPiercingAttack, push, pushEntities, randomTeleport, recreateFromPacket, releaseUsingItem, rememberStabbedEntity, remove, removeAllEffects, removeEffect, removeEffectNoUpdate, removeEffectParticles, removeFrost, resetCurrentImpulseContext, resetForwardDirectionOfRelativePortalPosition, resolveMobResponsibleForDamage, resolvePlayerResponsibleForDamage, rideTick, sanitizeScale, sendEffectToPassengers, setAbsorptionAmount, setArrowCount, setDiscardFriction, setHealth, setIgnoreFallDamageFromCurrentImpulse, setItemInHand, setItemSlot, setItemSlot, setJumping, setLastHurtByMob, setLastHurtByPlayer, setLastHurtByPlayer, setLastHurtMob, setLivingEntityFlag, setNoActionTime, setRecordPlayingNearby, setSleepingPos, setSprinting, setStingerCount, setYBodyRot, setYHeadRot, shouldDiscardFriction, shouldDropExperience, shouldDropLoot, shouldShowName, shouldTakeDrowningDamage, shouldTravelInFluid, skipDropExperience, spawnItemParticles, stabAttack, stabbedEntities, startSleeping, startUsingItem, stopFallFlying, stopRiding, stopSleeping, stopUsingItem, swing, swing, take, tickDeath, tickEffects, tickRidden, travel, travelFlying, travelFlying, travelInWater, triggerOnDeathMobEffects, tryAddFrost, tryResetCurrentImpulseContext, updateDataBeforeSync, updateEffectVisibility, updateFallFlying, updateInvisibilityStatus, updateSwingTime, updateUsingItem, updateWalkAnimation, wasExperienceConsumed, wasRecentlyStabbed, waypointIcon, wouldNotSuffocateAtTargetPoseMethods inherited from class Entity
absSnapRotationTo, absSnapTo, absSnapTo, addDeltaMovement, addPassenger, addTag, adjustSpawnLocation, applyComponentsFromItemStack, applyEffectsFromBlocks, applyEffectsFromBlocks, applyGravity, applyImplicitComponent, applyImplicitComponentIfPresent, applyImplicitComponents, awardKillScore, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canCollideWith, canControlVehicle, canInteractWithLevel, canRide, canSimulateMovement, canSpawnSprintParticle, canSprint, canTeleport, canTrample, captureDrops, captureDrops, castComponentValue, checkBelowWorld, checkFallDistanceAccumulation, checkSupportingBlock, chunkPosition, clearFire, clearFreeze, clearMovementThisTick, closerThan, closerThan, collectAllColliders, collideBoundingBox, collidedWithFluid, collidedWithShapeMovingFrom, computeSpeed, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, dropAllLeashConnections, ejectPassengers, entityTags, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, get, getAddEntityPacket, getAirSupply, getAttachments, getAvailableSpaceBelow, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getCapability, getCapability, getCollisionHorizontalEscapeVector, getControlledVehicle, getCustomName, getDefaultPassengerAttachmentPoint, getDeltaMovement, getDimensionChangingDelay, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getEyeHeight, getEyeHeight, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getGravity, getHandHoldingItemAngle, getHeadLookAngle, getId, getInBlockState, getIndirectPassengers, getInputVector, getKnownMovement, getKnownSpeed, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxHeightFluidType, getMotionDirection, getMovementEmission, getName, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, getPassengers, getPassengersAndSelf, getPercentFrozen, getPersistentData, getPickRadius, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPrimaryStepSoundBlockPos, getQuadLeashHolderOffsets, getRandom, getRandomX, getRandomY, getRandomZ, getRemainingFireTicks, getRemovalReason, getRequiresPrecisePosition, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getTypeName, getUpVector, getUUID, getVehicle, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getX, getX, getXRot, getXRot, getY, getY, getYRot, getYRot, getZ, getZ, handleOnAboveBubbleColumn, handleOnInsideBubbleColumn, handlePortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasMovedHorizontallyRecently, hasPassenger, hasPassenger, hasPose, hurt, hurtClient, hurtOrSimulate, igniteForSeconds, ignoreExplosion, is, isAddedToLevel, isAffectedByBlocks, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isClientAuthoritative, isColliding, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFlyingVehicle, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInClouds, isInFluidType, isInFluidType, isInLava, isInLiquid, isInRain, isInShallowWater, isInterpolating, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableToBase, isInWater, isInWaterOrRain, isLocalClientAuthoritative, isLocalInstanceAuthoritative, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, killedEntity, lavaHurt, lavaIgnite, lerpMotion, lerpPositionAndRotationStep, level, limitPistonMovement, load, makeBoundingBox, makeBoundingBox, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mayInteract, mirror, move, moveOrInterpolateTo, moveOrInterpolateTo, moveOrInterpolateTo, moveOrInterpolateTo, moveRelative, moveTowardsClosestSpace, nextStep, notifyLeasheeRemoved, notifyLeashHolder, oldPosition, onAboveBubbleColumn, onAddedToLevel, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onPassengerTurned, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, problemPath, processFlappingMovement, processPortalCooldown, propagateFallToPassengers, push, push, reapplyPosition, refreshDimensions, registryAccess, removeLatestMovementRecording, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, 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, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYRot, shearOffAllLeashConnections, shouldBeSaved, shouldBlockExplode, shouldPlayLavaHurtSound, shouldRender, shouldRenderAtSqrDistance, showVehicleHealth, skipAttackInteraction, snapTo, snapTo, snapTo, snapTo, snapTo, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startSeenByPlayer, stopSeenByPlayer, supportQuadLeashAsHolder, syncData, syncPacketPositionCodec, teleport, teleportRelative, teleportSetPosition, teleportSetPosition, teleportSpectators, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, turn, typeHolder, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoCanPushEntityFluidPushing, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateInWaterStateAndDoWaterCurrentPushing, updateInWaterStateAndDoWaterCurrentPushing, updateSwimming, waterSwimSoundMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachmentsMethods inherited from interface DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, has, hasMethods inherited from interface EquipmentUser
equip, equip, equip, getItemBySlot, resolveSlot, setItemSlotMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canTrample, captureDrops, captureDrops, copyAttachmentsFrom, getClassification, getEyeInFluidType, getFluidFallDistanceModifier, getFluidMotionScale, getFluidTypeHeight, getMaxHeightFluidType, getParts, getPersistentData, getSoundFromFluidType, hasCustomOutlineRendering, isAddedToLevel, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, onAddedToLevel, onRemovedFromLevel, revive, sendPairingData, shouldRiderSitMethods inherited from interface ILivingEntityExtension
canDrownInFluidType, canSwimInFluidType, moveInFluid, onDamageTaken, self, sinkInFluidMethods inherited from interface Leashable
canHaveALeashAttachedTo, checkElasticInteractions, closeRangeLeashBehaviour, dropLeash, getLeashHolder, getLeashOffset, getLeashOffset, getQuadLeashOffsets, isLeashed, leashDistanceTo, leashElasticDistance, leashSnapDistance, mayBeLeashed, onElasticLeashPull, readLeashData, removeLeash, setDelayedLeashHolderId, setLeashedTo, supportQuadLeash, whenLeashedTo, writeLeashDataMethods inherited from interface Nameable
getPlainTextNameMethods inherited from interface ScoreHolder
getFeedbackDisplayNameMethods inherited from interface SlotProvider
getSlotsFromRange
-
Field Details
-
DATA_MOB_FLAGS_ID
-
MOB_FLAG_NO_AI
private static final int MOB_FLAG_NO_AI- See Also:
-
MOB_FLAG_LEFTHANDED
private static final int MOB_FLAG_LEFTHANDED- See Also:
-
MOB_FLAG_AGGRESSIVE
private static final int MOB_FLAG_AGGRESSIVE- See Also:
-
PICKUP_REACH
protected static final int PICKUP_REACH- See Also:
-
ITEM_PICKUP_REACH
-
EQUIPMENT_POPULATION_ORDER
-
MAX_WEARING_ARMOR_CHANCE
public static final float MAX_WEARING_ARMOR_CHANCE- See Also:
-
WEARING_ARMOR_UPGRADE_MATERIAL_CHANCE
public static final float WEARING_ARMOR_UPGRADE_MATERIAL_CHANCE- See Also:
-
WEARING_ARMOR_UPGRADE_MATERIAL_ATTEMPTS
public static final float WEARING_ARMOR_UPGRADE_MATERIAL_ATTEMPTS- See Also:
-
MAX_PICKUP_LOOT_CHANCE
public static final float MAX_PICKUP_LOOT_CHANCE- See Also:
-
MAX_ENCHANTED_ARMOR_CHANCE
public static final float MAX_ENCHANTED_ARMOR_CHANCE- See Also:
-
MAX_ENCHANTED_WEAPON_CHANCE
public static final float MAX_ENCHANTED_WEAPON_CHANCE- See Also:
-
UPDATE_GOAL_SELECTOR_EVERY_N_TICKS
public static final int UPDATE_GOAL_SELECTOR_EVERY_N_TICKS- See Also:
-
DEFAULT_ATTACK_REACH
private static final double DEFAULT_ATTACK_REACH -
DEFAULT_CAN_PICK_UP_LOOT
private static final boolean DEFAULT_CAN_PICK_UP_LOOT- See Also:
-
DEFAULT_PERSISTENCE_REQUIRED
private static final boolean DEFAULT_PERSISTENCE_REQUIRED- See Also:
-
DEFAULT_LEFT_HANDED
private static final boolean DEFAULT_LEFT_HANDED- See Also:
-
DEFAULT_NO_AI
private static final boolean DEFAULT_NO_AI- See Also:
-
RANDOM_SPAWN_BONUS_ID
-
TAG_DROP_CHANCES
- See Also:
-
TAG_LEFT_HANDED
- See Also:
-
TAG_CAN_PICK_UP_LOOT
- See Also:
-
TAG_NO_AI
- See Also:
-
ambientSoundTime
public int ambientSoundTime -
xpReward
protected int xpReward -
lookControl
-
moveControl
-
jumpControl
-
bodyRotationControl
-
goalSelector
-
targetSelector
-
target
-
sensing
-
dropChances
-
canPickUpLoot
private boolean canPickUpLoot -
persistenceRequired
private boolean persistenceRequired -
pathfindingMalus
-
lootTable
-
lootTableSeed
private long lootTableSeed -
leashData
-
homePosition
-
homeRadius
private int homeRadius -
spawnType
-
spawnCancelled
private boolean spawnCancelled -
preventConversionSpawns
protected boolean preventConversionSpawnsNeo: Prevent immediate spawning from conversions to capture conversion results for events
-
-
Constructor Details
-
Mob
-
-
Method Details
-
registerGoals
protected void registerGoals() -
createMobAttributes
-
shouldPassengersInheritMalus
protected boolean shouldPassengersInheritMalus() -
getPathfindingMalus
-
setPathfindingMalus
-
onPathfindingStart
public void onPathfindingStart() -
onPathfindingDone
public void onPathfindingDone() -
createBodyControl
-
getLookControl
-
getMoveControl
-
getJumpControl
-
getControllingPassenger
- Overrides:
getControllingPassengerin classEntity
-
getSensing
-
getTarget
-
getTargetUnchecked
-
asValidTarget
-
getTargetFromBrain
-
setTarget
Sets the active target the Goal system uses for tracking -
canAttack
- Overrides:
canAttackin classLivingEntity
-
canUseNonMeleeWeapon
-
ate
public void ate() -
defineSynchedData
- Overrides:
defineSynchedDatain classLivingEntity
-
getAmbientSoundInterval
public int getAmbientSoundInterval() -
playAmbientSound
public void playAmbientSound() -
baseTick
public void baseTick()- Overrides:
baseTickin classLivingEntity
-
playHurtSound
- Overrides:
playHurtSoundin classLivingEntity
-
resetAmbientSoundTime
private void resetAmbientSoundTime() -
getBaseExperienceReward
- Overrides:
getBaseExperienceRewardin classLivingEntity
-
spawnAnim
public void spawnAnim() -
handleEntityEvent
public void handleEntityEvent(byte id) Description copied from class:LivingEntityHandler forinvalid reference
World#setEntityState- Overrides:
handleEntityEventin classLivingEntity
-
tick
public void tick()- Overrides:
tickin classLivingEntity
-
updateControlFlags
protected void updateControlFlags() -
tickHeadTurn
protected void tickHeadTurn(float yBodyRotT) - Overrides:
tickHeadTurnin classLivingEntity
-
getAmbientSound
-
addAdditionalSaveData
- Overrides:
addAdditionalSaveDatain classLivingEntity
-
readAdditionalSaveData
- Overrides:
readAdditionalSaveDatain classLivingEntity
-
dropFromLootTable
- Overrides:
dropFromLootTablein classLivingEntity
-
getLootTable
- Overrides:
getLootTablein classEntity
-
getLootTableSeed
public long getLootTableSeed()- Overrides:
getLootTableSeedin classLivingEntity
-
setZza
public void setZza(float zza) -
setYya
public void setYya(float yya) -
setXxa
public void setXxa(float xxa) -
setSpeed
public void setSpeed(float speed) Sets the movespeed used for the new AI system.- Overrides:
setSpeedin classLivingEntity
-
stopInPlace
public void stopInPlace() -
aiStep
public void aiStep()- Overrides:
aiStepin classLivingEntity
-
sunProtectionSlot
-
burnUndead
private void burnUndead() -
isSunBurnTick
private boolean isSunBurnTick() -
getPickupReach
-
pickUpItem
-
equipItemIfPossible
-
setItemSlotAndDropWhenKilled
-
canShearEquipment
-
setGuaranteedDrop
-
canReplaceCurrentItem
protected boolean canReplaceCurrentItem(ItemStack newItemStack, ItemStack currentItemStack, EquipmentSlot slot) -
compareArmor
private boolean compareArmor(ItemStack newItemStack, ItemStack currentItemStack, EquipmentSlot slot) -
compareWeapons
private boolean compareWeapons(ItemStack newItemStack, ItemStack currentItemStack, EquipmentSlot slot) -
getApproximateAttributeWith
private double getApproximateAttributeWith(ItemStack itemStack, Holder<Attribute> attribute, EquipmentSlot slot) -
canReplaceEqualItem
-
canHoldItem
-
wantsToPickUp
-
getPreferredWeaponType
-
removeWhenFarAway
public boolean removeWhenFarAway(double distSqr) -
requiresCustomPersistence
public boolean requiresCustomPersistence() -
checkDespawn
public void checkDespawn()- Overrides:
checkDespawnin classEntity
-
serverAiStep
protected final void serverAiStep()- Overrides:
serverAiStepin classLivingEntity
-
customServerAiStep
-
getMaxHeadXRot
public int getMaxHeadXRot() -
getMaxHeadYRot
public int getMaxHeadYRot() -
clampHeadRotationToBody
protected void clampHeadRotationToBody() -
getHeadRotSpeed
public int getHeadRotSpeed() -
lookAt
Changes the X and Y rotation so that this entity is facing the given entity. -
rotlerp
private float rotlerp(float a, float b, float max) Arguments: current rotation, intended rotation, max increment. -
checkMobSpawnRules
public static boolean checkMobSpawnRules(EntityType<? extends Mob> type, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) -
checkSpawnRules
-
checkSpawnObstruction
-
getMaxSpawnClusterSize
public int getMaxSpawnClusterSize() -
isMaxGroupSizeReached
public boolean isMaxGroupSizeReached(int groupSize) -
getMaxFallDistance
public int getMaxFallDistance()- Overrides:
getMaxFallDistancein classLivingEntity
-
getBodyArmorItem
-
isSaddled
public boolean isSaddled() -
isWearingBodyArmor
public boolean isWearingBodyArmor() -
hasValidEquippableItemForSlot
-
setBodyArmorItem
-
createEquipmentSlotContainer
-
dropCustomDeathLoot
- Overrides:
dropCustomDeathLootin classLivingEntity
-
getDropChances
-
dropPreservedEquipment
-
dropPreservedEquipment
public Set<EquipmentSlot> dropPreservedEquipment(ServerLevel level, Predicate<ItemStack> shouldDrop) -
createEquipmentParams
-
equip
-
equip
-
populateDefaultEquipmentSlots
-
getEquipmentForSlot
-
populateDefaultEquipmentEnchantments
protected void populateDefaultEquipmentEnchantments(ServerLevelAccessor level, RandomSource random, DifficultyInstance localDifficulty) -
enchantSpawnedWeapon
protected void enchantSpawnedWeapon(ServerLevelAccessor level, RandomSource random, DifficultyInstance difficulty) -
enchantSpawnedArmor
protected void enchantSpawnedArmor(ServerLevelAccessor level, RandomSource random, EquipmentSlot slot, DifficultyInstance difficulty) -
enchantSpawnedEquipment
private void enchantSpawnedEquipment(ServerLevelAccessor level, EquipmentSlot slot, RandomSource random, float chance, DifficultyInstance difficulty) -
finalizeSpawn
@Deprecated @OverrideOnly public @Nullable SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData groupData) Deprecated.Override-Only. External callers should call viaEventHooks.finalizeMobSpawn(Mob, ServerLevelAccessor, DifficultyInstance, EntitySpawnReason, SpawnGroupData). -
setPersistenceRequired
public void setPersistenceRequired(boolean persistenceRequired) -
setPersistenceRequired
public void setPersistenceRequired() -
setDropChance
- Specified by:
setDropChancein interfaceEquipmentUser
-
canPickUpLoot
public boolean canPickUpLoot()- Overrides:
canPickUpLootin classLivingEntity
-
setCanPickUpLoot
public void setCanPickUpLoot(boolean canPickUpLoot) -
canDispenserEquipIntoSlot
- Overrides:
canDispenserEquipIntoSlotin classLivingEntity
-
isPersistenceRequired
public boolean isPersistenceRequired() -
interact
-
checkAndHandleImportantInteractions
-
onOffspringSpawnedFromEgg
-
mobInteract
-
usePlayerItem
-
isWithinHome
public boolean isWithinHome() -
isWithinHome
-
isWithinHome
-
setHomeTo
-
getHomePosition
-
getHomeRadius
public int getHomeRadius() -
clearHome
public void clearHome() -
hasHome
public boolean hasHome() -
convertTo
public <T extends Mob> @Nullable T convertTo(EntityType<T> entityType, ConversionParams params, EntitySpawnReason spawnReason, ConversionParams.AfterConversion<T> afterConversion) -
convertTo
public <T extends Mob> @Nullable T convertTo(EntityType<T> entityType, ConversionParams params, ConversionParams.AfterConversion<T> afterConversion) -
getLeashData
- Specified by:
getLeashDatain interfaceLeashable
-
resetAngularLeashMomentum
private void resetAngularLeashMomentum() -
setLeashData
- Specified by:
setLeashDatain interfaceLeashable
-
onLeashRemoved
public void onLeashRemoved()- Specified by:
onLeashRemovedin interfaceLeashable
-
leashTooFarBehaviour
public void leashTooFarBehaviour()- Specified by:
leashTooFarBehaviourin interfaceLeashable
-
canBeLeashed
public boolean canBeLeashed()- Specified by:
canBeLeashedin interfaceLeashable
-
startRiding
- Overrides:
startRidingin classEntity
-
isEffectiveAi
public boolean isEffectiveAi()- Overrides:
isEffectiveAiin classEntity
-
setNoAi
public void setNoAi(boolean flag) Set whether this Entity's AI is disabled -
setLeftHanded
public void setLeftHanded(boolean flag) -
setAggressive
public void setAggressive(boolean flag) -
isNoAi
public boolean isNoAi() -
isLeftHanded
public boolean isLeftHanded() -
isAggressive
public boolean isAggressive() -
setBaby
public void setBaby(boolean baby) Set whether this mob is a child. -
getMainArm
- Specified by:
getMainArmin classLivingEntity
-
isWithinMeleeAttackRange
-
getAttackBoundingBox
-
doHurtTarget
- Overrides:
doHurtTargetin classLivingEntity
-
jumpInLiquid
Deprecated.- Overrides:
jumpInLiquidin classLivingEntity
-
jumpInLiquidInternal
-
jumpInFluid
Description copied from interface:ILivingEntityExtensionPerforms what to do when an entity attempts to go up or "jump" in a fluid.- Specified by:
jumpInFluidin interfaceILivingEntityExtension- Parameters:
type- the type of the fluid
-
removeFreeWill
public void removeFreeWill() -
removeAllGoals
-
removeAfterChangingDimensions
protected void removeAfterChangingDimensions()- Overrides:
removeAfterChangingDimensionsin classEntity
-
getPickResult
- Overrides:
getPickResultin classEntity
-
onAttributeUpdated
- Overrides:
onAttributeUpdatedin classLivingEntity
-
registerDebugValues
- Specified by:
registerDebugValuesin interfaceDebugValueSource- Overrides:
registerDebugValuesin classEntity
-
chargeSpeedModifier
public float chargeSpeedModifier() -
getSpawnType
Returns the type of spawn that created this mob, if applicable. If it could not be determined, this will return null.This is set via
finalizeSpawn(ServerLevelAccessor, DifficultyInstance, EntitySpawnReason, SpawnGroupData), so you should not call this from within that method, instead using the parameter. -
isSpawnCancelled
@Internal public final boolean isSpawnCancelled()This method exists so that spawns can be cancelled from theFinalizeSpawnEventwithout needing to hook up an additional handler for theEntityJoinLevelEvent.- Returns:
- if this mob will be blocked from spawning during
LevelWriter.addFreshEntity(Entity)
-
setSpawnCancelled
@Internal public final void setSpawnCancelled(boolean cancel) Marks this mob as being disallowed to spawn duringLevelWriter.addFreshEntity(Entity).- Throws:
UnsupportedOperationException- if this entity has already beenEntity.isAddedToLevel()added to the level.
-