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:
DataComponentGetter
,SyncedDataHolder
,Attackable
,EquipmentUser
,Leashable
,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 net.minecraft.world.entity.LivingEntity
LivingEntity.Fallsounds
Nested classes/interfaces inherited from class net.minecraft.world.entity.Entity
Entity.EntityPathElement, Entity.MoveFunction, Entity.Movement, Entity.MovementEmission, Entity.RemovalReason
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
Nested classes/interfaces inherited from interface net.minecraft.world.entity.Leashable
Leashable.LeashData, Leashable.Wrench
Nested classes/interfaces inherited from interface net.minecraft.world.waypoints.Waypoint
Waypoint.Icon
Nested classes/interfaces inherited from interface net.minecraft.world.waypoints.WaypointTransmitter
WaypointTransmitter.BlockConnection, WaypointTransmitter.ChunkConnection, WaypointTransmitter.Connection, WaypointTransmitter.EntityAzimuthConnection, WaypointTransmitter.EntityBlockConnection, WaypointTransmitter.EntityChunkConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
private final BodyRotationControl
private boolean
private static final EntityDataAccessor
<Byte> private static final double
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private DropChances
private static final List
<EquipmentSlot> final GoalSelector
private BlockPos
private int
private static final Vec3i
protected JumpControl
private Leashable.LeashData
protected LookControl
private Optional
<ResourceKey<LootTable>> private long
static final float
static final float
static final float
static final float
private static final int
private static final int
private static final int
protected MoveControl
protected PathNavigation
private boolean
protected static final int
protected boolean
Neo: Prevent immediate spawning from conversions to capture conversion results for eventsprotected static final ResourceLocation
private final Sensing
private boolean
private EntitySpawnReason
static final String
static final String
static final String
static final String
private LivingEntity
final GoalSelector
static final int
protected int
Fields inherited from class net.minecraft.world.entity.LivingEntity
ARMOR_SLOT_OFFSET, attackAnim, attackStrengthTicker, autoSpinAttackDmg, autoSpinAttackItemStack, autoSpinAttackTicks, BASE_JUMP_POWER, BODY_ARMOR_OFFSET, brain, damageContainers, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathTime, DEFAULT_BABY_SCALE, DEFAULT_BASE_GRAVITY, elytraAnimationState, equipment, EQUIPMENT_SLOT_OFFSET, EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT, fallFlyTicks, hurtDuration, hurtTime, INPUT_FRICTION, interpolation, invulnerableDuration, 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, removeArrowTime, removeStingerTime, SADDLE_OFFSET, SLEEPING_DIMENSIONS, SWING_DURATION, 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, zza
Fields inherited from class net.minecraft.world.entity.Entity
BASE_SAFE_FALL_DISTANCE, BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, CONTENTS_SLOT_INDEX, DATA_POSE, DATA_SHARED_FLAGS_ID, DEFAULT_BB_HEIGHT, DEFAULT_BB_WIDTH, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5, DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0, ENTITY_COUNTER, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, MAX_MOVEMENTS_HANDELED_PER_TICK, minorHorizontalCollision, moveDist, noPhysics, portalProcess, random, stringUUID, stuckSpeedMultiplier, TAG_AIR, TAG_DATA, TAG_FALL_DISTANCE, TAG_FIRE, TAG_GLOWING, TAG_ID, TAG_INVULNERABLE, TAG_MOTION, TAG_NO_GRAVITY, TAG_ON_GROUND, TAG_PASSENGERS, TAG_PORTAL_COOLDOWN, TAG_POS, TAG_ROTATION, TAG_SILENT, TAG_UUID, tickCount, TOTAL_AIR_SUPPLY, uuid, verticalCollision, verticalCollisionBelow, wasEyeInWater, wasInPowderSnow, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOld
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
Fields inherited from interface net.minecraft.world.entity.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_ELASTICITY
Fields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME
Fields inherited from interface net.minecraft.world.waypoints.Waypoint
MAX_RANGE, WAYPOINT_TRANSMIT_RANGE_HIDE_MODIFIER
Fields inherited from interface net.minecraft.world.waypoints.WaypointTransmitter
REALLY_FAR_DISTANCE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalSaveData
(ValueOutput pOutput) void
aiStep()
void
ate()
void
baseTick()
boolean
canAttackType
(EntityType<?> pType) boolean
protected boolean
boolean
canFireProjectileWeapon
(ProjectileWeaponItem pProjectileWeapon) boolean
canHoldItem
(ItemStack pStack) boolean
protected boolean
canReplaceCurrentItem
(ItemStack pNewItem, ItemStack pCurrentItem, EquipmentSlot pSlot) boolean
canReplaceEqualItem
(ItemStack pCandidate, ItemStack pExisting) protected boolean
canShearEquipment
(Player pPlayer) private InteractionResult
checkAndHandleImportantInteractions
(Player pPlayer, InteractionHand pHand) void
static boolean
checkMobSpawnRules
(EntityType<? extends Mob> pEntityType, LevelAccessor pLevel, EntitySpawnReason pSpawnReason, BlockPos pPos, RandomSource pRandom) boolean
checkSpawnObstruction
(LevelReader pLevel) boolean
checkSpawnRules
(LevelAccessor pLevel, EntitySpawnReason pSpawnReason) protected void
void
private boolean
compareArmor
(ItemStack pNewItem, ItemStack pCurrentItem, EquipmentSlot pSlot) private boolean
compareWeapons
(ItemStack pNewItem, ItemStack pCurrentItem, EquipmentSlot pSlot) <T extends Mob>
TconvertTo
(EntityType<T> pEntityType, ConversionParams pConversionParams, ConversionParams.AfterConversion<T> pAfterConversion) <T extends Mob>
TconvertTo
(EntityType<T> pEntityType, ConversionParams pConversionParams, EntitySpawnReason pSpawnReason, ConversionParams.AfterConversion<T> pAfterConversion) protected BodyRotationControl
private LootParams
createEquipmentParams
(ServerLevel pLevel) static AttributeSupplier.Builder
protected PathNavigation
createNavigation
(Level pLevel) protected void
customServerAiStep
(ServerLevel pLevel) protected void
defineSynchedData
(SynchedEntityData.Builder pBuilder) boolean
doHurtTarget
(ServerLevel pLevel, Entity pSource) protected void
dropCustomDeathLoot
(ServerLevel pLevel, DamageSource pDamageSource, boolean pRecentlyHit) protected void
dropFromLootTable
(ServerLevel pLevel, DamageSource pDamageSource, boolean pPlayerKill) void
dropPreservedEquipment
(ServerLevel pLevel) dropPreservedEquipment
(ServerLevel pLevel, Predicate<ItemStack> pFilter) protected void
enchantSpawnedArmor
(ServerLevelAccessor pLevel, RandomSource pRandom, EquipmentSlot pSlot, DifficultyInstance pDifficulty) private void
enchantSpawnedEquipment
(ServerLevelAccessor pLevel, EquipmentSlot pSlot, RandomSource pRandom, float pEnchantChance, DifficultyInstance pDifficulty) protected void
enchantSpawnedWeapon
(ServerLevelAccessor pLevel, RandomSource pRandom, DifficultyInstance pDifficulty) void
equip
(ResourceKey<LootTable> pEquipmentLootTable, Map<EquipmentSlot, Float> pSlotDropChances) void
equip
(EquipmentTable pEquipmentTable) equipItemIfPossible
(ServerLevel pLevel, ItemStack pStack) finalizeSpawn
(ServerLevelAccessor pLevel, DifficultyInstance pDifficulty, EntitySpawnReason pSpawnReason, SpawnGroupData pSpawnGroupData) Deprecated.Override-Only.protected SoundEvent
int
private double
getApproximateAttributeWith
(ItemStack pItem, Holder<Attribute> pAttribute, EquipmentSlot pSlot) protected AABB
protected int
getBaseExperienceReward
(ServerLevel pLevel) static Item
getEquipmentForSlot
(EquipmentSlot pSlot, int pChance) int
int
final Optional
<ResourceKey<LootTable>> long
int
int
int
int
float
getPathfindingMalus
(PathType pPathType) protected Vec3i
final EntitySpawnReason
Returns the type of spawn that created this mob, if applicable.protected final LivingEntity
void
handleEntityEvent
(byte pId) Handler forinvalid reference
World#setEntityState
boolean
hasHome()
private boolean
final InteractionResult
interact
(Player pPlayer, InteractionHand pHand) boolean
boolean
boolean
boolean
isMaxGroupSizeReached
(int pSize) boolean
isNoAi()
boolean
boolean
final boolean
This method exists so that spawns can be cancelled from theFinalizeSpawnEvent
without needing to hook up an additional handler for theEntityJoinLevelEvent
.protected boolean
boolean
boolean
boolean
isWithinHome
(BlockPos pPos) boolean
isWithinHome
(Vec3 pPos) boolean
isWithinMeleeAttackRange
(LivingEntity pEntity) void
jumpInFluid
(FluidType type) Performs what to do when an entity attempts to go up or "jump" in a fluid.protected void
jumpInLiquid
(TagKey<Fluid> pFluidTag) Deprecated.private void
jumpInLiquidInternal
(Runnable onSuper) void
void
Changes the X and Y rotation so that this entity is facing the given entity.protected InteractionResult
mobInteract
(Player pPlayer, InteractionHand pHand) protected void
onAttributeUpdated
(Holder<Attribute> pAttribute) void
protected void
onOffspringSpawnedFromEgg
(Player pPlayer, Mob pChild) void
void
protected void
pickUpItem
(ServerLevel pLevel, ItemEntity pEntity) void
protected void
protected void
playHurtSound
(DamageSource pSource) protected void
populateDefaultEquipmentEnchantments
(ServerLevelAccessor pLevel, RandomSource pRandom, DifficultyInstance pDifficulty) protected void
populateDefaultEquipmentSlots
(RandomSource pRandom, DifficultyInstance pDifficulty) protected void
readAdditionalSaveData
(ValueInput pInput) protected void
protected void
void
removeAllGoals
(Predicate<Goal> pFilter) void
boolean
removeWhenFarAway
(double pDistanceToClosestPlayer) boolean
private void
private void
private float
rotlerp
(float pAngle, float pTargetAngle, float pMaxIncrease) Arguments: current rotation, intended rotation, max increment.protected void
protected final void
void
setAggressive
(boolean pAggressive) void
setBaby
(boolean pBaby) Set whether this mob is a child.void
setBodyArmorItem
(ItemStack pStack) void
setCanPickUpLoot
(boolean pCanPickUpLoot) void
setDropChance
(EquipmentSlot pSlot, float pChance) void
setGuaranteedDrop
(EquipmentSlot pSlot) void
protected void
setItemSlotAndDropWhenKilled
(EquipmentSlot pSlot, ItemStack pStack) void
setLeashData
(Leashable.LeashData pLeashData) void
setLeftHanded
(boolean pLeftHanded) void
setNoAi
(boolean pNoAi) Set whether this Entity's AI is disabledvoid
setPathfindingMalus
(PathType pPathType, float pMalus) void
final void
setSpawnCancelled
(boolean cancel) Marks this mob as being disallowed to spawn duringLevelWriter.addFreshEntity(Entity)
.void
setSpeed
(float pSpeed) Sets the movespeed used for the new AI system.void
setTarget
(LivingEntity pTarget) Sets the active target the Goal system uses for trackingvoid
setXxa
(float pAmount) void
setYya
(float pAmount) void
setZza
(float pAmount) protected boolean
protected boolean
void
boolean
startRiding
(Entity pEntity, boolean pForce) void
void
tick()
protected void
tickHeadTurn
(float pYBodyRot) protected void
boolean
wantsToPickUp
(ServerLevel pLevel, ItemStack pStack) Methods inherited from class net.minecraft.world.entity.LivingEntity
activeLocationDependentEnchantments, actuallyHurt, addEffect, addEffect, animateHurt, applyInput, applyItemBlocking, areAllEffectsAmbient, attackable, blockedByItem, blockUsingItem, brainProvider, calculateEntityAnimation, calculateFallDamage, canAttack, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canEquipWithDispenser, canFreeze, canGlide, canGlideUsing, canStandOnFluid, canUsePortal, canUseSlot, causeFallDamage, checkAutoSpinAttack, checkFallDamage, clearSleepingPos, completeUsingItem, createEquipment, createLivingAttributes, createWitherRose, decreaseAirSupply, die, doAutoAttackOnTouch, doesEmitEquipEvent, doHurtEquipment, doPush, drop, dropAllDeathLoot, dropEquipment, dropExperience, dropFromGiftLootTable, dropFromLootTable, dropFromShearingLootTable, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getAgeScale, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, 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, getLocalBoundsForPose, getLuck, getMainHandItem, getMaxAbsorption, getMaxHeadRotationRelativeToBody, getMaxHealth, getNoActionTime, getOffhandItem, getPassengerRidingPosition, getPreciseBodyRotation, getProjectile, getRelativePortalPosition, getRiddenInput, getRiddenSpeed, getScale, getSecondsToDisableBlocking, getSleepingPos, getSlot, getSlotForHand, getSoundVolume, getSpeed, getStingerCount, getSwimAmount, 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, isImmobile, isInvertedHealAndHarm, isInvulnerableTo, isInWall, isJumping, isLookingAtMe, isPickable, isPushable, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isTransmittingWaypoint, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadRotationStep, lerpHeadTo, lookAt, makeBrain, makePoofParticles, makeSound, makeWaypointConnectionWith, maxUpStep, onBelowWorld, onChangedBlock, onClimbable, onEffectAdded, onEffectsRemoved, onEffectUpdated, onEnterCombat, onEquipItem, onEquippedItemBroken, onItemPickup, onLeaveCombat, onRemoval, onSyncedDataUpdated, playBlockFallSound, push, pushEntities, randomTeleport, recreateFromPacket, releaseUsingItem, remove, removeAllEffects, removeEffect, removeEffectNoUpdate, removeEffectParticles, removeFrost, resetForwardDirectionOfRelativePortalPosition, resolveMobResponsibleForDamage, resolvePlayerResponsibleForDamage, rideTick, sanitizeScale, sendEffectToPassengers, setAbsorptionAmount, setArrowCount, setDiscardFriction, setHealth, setItemInHand, setItemSlot, setJumping, setLastHurtByMob, setLastHurtByPlayer, setLastHurtByPlayer, setLastHurtMob, setLivingEntityFlag, setNoActionTime, setRecordPlayingNearby, setSleepingPos, setSprinting, setStingerCount, setYBodyRot, setYHeadRot, shouldDiscardFriction, shouldDropExperience, shouldDropLoot, shouldShowName, skipDropExperience, spawnItemParticles, startSleeping, startUsingItem, stopFallFlying, stopRiding, stopSleeping, stopUsingItem, swing, swing, take, tickDeath, tickEffects, tickRidden, travel, travelFlying, travelFlying, triggerOnDeathMobEffects, tryAddFrost, updateEffectVisibility, updateFallFlying, updateInvisibilityStatus, updateSwingTime, updateUsingItem, updateWalkAnimation, wasExperienceConsumed, waypointIcon, wouldNotSuffocateAtTargetPose
Methods inherited from class net.minecraft.world.entity.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, canRide, canSimulateMovement, canSpawnSprintParticle, canSprint, canTeleport, canTrample, captureDrops, captureDrops, castComponentValue, checkBelowWorld, checkFallDistanceAccumulation, checkSupportingBlock, chunkPosition, clearFire, clearFreeze, clearMovementThisTick, closerThan, closerThan, collideBoundingBox, collidedWithFluid, collidedWithShapeMovingFrom, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, dropAllLeashConnections, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, get, getAddEntityPacket, getAirSupply, getAttachments, 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, getId, getInBlockState, getIndirectPassengers, getInputVector, getKnownMovement, 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, getServer, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, 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, hasPassenger, hasPassenger, hasPose, hurt, hurtClient, hurtOrSimulate, igniteForSeconds, ignoreExplosion, interactAt, 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, 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, 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, spawnAtLocation, spawnSprintParticle, startRiding, startSeenByPlayer, stopSeenByPlayer, supportQuadLeashAsHolder, syncPacketPositionCodec, teleport, teleportRelative, teleportSetPosition, teleportSpectators, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateInWaterStateAndDoWaterCurrentPushing, updateSwimming, waterSwimSound
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachments
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.core.component.DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, has, has
Methods inherited from interface net.minecraft.world.entity.EquipmentUser
equip, equip, equip, getItemBySlot, resolveSlot, setItemSlot
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, 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, shouldRiderSit
Methods inherited from interface net.neoforged.neoforge.common.extensions.ILivingEntityExtension
canDrownInFluidType, canSwimInFluidType, moveInFluid, onDamageTaken, self, sinkInFluid
Methods inherited from interface net.minecraft.world.entity.Leashable
canHaveALeashAttachedTo, checkElasticInteractions, closeRangeLeashBehaviour, dropLeash, getLeashHolder, getLeashOffset, getLeashOffset, getQuadLeashOffsets, isLeashed, leashDistanceTo, leashElasticDistance, leashSnapDistance, mayBeLeashed, onElasticLeashPull, readLeashData, removeLeash, setDelayedLeashHolderId, setLeashedTo, supportQuadLeash, whenLeashedTo, writeLeashData
Methods 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
-
EQUIPMENT_POPULATION_ORDER
-
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:
-
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:
getControllingPassenger
in classEntity
-
getSensing
-
getTarget
-
getTargetFromBrain
-
setTarget
Sets the active target the Goal system uses for tracking -
canAttackType
- Overrides:
canAttackType
in classLivingEntity
-
canFireProjectileWeapon
-
ate
public void ate() -
defineSynchedData
- Overrides:
defineSynchedData
in classLivingEntity
-
getAmbientSoundInterval
public int getAmbientSoundInterval() -
playAmbientSound
public void playAmbientSound() -
baseTick
public void baseTick()- Overrides:
baseTick
in classLivingEntity
-
playHurtSound
- Overrides:
playHurtSound
in classLivingEntity
-
resetAmbientSoundTime
private void resetAmbientSoundTime() -
getBaseExperienceReward
- Overrides:
getBaseExperienceReward
in classLivingEntity
-
spawnAnim
public void spawnAnim() -
handleEntityEvent
public void handleEntityEvent(byte pId) Handler forinvalid reference
World#setEntityState
- Overrides:
handleEntityEvent
in classLivingEntity
-
tick
public void tick()- Overrides:
tick
in classLivingEntity
-
updateControlFlags
protected void updateControlFlags() -
tickHeadTurn
protected void tickHeadTurn(float pYBodyRot) - Overrides:
tickHeadTurn
in classLivingEntity
-
getAmbientSound
-
addAdditionalSaveData
- Overrides:
addAdditionalSaveData
in classLivingEntity
-
readAdditionalSaveData
- Overrides:
readAdditionalSaveData
in classLivingEntity
-
dropFromLootTable
protected void dropFromLootTable(ServerLevel pLevel, DamageSource pDamageSource, boolean pPlayerKill) - Overrides:
dropFromLootTable
in classLivingEntity
-
getLootTable
- Overrides:
getLootTable
in classEntity
-
getLootTableSeed
public long getLootTableSeed()- Overrides:
getLootTableSeed
in 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:
setSpeed
in classLivingEntity
-
stopInPlace
public void stopInPlace() -
aiStep
public void aiStep()- Overrides:
aiStep
in classLivingEntity
-
getPickupReach
-
pickUpItem
-
equipItemIfPossible
-
setItemSlotAndDropWhenKilled
-
canShearEquipment
-
setGuaranteedDrop
-
canReplaceCurrentItem
protected boolean canReplaceCurrentItem(ItemStack pNewItem, ItemStack pCurrentItem, EquipmentSlot pSlot) -
compareArmor
-
compareWeapons
-
getApproximateAttributeWith
private double getApproximateAttributeWith(ItemStack pItem, Holder<Attribute> pAttribute, EquipmentSlot pSlot) -
canReplaceEqualItem
-
canHoldItem
-
wantsToPickUp
-
getPreferredWeaponType
-
removeWhenFarAway
public boolean removeWhenFarAway(double pDistanceToClosestPlayer) -
requiresCustomPersistence
public boolean requiresCustomPersistence() -
shouldDespawnInPeaceful
protected boolean shouldDespawnInPeaceful() -
checkDespawn
public void checkDespawn()- Overrides:
checkDespawn
in classEntity
-
serverAiStep
protected final void serverAiStep()- Overrides:
serverAiStep
in classLivingEntity
-
sendDebugPackets
protected void sendDebugPackets() -
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> pEntityType, LevelAccessor pLevel, EntitySpawnReason pSpawnReason, BlockPos pPos, RandomSource pRandom) -
checkSpawnRules
-
checkSpawnObstruction
-
getMaxSpawnClusterSize
public int getMaxSpawnClusterSize() -
isMaxGroupSizeReached
public boolean isMaxGroupSizeReached(int pSize) -
getMaxFallDistance
public int getMaxFallDistance()- Overrides:
getMaxFallDistance
in classLivingEntity
-
getBodyArmorItem
-
isSaddled
public boolean isSaddled() -
isWearingBodyArmor
public boolean isWearingBodyArmor() -
hasValidEquippableItemForSlot
-
setBodyArmorItem
-
createEquipmentSlotContainer
-
dropCustomDeathLoot
protected void dropCustomDeathLoot(ServerLevel pLevel, DamageSource pDamageSource, boolean pRecentlyHit) - Overrides:
dropCustomDeathLoot
in classLivingEntity
-
getDropChances
-
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, EntitySpawnReason pSpawnReason, @Nullable SpawnGroupData pSpawnGroupData) Deprecated. -
setPersistenceRequired
public void setPersistenceRequired() -
setDropChance
- Specified by:
setDropChance
in interfaceEquipmentUser
-
canPickUpLoot
public boolean canPickUpLoot()- Overrides:
canPickUpLoot
in classLivingEntity
-
setCanPickUpLoot
public void setCanPickUpLoot(boolean pCanPickUpLoot) -
canDispenserEquipIntoSlot
- Overrides:
canDispenserEquipIntoSlot
in classLivingEntity
-
isPersistenceRequired
public boolean isPersistenceRequired() -
interact
-
checkAndHandleImportantInteractions
private InteractionResult checkAndHandleImportantInteractions(Player pPlayer, InteractionHand pHand) -
onOffspringSpawnedFromEgg
-
mobInteract
-
isWithinHome
public boolean isWithinHome() -
isWithinHome
-
isWithinHome
-
setHomeTo
-
getHomePosition
-
getHomeRadius
public int getHomeRadius() -
clearHome
public void clearHome() -
hasHome
public boolean hasHome() -
convertTo
@Nullable public <T extends Mob> T convertTo(EntityType<T> pEntityType, ConversionParams pConversionParams, EntitySpawnReason pSpawnReason, ConversionParams.AfterConversion<T> pAfterConversion) -
convertTo
@Nullable public <T extends Mob> T convertTo(EntityType<T> pEntityType, ConversionParams pConversionParams, ConversionParams.AfterConversion<T> pAfterConversion) -
getLeashData
- Specified by:
getLeashData
in interfaceLeashable
-
resetAngularLeashMomentum
private void resetAngularLeashMomentum() -
setLeashData
- Specified by:
setLeashData
in interfaceLeashable
-
onLeashRemoved
public void onLeashRemoved()- Specified by:
onLeashRemoved
in interfaceLeashable
-
leashTooFarBehaviour
public void leashTooFarBehaviour()- Specified by:
leashTooFarBehaviour
in interfaceLeashable
-
canBeLeashed
public boolean canBeLeashed()- Specified by:
canBeLeashed
in interfaceLeashable
-
startRiding
- Overrides:
startRiding
in classEntity
-
isEffectiveAi
public boolean isEffectiveAi()- Overrides:
isEffectiveAi
in 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:
getMainArm
in classLivingEntity
-
isWithinMeleeAttackRange
-
getAttackBoundingBox
-
doHurtTarget
- Overrides:
doHurtTarget
in classLivingEntity
-
playAttackSound
protected void playAttackSound() -
isSunBurnTick
protected boolean isSunBurnTick() -
jumpInLiquid
Deprecated.- Overrides:
jumpInLiquid
in classLivingEntity
-
jumpInLiquidInternal
-
jumpInFluid
Description copied from interface:ILivingEntityExtension
Performs what to do when an entity attempts to go up or "jump" in a fluid.- Specified by:
jumpInFluid
in interfaceILivingEntityExtension
- Parameters:
type
- the type of the fluid
-
removeFreeWill
public void removeFreeWill() -
removeAllGoals
-
removeAfterChangingDimensions
protected void removeAfterChangingDimensions()- Overrides:
removeAfterChangingDimensions
in classEntity
-
getPickResult
- Overrides:
getPickResult
in classEntity
-
onAttributeUpdated
- Overrides:
onAttributeUpdated
in classLivingEntity
-
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.EntitySpawnReason, 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 theFinalizeSpawnEvent
without 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.
-