Package net.minecraft.entity.mob
Class MobEntity
java.lang.Object
net.minecraft.entity.Entity
net.minecraft.entity.LivingEntity
net.minecraft.entity.mob.MobEntity
- All Implemented Interfaces:
CommandOutput
,Nameable
- Direct Known Subclasses:
AmbientEntity
,EnderDragonEntity
,FlyingEntity
,PathAwareEntity
,SlimeEntity
public abstract class MobEntity extends LivingEntity
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.PositionUpdater
-
Field Summary
Fields Modifier and Type Field Description int
ambientSoundChance
protected float[]
armorDropChances
private DefaultedList<ItemStack>
armorItems
private BodyControl
bodyControl
protected int
experiencePoints
protected GoalSelector
goalSelector
protected float[]
handDropChances
private DefaultedList<ItemStack>
handItems
private Entity
holdingEntity
private int
holdingEntityId
protected JumpControl
jumpControl
private CompoundTag
leashTag
protected LookControl
lookControl
private Identifier
lootTable
private long
lootTableSeed
private static TrackedData<Byte>
MOB_FLAGS
protected MoveControl
moveControl
protected EntityNavigation
navigation
private Map<PathNodeType,Float>
pathfindingPenalties
private boolean
persistent
private boolean
pickUpLoot
private BlockPos
positionTarget
private float
positionTargetRange
private LivingEntity
target
protected GoalSelector
targetSelector
private MobVisibilityCache
visibilityCache
Fields inherited from class net.minecraft.entity.LivingEntity
activeItemStack, attackingPlayer, bodyTrackingIncrements, bodyYaw, brain, dead, deathTime, defaultMaxHealth, despawnCounter, field_6215, flyingSpeed, forwardSpeed, handSwinging, handSwingProgress, handSwingTicks, headTrackingIncrements, headYaw, hurtTime, itemUseTimeLeft, jumping, knockbackVelocity, lastAttackedTicks, lastDamageTaken, lastHandSwingProgress, lastLimbDistance, limbAngle, limbDistance, LIVING_FLAGS, lookDirection, maxHurtTime, playerHitTimer, preferredHand, prevBodyYaw, prevHeadYaw, prevLookDirection, prevStepBobbingAmount, randomLargeSeed, randomSmallSeed, riptideTicks, roll, scoreAmount, serverHeadYaw, serverPitch, serverX, serverY, serverYaw, serverZ, sidewaysSpeed, SLEEPING_DIMENSIONS, stepBobbingAmount, stuckArrowTimer, stuckStingerTimer, upwardSpeed
Fields inherited from class net.minecraft.entity.Entity
age, chunkX, chunkY, chunkZ, dataTracker, distanceTraveled, fallDistance, field_25599, firstUpdate, FLAGS, fluidHeight, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inNetherPortal, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, removed, ridingCooldown, stepHeight, submergedInWater, teleporting, timeUntilRegen, touchingWater, updateNeeded, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, world, yaw
Fields inherited from interface net.minecraft.server.command.CommandOutput
DUMMY
-
Constructor Summary
Constructors Modifier Constructor Description protected
MobEntity(EntityType<? extends MobEntity> type, World world)
-
Method Summary
Methods inherited from class net.minecraft.entity.LivingEntity
addSoulSpeedBoostIfNeeded, addStatusEffect, animateDamage, applyArmorToDamage, applyDamage, applyEnchantmentsToDamage, applyMovementEffects, applyStatusEffect, attackLivingEntity, canBeRiddenInWater, canBreatheInWater, canDropLootAndXp, canHaveStatusEffect, canSee, canWalkOnFluid, clearActiveItem, clearPotionSwirls, clearSleepingPosition, clearStatusEffects, collides, computeFallDamage, consumeItem, containsOnlyAmbientEffects, createBrainProfile, createLivingAttributes, createSpawnPacket, damage, damageArmor, damageShield, deserializeBrain, destroy, displaySoulSpeedEffects, drop, dropInventory, dropXp, eatFood, endCombat, enterCombat, fall, getAbsorptionAmount, getActiveEyeHeight, getActiveHand, getActiveItem, getActiveStatusEffects, getArmor, getArmorVisibility, getArrowType, getAttackDistanceScalingFactor, getAttacker, getAttacking, getAttributeBaseValue, getAttributeInstance, getAttributes, getAttributeValue, getBaseMovementSpeedMultiplier, getBlockState, getBoundingBox, getBrain, getClimbingPos, getDamageTracker, getDeathSound, getDespawnCounter, getDimensions, getDrinkSound, getEatSound, getEyeHeight, getFallSound, getGroup, getHandSwingProgress, getHeadYaw, getHealth, getHurtSound, getItemUseTime, getItemUseTimeLeft, getJumpVelocity, getLastAttackedTime, getLastAttackTime, getLeaningPitch, getMainHandStack, getMaxHealth, getMovementSpeed, getNextAirOnLand, getNextAirUnderwater, getOffHandStack, getPoses, getPrimeAdversary, getRandom, getRecentDamageSource, getRoll, getScaleFactor, getSleepingDirection, getSleepingPosition, getSoundPitch, getSoundVolume, getStackInHand, getStatusEffect, getStatusEffects, getStingerCount, getStuckArrowCount, getVelocityMultiplier, getVisibilityBoundingBox, getYaw, handleFallDamage, hasStackEquipped, hasStatusEffect, heal, hurtByWater, isAffectedBySplashPotions, isAlive, isBaby, isBlocking, isClimbing, isDead, isFallFlying, isHolding, isHolding, isHoldingOntoLadder, isImmobile, isInsideWall, isInSwimmingPose, isMobOrPlayer, isOnSoulSpeedBlock, isPushable, isSleeping, isTarget, isUndead, isUsingItem, isUsingRiptide, jump, kill, knockback, knockDownwards, lookAt, markEffectsDirty, method_26317, method_26318, method_29242, method_29499, method_29500, method_29920, method_30633, method_31079, onAttacking, onDeath, onEquipStack, onKilledBy, onStatusEffectApplied, onStatusEffectRemoved, onStatusEffectUpgraded, onTrackedDataSet, playBlockFallSound, pushAway, pushAwayFrom, removeSoulSpeedBoost, removeStatusEffect, removeStatusEffectInternal, scheduleVelocityUpdate, sendEquipmentBreakStatus, sendPickup, sendToolBreakStatus, setAbsorptionAmount, setAttacker, setAttacking, setCurrentHand, setDespawnCounter, setHeadYaw, setHealth, setJumping, setLivingFlag, setNearbySongPlaying, setOnGround, setRiptideTicks, setSleepingPosition, setSprinting, setStackInHand, setStingerCount, setStuckArrowCount, setYaw, shouldAlwaysDropXp, shouldDisplaySoulSpeedEffects, shouldDropLoot, shouldRenderName, sleep, spawnConsumptionEffects, stopRiding, stopUsingItem, swingHand, swingHand, takeKnockback, takeShieldHit, teleport, tickCramming, tickHandSwing, tickRiding, tickRiptide, tickStatusEffects, travel, updatePostDeath, updatePotionVisibility, updateTrackedHeadRotation, updateTrackedPositionAndAngles, wakeUp
Methods inherited from class net.minecraft.entity.Entity
addPassenger, addScoreboardTag, addVelocity, adjustMovementForCollisions, adjustMovementForCollisions, adjustMovementForPiston, adjustMovementForSneaking, adjustSingleAxisMovementForCollisions, afterSpawn, applyMirror, applyRotation, bypassesLandingEffects, bypassesSteppingEffects, calculateBoundsForPose, calculateDimensions, calculateNextStepSoundDistance, canAddPassenger, canAvoidTraps, canBeSpectated, canClimb, canExplosionDestroyBlock, canFly, canStartRiding, canUsePortals, changeLookDirection, checkBlockCollision, collidesWith, copyFrom, copyPositionAndRotation, dealDamage, detach, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, extinguish, fromTag, getAir, getBlockPos, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getCommandSource, getCustomName, getDataTracker, getDefaultName, getDefaultNetherPortalCooldown, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFlag, getFluidHeight, getHeight, getHeightOffset, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMaxNetherPortalTime, getMountedHeightOffset, getMovementDirection, getName, getOppositeRotationVector, getOppositeRotationVector, getParticleX, getParticleZ, getPassengerDismountOffset, getPassengerList, getPassengersDeep, getPermissionLevel, getPistonBehavior, getPitch, getPos, getPose, getPrimaryPassenger, getRandomBodyY, getRenderDistanceMultiplier, getRootVehicle, getRotationClient, getRotationVec, getRotationVecClient, getRotationVector, getRotationVector, getSavedEntityId, getScoreboardTags, getScoreboardTeam, getServer, getSoundCategory, getSplashSound, getStandingEyeHeight, getSwimSound, getTargetingMargin, getTeamColorValue, getTeleportTarget, getTrackedPosition, getType, getUuid, getUuidAsString, getVehicle, getVelocity, getVelocityAffectingPos, getWidth, getX, getY, getZ, handleAttack, hasCustomName, hashCode, hasNetherPortalCooldown, hasNoGravity, hasPassenger, hasPassengerDeep, hasPassengers, hasPassengerType, hasPermissionLevel, hasPlayerRider, hasVehicle, hasWings, interactAt, isAttackable, isChunkPosUpdateRequested, isCollidable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isFireImmune, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWaterOrBubbleColumn, isInSneakingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isOnFire, isOnGround, isPartOf, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_29239, method_29241, method_29919, method_30330, method_30632, method_30634, method_30950, method_30951, method_31166, move, moveToBoundingBoxCenter, moveToWorld, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onPlayerCollision, onStartedTrackingBy, onStoppedTrackingBy, onStruckByLightning, onSwimmingStart, playFlySound, playSound, playStepSound, playSwimSound, populateCrashReport, pushOutOfBlocks, raycast, refreshPosition, refreshPositionAfterTeleport, refreshPositionAfterTeleport, refreshPositionAndAngles, refreshPositionAndAngles, remove, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetNetherPortalCooldown, resetPosition, saveSelfToTag, saveToTag, sendSystemMessage, setAir, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, setFireTicks, setFlag, setGlowing, setInNetherPortal, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setPos, setPose, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, setWorld, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldSetPositionOnLoad, shouldSpawnSprintingParticles, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, streamPassengersRecursively, teleport, teleportRequested, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateSwimming, updateTrackedPosition, updateTrackedPosition, updateVelocity, updateWaterState, wouldPoseNotCollide
-
Field Details
-
MOB_FLAGS
-
ambientSoundChance
public int ambientSoundChance -
experiencePoints
protected int experiencePoints -
lookControl
-
moveControl
-
jumpControl
-
bodyControl
-
goalSelector
-
targetSelector
-
target
-
visibilityCache
-
handItems
-
handDropChances
protected final float[] handDropChances -
armorItems
-
armorDropChances
protected final float[] armorDropChances -
pickUpLoot
private boolean pickUpLoot -
persistent
private boolean persistent -
pathfindingPenalties
-
lootTable
-
lootTableSeed
private long lootTableSeed -
holdingEntity
-
holdingEntityId
private int holdingEntityId -
leashTag
-
positionTarget
-
positionTargetRange
private float positionTargetRange
-
-
Constructor Details
-
MobEntity
-
-
Method Details
-
initGoals
protected void initGoals() -
createMobAttributes
-
movesIndependently
protected boolean movesIndependently()When true, causes this entity to take over pathfinding for its controlling passenger. -
getPathfindingPenalty
-
setPathfindingPenalty
-
method_29244
-
createBodyControl
-
getLookControl
-
getMoveControl
-
getJumpControl
-
getVisibilityCache
-
getTarget
-
setTarget
-
canTarget
- Overrides:
canTarget
in classLivingEntity
-
canUseRangedWeapon
-
onEatingGrass
public void onEatingGrass() -
initDataTracker
protected void initDataTracker()- Overrides:
initDataTracker
in classLivingEntity
-
getMinAmbientSoundDelay
public int getMinAmbientSoundDelay() -
playAmbientSound
public void playAmbientSound() -
baseTick
public void baseTick()- Overrides:
baseTick
in classLivingEntity
-
playHurtSound
- Overrides:
playHurtSound
in classLivingEntity
-
resetSoundDelay
private void resetSoundDelay() -
getCurrentExperience
- Overrides:
getCurrentExperience
in classLivingEntity
-
playSpawnEffects
public void playSpawnEffects() -
handleStatus
@Environment(CLIENT) public void handleStatus(byte status)- Overrides:
handleStatus
in classLivingEntity
-
tick
public void tick()- Overrides:
tick
in classLivingEntity
-
updateGoalControls
protected void updateGoalControls() -
turnHead
protected float turnHead(float bodyRotation, float headRotation)- Overrides:
turnHead
in classLivingEntity
-
getAmbientSound
-
writeCustomDataToTag
- Overrides:
writeCustomDataToTag
in classLivingEntity
-
readCustomDataFromTag
- Overrides:
readCustomDataFromTag
in classLivingEntity
-
dropLoot
- Overrides:
dropLoot
in classLivingEntity
-
getLootContextBuilder
- Overrides:
getLootContextBuilder
in classLivingEntity
-
getLootTable
- Overrides:
getLootTable
in classLivingEntity
-
getLootTableId
-
setForwardSpeed
public void setForwardSpeed(float forwardSpeed) -
setUpwardSpeed
public void setUpwardSpeed(float upwardSpeed) -
setSidewaysSpeed
public void setSidewaysSpeed(float sidewaysMovement) -
setMovementSpeed
public void setMovementSpeed(float movementSpeed)- Overrides:
setMovementSpeed
in classLivingEntity
-
tickMovement
public void tickMovement()- Overrides:
tickMovement
in classLivingEntity
-
loot
-
tryEquip
-
equipLootStack
-
updateDropChances
-
prefersNewEquipment
-
prefersNewDamageableItem
-
canPickupItem
-
canGather
-
canImmediatelyDespawn
public boolean canImmediatelyDespawn(double distanceSquared) -
cannotDespawn
public boolean cannotDespawn() -
isDisallowedInPeaceful
protected boolean isDisallowedInPeaceful() -
checkDespawn
public void checkDespawn()- Overrides:
checkDespawn
in classEntity
-
tickNewAi
protected final void tickNewAi()- Overrides:
tickNewAi
in classLivingEntity
-
sendAiDebugData
protected void sendAiDebugData() -
mobTick
protected void mobTick() -
getLookPitchSpeed
public int getLookPitchSpeed() -
getBodyYawSpeed
public int getBodyYawSpeed() -
getLookYawSpeed
public int getLookYawSpeed() -
lookAtEntity
-
changeAngle
private float changeAngle(float oldAngle, float newAngle, float maxChangeInAngle) -
canMobSpawn
public static boolean canMobSpawn(EntityType<? extends MobEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) -
canSpawn
-
canSpawn
-
getLimitPerChunk
public int getLimitPerChunk() -
spawnsTooManyForEachTry
public boolean spawnsTooManyForEachTry(int count) -
getSafeFallDistance
public int getSafeFallDistance()- Overrides:
getSafeFallDistance
in classEntity
-
getItemsHand
- Overrides:
getItemsHand
in classEntity
-
getArmorItems
- Specified by:
getArmorItems
in classLivingEntity
-
getEquippedStack
- Specified by:
getEquippedStack
in classLivingEntity
-
equipStack
- Specified by:
equipStack
in classLivingEntity
-
dropEquipment
- Overrides:
dropEquipment
in classLivingEntity
-
getDropChance
-
initEquipment
-
getPreferredEquipmentSlot
-
getEquipmentForSlot
-
updateEnchantments
-
method_30759
protected void method_30759(float float2) -
method_30758
-
initialize
@Nullable public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable CompoundTag entityTag) -
canBeControlledByRider
public boolean canBeControlledByRider() -
setPersistent
public void setPersistent() -
setEquipmentDropChance
-
canPickUpLoot
public boolean canPickUpLoot() -
setCanPickUpLoot
public void setCanPickUpLoot(boolean pickUpLoot) -
canEquip
- Overrides:
canEquip
in classLivingEntity
-
isPersistent
public boolean isPersistent() -
interact
Called when a player interacts with this entity. -
method_29506
-
onPlayerSpawnedChild
-
interactMob
-
isInWalkTargetRange
public boolean isInWalkTargetRange() -
isInWalkTargetRange
-
setPositionTarget
-
getPositionTarget
-
getPositionTargetRange
public float getPositionTargetRange() -
hasPositionTarget
public boolean hasPositionTarget() -
method_29243
-
updateLeash
protected void updateLeash() -
detachLeash
public void detachLeash(boolean sendPacket, boolean dropItem) -
canBeLeashedBy
-
isLeashed
public boolean isLeashed() -
getHoldingEntity
-
attachLeash
-
setHoldingEntityId
@Environment(CLIENT) public void setHoldingEntityId(int id) -
startRiding
- Overrides:
startRiding
in classEntity
-
deserializeLeashTag
private void deserializeLeashTag() -
equip
-
isLogicalSideForUpdatingMovement
public boolean isLogicalSideForUpdatingMovement()- Overrides:
isLogicalSideForUpdatingMovement
in classEntity
-
canEquipmentSlotContain
-
canMoveVoluntarily
public boolean canMoveVoluntarily()- Overrides:
canMoveVoluntarily
in classLivingEntity
-
setAiDisabled
public void setAiDisabled(boolean aiDisabled) -
setLeftHanded
public void setLeftHanded(boolean leftHanded) -
setAttacking
public void setAttacking(boolean attacking) -
isAiDisabled
public boolean isAiDisabled() -
isLeftHanded
public boolean isLeftHanded() -
isAttacking
public boolean isAttacking() -
setBaby
public void setBaby(boolean baby) -
getMainArm
- Specified by:
getMainArm
in classLivingEntity
-
canTarget
- Overrides:
canTarget
in classLivingEntity
-
tryAttack
- Overrides:
tryAttack
in classLivingEntity
-
disablePlayerShield
-
isAffectedByDaylight
protected boolean isAffectedByDaylight() -
swimUpward
- Overrides:
swimUpward
in classLivingEntity
-
method_30076
protected void method_30076()- Overrides:
method_30076
in classEntity
-