Package net.minecraft.world.entity
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:
CommandSource,SyncedDataHolder,Attackable,EquipmentUser,Leashable,Targeting,EntityAccess,Nameable,ScoreHolder,IAttachmentHolder,IEntityExtension,ILivingEntityExtension,INBTSerializable<CompoundTag>
- Direct Known Subclasses:
AmbientCreature,EnderDragon,FlyingMob,PathfinderMob,Slime
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.LivingEntity
LivingEntity.FallsoundsNested classes/interfaces inherited from class net.minecraft.world.entity.Entity
Entity.MoveFunction, Entity.MovementEmission, Entity.RemovalReasonNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface net.minecraft.world.entity.Leashable
Leashable.LeashData -
Field Summary
FieldsModifier and TypeFieldDescriptionintprotected final float[]private final NonNullList<ItemStack> protected floatprivate ItemStackprivate final BodyRotationControlprivate booleanprivate static final EntityDataAccessor<Byte> private static final doublestatic final floatfinal GoalSelectorprotected final float[]private final NonNullList<ItemStack> private static final Vec3iprotected JumpControlprivate Leashable.LeashDataprotected LookControlprivate 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 intstatic final intstatic final floatprotected static final ResourceLocationprivate BlockPosprivate floatprivate final Sensingprivate booleanprivate MobSpawnTypeprivate LivingEntityfinal GoalSelectorstatic final intprotected intFields inherited from class net.minecraft.world.entity.LivingEntity
animStep, animStepO, appliedScale, ARMOR_SLOT_OFFSET, ARMOR_SLOTS, attackAnim, attackStrengthTicker, ATTRIBUTES_FIELD, autoSpinAttackDmg, autoSpinAttackItemStack, autoSpinAttackTicks, BASE_JUMP_POWER, BODY_ARMOR_OFFSET, brain, damageContainers, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathScore, deathTime, DEFAULT_BABY_SCALE, DEFAULT_BASE_GRAVITY, EQUIPMENT_SLOT_OFFSET, EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT, fallFlyTicks, HAND_SLOTS, hurtDuration, hurtTime, invulnerableDuration, jumping, lastHurt, lastHurtByPlayer, lastHurtByPlayerTime, lerpHeadSteps, lerpSteps, lerpX, lerpXRot, lerpY, lerpYHeadRot, lerpYRot, lerpZ, LIVING_ENTITY_FLAG_IS_USING, LIVING_ENTITY_FLAG_OFF_HAND, LIVING_ENTITY_FLAG_SPIN_ATTACK, MIN_MOVEMENT_DISTANCE, noActionTime, oAttackAnim, oRun, PLAYER_HURT_EXPERIENCE_TIME, removeArrowTime, removeStingerTime, rotA, rotOffs, run, SLEEPING_DIMENSIONS, SWING_DURATION, swinging, swingingArm, swingTime, timeOffs, USE_ITEM_INTERVAL, useItem, useItemRemaining, walkAnimation, xxa, yBodyRot, yBodyRotO, yHeadRot, yHeadRotO, yya, zzaFields inherited from class net.minecraft.world.entity.Entity
BASE_SAFE_FALL_DISTANCE, BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, CONTENTS_SLOT_INDEX, DATA_POSE, DATA_SHARED_FLAGS_ID, DEFAULT_BB_HEIGHT, DEFAULT_BB_WIDTH, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5, DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0, ENTITY_COUNTER, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, ID_TAG, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, minorHorizontalCollision, moveDist, noCulling, noPhysics, PASSENGERS_TAG, portalProcess, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, verticalCollision, verticalCollisionBelow, walkDist, walkDistO, wasEyeInWater, wasInPowderSnow, wasOnFire, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOldFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.commands.CommandSource
NULLFields inherited from interface net.minecraft.world.entity.Leashable
LEASH_ELASTIC_DIST, LEASH_TAG, LEASH_TOO_FAR_DISTFields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalSaveData(CompoundTag pCompound) voidaiStep()voidate()voidbaseTick()booleancanAttackType(EntityType<?> pType) booleanbooleancanFireProjectileWeapon(ProjectileWeaponItem pProjectileWeapon) booleancanHoldItem(ItemStack pStack) booleanprotected booleancanReplaceCurrentItem(ItemStack pCandidate, ItemStack pExisting) booleancanReplaceEqualItem(ItemStack pCandidate, ItemStack pExisting) booleancanTakeItem(ItemStack pItemstack) booleancanUseSlot(EquipmentSlot pSlot) private InteractionResultcheckAndHandleImportantInteractions(Player pPlayer, InteractionHand pHand) voidstatic booleancheckMobSpawnRules(EntityType<? extends Mob> pType, LevelAccessor pLevel, MobSpawnType pSpawnType, BlockPos pPos, RandomSource pRandom) booleancheckSpawnObstruction(LevelReader pLevel) booleancheckSpawnRules(LevelAccessor pLevel, MobSpawnType pReason) protected voidvoid<T extends Mob>
TconvertTo(EntityType<T> pEntityType, boolean pTransferInventory) protected BodyRotationControlprivate LootParamscreateEquipmentParams(ServerLevel pLevel) static AttributeSupplier.Builderprotected PathNavigationcreateNavigation(Level pLevel) protected voidprotected voiddefineSynchedData(SynchedEntityData.Builder pBuilder) booleandoHurtTarget(Entity pEntity) protected voiddropCustomDeathLoot(ServerLevel pLevel, DamageSource pDamageSource, boolean pRecentlyHit) protected voiddropFromLootTable(DamageSource pDamageSource, boolean pAttackedRecently) voiddropLeash(boolean pBroadcastPacket, boolean pDropLeash) Removes the leash from this entityvoiddropPreservedEquipment(Predicate<ItemStack> pPredicate) protected voidenchantSpawnedArmor(ServerLevelAccessor pLevel, RandomSource pRandom, EquipmentSlot pSlot, DifficultyInstance pDifficulty) private voidenchantSpawnedEquipment(ServerLevelAccessor pLevel, EquipmentSlot pSlot, RandomSource pRandom, float pEnchantChance, DifficultyInstance pDifficulty) protected voidenchantSpawnedWeapon(ServerLevelAccessor pLevel, RandomSource pRandom, DifficultyInstance pDifficulty) voidequip(ResourceKey<LootTable> pEquipmentLootTable, Map<EquipmentSlot, Float> pSlotDropChances) voidequip(EquipmentTable pEquipmentTable) equipItemIfPossible(ItemStack pStack) finalizeSpawn(ServerLevelAccessor pLevel, DifficultyInstance pDifficulty, MobSpawnType pSpawnType, SpawnGroupData pSpawnGroupData) Deprecated.Override-Only.protected SoundEventintprivate doublegetApproximateAttackDamageWithItem(ItemStack pItemStack) protected AABBprotected intprotected ResourceKey<LootTable> protected floatstatic ItemgetEquipmentForSlot(EquipmentSlot pSlot, int pChance) intgetItemBySlot(EquipmentSlot pSlot) final ResourceKey<LootTable> longintintintintfloatgetPathfindingMalus(PathType pPathType) protected Vec3ifloatfinal MobSpawnTypeReturns the type of spawn that created this mob, if applicable.protected final LivingEntityvoidhandleEntityEvent(byte pId) Handler forinvalid reference
World#setEntityStateprivate static booleanhasAnyComponentExceptDamage(ItemStack pStack) booleanfinal InteractionResultinteract(Player pPlayer, InteractionHand pHand) booleanbooleanisBodyArmorItem(ItemStack pStack) booleanbooleanbooleanisMaxGroupSizeReached(int pSize) booleanisNoAi()booleanfinal booleanThis method exists so that spawns can be cancelled from thewithout needing to hook up an additional handler for theinvalid reference
FinalizeSpawnEventEntityJoinLevelEvent.protected booleanbooleanbooleanisWithinMeleeAttackRange(LivingEntity pEntity) booleanbooleanisWithinRestriction(BlockPos pPos) voidjumpInFluid(FluidType type) Performs what to do when an entity attempts to go up or "jump" in a fluid.protected voidjumpInLiquid(TagKey<Fluid> pFluidTag) Deprecated.private voidjumpInLiquidInternal(Runnable onSuper) voidvoidChanges the X and Y rotation so that this entity is facing the given entity.protected InteractionResultmobInteract(Player pPlayer, InteractionHand pHand) protected voidonOffspringSpawnedFromEgg(Player pPlayer, Mob pChild) voidvoidprotected voidpickUpItem(ItemEntity pItemEntity) Tests if this entity should pick up a weapon or an armor piece.voidprotected voidprotected voidplayHurtSound(DamageSource pSource) protected voidpopulateDefaultEquipmentEnchantments(ServerLevelAccessor pLevel, RandomSource pRandom, DifficultyInstance pDifficulty) protected voidpopulateDefaultEquipmentSlots(RandomSource pRandom, DifficultyInstance pDifficulty) voidreadAdditionalSaveData(CompoundTag pCompound) (abstract) Protected helper method to read subclass entity data from NBT.protected voidprotected voidvoidremoveAllGoals(Predicate<Goal> pFilter) voidbooleanremoveWhenFarAway(double pDistanceToClosestPlayer) booleanprivate voidvoidrestrictTo(BlockPos pPos, int pDistance) private floatrotlerp(float pAngle, float pTargetAngle, float pMaxIncrease) Arguments: current rotation, intended rotation, max increment.protected voidprotected final voidvoidsetAggressive(boolean pAggressive) voidsetBaby(boolean pBaby) Set whether this mob is a child.voidsetBodyArmorItem(ItemStack pStack) voidsetCanPickUpLoot(boolean pCanPickUpLoot) voidsetDropChance(EquipmentSlot pSlot, float pChance) voidsetGuaranteedDrop(EquipmentSlot pSlot) voidsetItemSlot(EquipmentSlot pSlot, ItemStack pStack) protected voidsetItemSlotAndDropWhenKilled(EquipmentSlot pSlot, ItemStack pStack) voidsetLeashData(Leashable.LeashData pLeashData) voidsetLeftHanded(boolean pLeftHanded) voidsetNoAi(boolean pNoAi) Set whether this Entity's AI is disabledvoidsetPathfindingMalus(PathType pPathType, float pMalus) voidfinal voidsetSpawnCancelled(boolean cancel) Marks this mob as being disallowed to spawn duringLevelWriter.addFreshEntity(Entity).voidsetSpeed(float pSpeed) Sets the movespeed used for the new AI system.voidsetTarget(LivingEntity pTarget) Sets the active target the Goal system uses for trackingvoidsetXxa(float pAmount) voidsetYya(float pAmount) voidsetZza(float pAmount) protected booleanprotected booleanvoidbooleanstartRiding(Entity pEntity, boolean pForce) voidvoidtick()protected floattickHeadTurn(float pYRot, float pAnimStep) protected voidbooleanwantsToPickUp(ItemStack pStack) Methods inherited from class net.minecraft.world.entity.LivingEntity
activeLocationDependentEnchantments, actuallyHurt, addEffect, addEffect, animateHurt, areAllEffectsAmbient, attackable, blockedByShield, blockUsingShield, brainProvider, calculateEntityAnimation, calculateFallDamage, canAttack, canAttack, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canDisableShield, canFreeze, canStandOnFluid, canUsePortal, causeFallDamage, checkAutoSpinAttack, checkFallDamage, clearSleepingPos, completeUsingItem, createLivingAttributes, createWitherRose, decreaseAirSupply, die, doAutoAttackOnTouch, doesEmitEquipEvent, doHurtEquipment, doPush, dropAllDeathLoot, dropEquipment, dropExperience, eat, eat, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getAgeScale, getAllSlots, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, getAttribute, getAttributeBaseValue, getAttributes, getAttributeValue, getBedOrientation, getBlockSpeedFactor, getBoundingBoxForCulling, getBrain, getCombatTracker, getComfortableFallDistance, getCurrentSwingDuration, getDamageAfterArmorAbsorb, getDamageAfterMagicAbsorb, getDeathSound, getDefaultDimensions, getDefaultGravity, getDimensions, getDismountPoses, getDrinkingSound, getEatingSound, getEffect, getEquipmentSlotForItem, getExperienceReward, getFallFlyingTicks, getFallSounds, getFluidFallingAdjustedMovement, getFlyingSpeed, getHealth, getHitbox, getHurtDir, getHurtSound, getItemInHand, getJumpBoostPower, getJumpPower, getJumpPower, getKillCredit, getKnockback, getLastAttacker, getLastClimbablePos, getLastDamageSource, getLastHurtByMob, getLastHurtByMobTimestamp, getLastHurtMob, getLastHurtMobTimestamp, getLocalBoundsForPose, getMainHandItem, getMaxAbsorption, getMaxHeadRotationRelativeToBody, getMaxHealth, getNoActionTime, getOffhandItem, getPassengerRidingPosition, getPreciseBodyRotation, getProjectile, getRelativePortalPosition, getRiddenInput, getRiddenSpeed, getScale, getSleepingPos, getSlot, getSlotForHand, getSoundVolume, getSpeed, getStingerCount, getSwimAmount, getTicksUsingItem, getUsedItemHand, getUseItem, getUseItemRemainingTicks, getViewYRot, getVisibilityPercent, getVisualRotationYInDegrees, getVoicePitch, getWaterSlowDown, getWeaponItem, getYHeadRot, goDownInWater, handleDamageEvent, handleRelativeFrictionAndCalculateMovement, hasEffect, hasInfiniteMaterials, hasItemInSlot, hasLandedInLiquid, hasLineOfSight, heal, hurt, hurtArmor, hurtCurrentlyUsedShield, hurtHelmet, igniteForTicks, increaseAirSupply, indicateDamage, internalSetAbsorptionAmount, isAffectedByFluids, isAffectedByPotions, isAlive, isAlwaysExperienceDropper, isAutoSpinAttack, isBaby, isBlocking, isCurrentlyGlowing, isDamageSourceBlocked, isDeadOrDying, isFallFlying, isHolding, isHolding, isImmobile, isInvertedHealAndHarm, isInvulnerableTo, isInWall, isPickable, isPushable, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadRotationStep, lerpHeadTo, lerpTargetX, lerpTargetXRot, lerpTargetY, lerpTargetYRot, lerpTargetZ, lerpTo, lookAt, makeBrain, makeSound, maxUpStep, onBelowWorld, onChangedBlock, onClimbable, onEffectAdded, onEffectRemoved, onEffectUpdated, onEnterCombat, onEquipItem, onEquippedItemBroken, onItemPickup, onLeaveCombat, onSyncedDataUpdated, playBlockFallSound, push, pushEntities, randomTeleport, recreateFromPacket, releaseUsingItem, remove, removeAllEffects, removeEffect, removeEffectNoUpdate, removeEffectParticles, removeEffectsCuredBy, removeFrost, resetForwardDirectionOfRelativePortalPosition, rideTick, sanitizeScale, sendEffectToPassengers, setAbsorptionAmount, setArrowCount, setDiscardFriction, setHealth, setItemInHand, setJumping, setLastHurtByMob, setLastHurtByPlayer, setLastHurtMob, setLivingEntityFlag, setNoActionTime, setRecordPlayingNearby, setSleepingPos, setSprinting, setStingerCount, setYBodyRot, setYHeadRot, shouldDiscardFriction, shouldDropExperience, shouldDropLoot, shouldRiderFaceForward, shouldShowName, skipDropExperience, startSleeping, startUsingItem, stopRiding, stopSleeping, stopUsingItem, swing, swing, take, tickDeath, tickEffects, tickRidden, travel, triggerItemUseEffects, triggerOnDeathMobEffects, tryAddFrost, updateEffectVisibility, updateInvisibilityStatus, updateSwingTime, updateUsingItem, updateWalkAnimation, verifyEquippedItem, wasExperienceConsumed, wouldNotSuffocateAtTargetPoseMethods inherited from class net.minecraft.world.entity.Entity
absMoveTo, absMoveTo, absRotateTo, acceptsFailure, acceptsSuccess, addDeltaMovement, addPassenger, addTag, adjustSpawnLocation, applyGravity, awardKillScore, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canChangeDimensions, canCollideWith, canControlVehicle, canRide, canSpawnSprintParticle, canSprint, canTrample, captureDrops, captureDrops, changeDimension, checkBelowWorld, checkInsideBlocks, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, collideBoundingBox, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStack, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, fudgePositionAfterSizeChange, gameEvent, gameEvent, getAddEntityPacket, getAirSupply, getAttachments, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getCapability, getCapability, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControlledVehicle, getCustomName, getDefaultPassengerAttachmentPoint, getDeltaMovement, getDimensionChangingDelay, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getEyeHeight, getEyeHeight, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getGravity, getHandHoldingItemAngle, getId, getInBlockState, getIndirectPassengers, getKnownMovement, getLeashOffset, getLeashOffset, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxHeightFluidType, getMotionDirection, getMovementEmission, getName, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, getPassengers, getPassengersAndSelf, getPercentFrozen, getPermissionLevel, getPersistentData, getPickRadius, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPrimaryStepSoundBlockPos, getRandom, getRandomX, getRandomY, getRandomZ, getRemainingFireTicks, getRemovalReason, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getServer, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getTypeName, getUpVector, getUUID, getVehicle, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getX, getX, getXRot, getY, getY, getYRot, getZ, getZ, handlePortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPermissions, hasPose, igniteForSeconds, ignoreExplosion, interactAt, is, isAddedToLevel, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInLiquid, isInvisible, isInvisibleTo, isInvulnerable, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, killedEntity, lavaHurt, lerpMotion, lerpPositionAndRotationStep, level, limitPistonMovement, load, makeBoundingBox, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mayInteract, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onAddedToLevel, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, processFlappingMovement, processPortalCooldown, push, push, reapplyPosition, refreshDimensions, registryAccess, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, rotate, save, saveAsPassenger, saveWithoutId, sendSystemMessage, setAirSupply, setAsInsidePortal, setBoundingBox, setCustomName, setCustomNameVisible, setData, setDeltaMovement, setDeltaMovement, setFluidTypeHeight, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setLevel, setLevelCallback, setNoGravity, setOldPosAndRot, setOnGround, setOnGroundWithMovement, setPortalCooldown, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYRot, shouldBeSaved, shouldBlockExplode, shouldInformAdmins, shouldRender, shouldRenderAtSqrDistance, showVehicleHealth, skipAttackInteraction, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startSeenByPlayer, stopSeenByPlayer, syncData, syncPacketPositionCodec, teleportRelative, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, tryCheckInsideBlocks, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateInWaterStateAndDoWaterCurrentPushing, updateSwimming, waterSwimSoundMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.commands.CommandSource
alwaysAcceptsMethods inherited from interface net.minecraft.world.entity.EquipmentUser
equip, equip, equip, resolveSlotMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canTrample, captureDrops, captureDrops, copyAttachmentsFrom, deserializeNBT, getClassification, getEyeInFluidType, getFluidFallDistanceModifier, getFluidMotionScale, getFluidTypeHeight, getMaxHeightFluidType, getParts, getPersistentData, getPickedResult, getSoundFromFluidType, hasCustomOutlineRendering, isAddedToLevel, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, onAddedToLevel, onRemovedFromLevel, revive, sendPairingData, serializeNBT, shouldRiderSitMethods inherited from interface net.neoforged.neoforge.common.extensions.ILivingEntityExtension
canDrownInFluidType, canSwimInFluidType, moveInFluid, onDamageTaken, self, sinkInFluidMethods inherited from interface net.minecraft.world.entity.Leashable
canHaveALeashAttachedToIt, closeRangeLeashBehaviour, elasticRangeLeashBehaviour, getLeashHolder, handleLeashAtDistance, isLeashed, mayBeLeashed, readLeashData, setDelayedLeashHolderId, setLeashedTo, writeLeashDataMethods inherited from interface net.minecraft.world.scores.ScoreHolder
getFeedbackDisplayName
-
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
-
MAX_WEARING_ARMOR_CHANCE
public static final float MAX_WEARING_ARMOR_CHANCE- 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:
-
DEFAULT_EQUIPMENT_DROP_CHANCE
public static final float DEFAULT_EQUIPMENT_DROP_CHANCE- See Also:
-
PRESERVE_ITEM_DROP_CHANCE_THRESHOLD
public static final float PRESERVE_ITEM_DROP_CHANCE_THRESHOLD- See Also:
-
PRESERVE_ITEM_DROP_CHANCE
public static final int PRESERVE_ITEM_DROP_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 -
RANDOM_SPAWN_BONUS_ID
-
ambientSoundTime
public int ambientSoundTime -
xpReward
protected int xpReward -
lookControl
-
moveControl
-
jumpControl
-
bodyRotationControl
-
goalSelector
-
targetSelector
-
target
-
sensing
-
handItems
-
handDropChances
protected final float[] handDropChances -
armorItems
-
armorDropChances
protected final float[] armorDropChances -
bodyArmorItem
-
bodyArmorDropChance
protected float bodyArmorDropChance -
canPickUpLoot
private boolean canPickUpLoot -
persistenceRequired
private boolean persistenceRequired -
pathfindingMalus
-
lootTable
-
lootTableSeed
private long lootTableSeed -
leashData
-
restrictCenter
-
restrictRadius
private float restrictRadius -
spawnType
-
spawnCancelled
private boolean spawnCancelled
-
-
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
-
getTargetFromBrain
-
setTarget
Sets the active target the Goal system uses for tracking -
canAttackType
- Overrides:
canAttackTypein classLivingEntity
-
canFireProjectileWeapon
-
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
protected int getBaseExperienceReward()- Overrides:
getBaseExperienceRewardin classLivingEntity
-
spawnAnim
public void spawnAnim() -
handleEntityEvent
public void handleEntityEvent(byte pId) Handler forinvalid reference
World#setEntityState- Overrides:
handleEntityEventin classLivingEntity
-
tick
public void tick()- Overrides:
tickin classLivingEntity
-
updateControlFlags
protected void updateControlFlags() -
tickHeadTurn
protected float tickHeadTurn(float pYRot, float pAnimStep) - Overrides:
tickHeadTurnin classLivingEntity
-
getAmbientSound
-
addAdditionalSaveData
- Overrides:
addAdditionalSaveDatain classLivingEntity
-
readAdditionalSaveData
(abstract) Protected helper method to read subclass entity data from NBT.- Overrides:
readAdditionalSaveDatain classLivingEntity
-
dropFromLootTable
- Overrides:
dropFromLootTablein classLivingEntity
-
getLootTable
- Overrides:
getLootTablein classLivingEntity
-
getDefaultLootTable
-
getLootTableSeed
public long getLootTableSeed()- Overrides:
getLootTableSeedin classLivingEntity
-
setZza
public void setZza(float pAmount) -
setYya
public void setYya(float pAmount) -
setXxa
public void setXxa(float pAmount) -
setSpeed
public void setSpeed(float pSpeed) Sets the movespeed used for the new AI system.- Overrides:
setSpeedin classLivingEntity
-
stopInPlace
public void stopInPlace() -
aiStep
public void aiStep()- Overrides:
aiStepin classLivingEntity
-
getPickupReach
-
pickUpItem
Tests if this entity should pick up a weapon or an armor piece. Entity drops current weapon or armor if the new one is better. -
equipItemIfPossible
-
setItemSlotAndDropWhenKilled
-
setGuaranteedDrop
-
canReplaceCurrentItem
-
getApproximateAttackDamageWithItem
-
canReplaceEqualItem
-
hasAnyComponentExceptDamage
-
canHoldItem
-
wantsToPickUp
-
removeWhenFarAway
public boolean removeWhenFarAway(double pDistanceToClosestPlayer) -
requiresCustomPersistence
public boolean requiresCustomPersistence() -
shouldDespawnInPeaceful
protected boolean shouldDespawnInPeaceful() -
checkDespawn
public void checkDespawn()- Overrides:
checkDespawnin classEntity
-
serverAiStep
protected final void serverAiStep()- Overrides:
serverAiStepin classLivingEntity
-
sendDebugPackets
protected void sendDebugPackets() -
customServerAiStep
protected void 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 pAngle, float pTargetAngle, float pMaxIncrease) Arguments: current rotation, intended rotation, max increment. -
checkMobSpawnRules
public static boolean checkMobSpawnRules(EntityType<? extends Mob> pType, LevelAccessor pLevel, MobSpawnType pSpawnType, BlockPos pPos, RandomSource pRandom) -
checkSpawnRules
-
checkSpawnObstruction
-
getMaxSpawnClusterSize
public int getMaxSpawnClusterSize() -
isMaxGroupSizeReached
public boolean isMaxGroupSizeReached(int pSize) -
getMaxFallDistance
public int getMaxFallDistance()- Overrides:
getMaxFallDistancein classLivingEntity
-
getHandSlots
- Overrides:
getHandSlotsin classLivingEntity
-
getArmorSlots
- Specified by:
getArmorSlotsin classLivingEntity
-
getBodyArmorItem
-
canUseSlot
- Overrides:
canUseSlotin classLivingEntity
-
isWearingBodyArmor
public boolean isWearingBodyArmor() -
isBodyArmorItem
-
setBodyArmorItem
-
getArmorAndBodyArmorSlots
- Overrides:
getArmorAndBodyArmorSlotsin classLivingEntity
-
getItemBySlot
- Specified by:
getItemBySlotin interfaceEquipmentUser- Specified by:
getItemBySlotin classLivingEntity
-
setItemSlot
- Specified by:
setItemSlotin interfaceEquipmentUser- Specified by:
setItemSlotin classLivingEntity
-
dropCustomDeathLoot
protected void dropCustomDeathLoot(ServerLevel pLevel, DamageSource pDamageSource, boolean pRecentlyHit) - Overrides:
dropCustomDeathLootin classLivingEntity
-
getEquipmentDropChance
-
dropPreservedEquipment
public void dropPreservedEquipment() -
dropPreservedEquipment
-
createEquipmentParams
-
equip
-
equip
public void equip(ResourceKey<LootTable> pEquipmentLootTable, Map<EquipmentSlot, Float> pSlotDropChances) -
populateDefaultEquipmentSlots
-
getEquipmentForSlot
-
populateDefaultEquipmentEnchantments
protected void populateDefaultEquipmentEnchantments(ServerLevelAccessor pLevel, RandomSource pRandom, DifficultyInstance pDifficulty) -
enchantSpawnedWeapon
protected void enchantSpawnedWeapon(ServerLevelAccessor pLevel, RandomSource pRandom, DifficultyInstance pDifficulty) -
enchantSpawnedArmor
protected void enchantSpawnedArmor(ServerLevelAccessor pLevel, RandomSource pRandom, EquipmentSlot pSlot, DifficultyInstance pDifficulty) -
enchantSpawnedEquipment
private void enchantSpawnedEquipment(ServerLevelAccessor pLevel, EquipmentSlot pSlot, RandomSource pRandom, float pEnchantChance, DifficultyInstance pDifficulty) -
finalizeSpawn
@Deprecated @OverrideOnly @Nullable public SpawnGroupData finalizeSpawn(ServerLevelAccessor pLevel, DifficultyInstance pDifficulty, MobSpawnType pSpawnType, @Nullable SpawnGroupData pSpawnGroupData) Deprecated. -
setPersistenceRequired
public void setPersistenceRequired() -
setDropChance
- Specified by:
setDropChancein interfaceEquipmentUser
-
canPickUpLoot
public boolean canPickUpLoot() -
setCanPickUpLoot
public void setCanPickUpLoot(boolean pCanPickUpLoot) -
canTakeItem
- Overrides:
canTakeItemin classLivingEntity
-
isPersistenceRequired
public boolean isPersistenceRequired() -
interact
-
checkAndHandleImportantInteractions
private InteractionResult checkAndHandleImportantInteractions(Player pPlayer, InteractionHand pHand) -
onOffspringSpawnedFromEgg
-
mobInteract
-
isWithinRestriction
public boolean isWithinRestriction() -
isWithinRestriction
-
restrictTo
-
getRestrictCenter
-
getRestrictRadius
public float getRestrictRadius() -
clearRestriction
public void clearRestriction() -
hasRestriction
public boolean hasRestriction() -
convertTo
-
getLeashData
- Specified by:
getLeashDatain interfaceLeashable
-
setLeashData
- Specified by:
setLeashDatain interfaceLeashable
-
dropLeash
public void dropLeash(boolean pBroadcastPacket, boolean pDropLeash) Removes the leash from this entity -
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 pNoAi) Set whether this Entity's AI is disabled -
setLeftHanded
public void setLeftHanded(boolean pLeftHanded) -
setAggressive
public void setAggressive(boolean pAggressive) -
isNoAi
public boolean isNoAi() -
isLeftHanded
public boolean isLeftHanded() -
isAggressive
public boolean isAggressive() -
setBaby
public void setBaby(boolean pBaby) Set whether this mob is a child. -
getMainArm
- Specified by:
getMainArmin classLivingEntity
-
isWithinMeleeAttackRange
-
getAttackBoundingBox
-
doHurtTarget
- Overrides:
doHurtTargetin classLivingEntity
-
playAttackSound
protected void playAttackSound() -
isSunBurnTick
protected boolean isSunBurnTick() -
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
-
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(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.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 thewithout needing to hook up an additional handler for theinvalid reference
FinalizeSpawnEventEntityJoinLevelEvent.- 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.
-