Class MobEntity

All Implemented Interfaces:
CommandOutput, Nameable
Direct Known Subclasses:
AmbientEntity, EnderDragonEntity, FlyingEntity, PathAwareEntity, SlimeEntity

public abstract class MobEntity
extends LivingEntity
  • Field Details

    • MOB_FLAGS

      private static final TrackedData<Byte> MOB_FLAGS
    • ambientSoundChance

      public int ambientSoundChance
    • experiencePoints

      protected int experiencePoints
    • lookControl

      protected LookControl lookControl
    • moveControl

      protected MoveControl moveControl
    • jumpControl

      protected JumpControl jumpControl
    • bodyControl

      private final BodyControl bodyControl
    • goalSelector

      protected final GoalSelector goalSelector
    • targetSelector

      protected final GoalSelector targetSelector
    • target

      private LivingEntity target
    • visibilityCache

      private final MobVisibilityCache visibilityCache
    • handItems

      private final DefaultedList<ItemStack> handItems
    • handDropChances

      protected final float[] handDropChances
    • armorItems

      private final DefaultedList<ItemStack> armorItems
    • armorDropChances

      protected final float[] armorDropChances
    • pickUpLoot

      private boolean pickUpLoot
    • persistent

      private boolean persistent
    • pathfindingPenalties

      private final Map<PathNodeType,​Float> pathfindingPenalties
    • lootTable

      private Identifier lootTable
    • lootTableSeed

      private long lootTableSeed
    • holdingEntity

      @Nullable private Entity holdingEntity
    • holdingEntityId

      private int holdingEntityId
    • leashTag

      @Nullable private CompoundTag leashTag
    • positionTarget

      private BlockPos positionTarget
    • positionTargetRange

      private float positionTargetRange
  • Constructor Details

  • Method Details

    • initGoals

      protected void initGoals()
    • createMobAttributes

      public static DefaultAttributeContainer.Builder createMobAttributes()
    • createNavigation

      protected EntityNavigation createNavigation​(World world)
    • movesIndependently

      protected boolean movesIndependently()
      When true, causes this entity to take over pathfinding for its controlling passenger.
    • getPathfindingPenalty

      public float getPathfindingPenalty​(PathNodeType nodeType)
    • setPathfindingPenalty

      public void setPathfindingPenalty​(PathNodeType nodeType, float penalty)
    • method_29244

      public boolean method_29244​(PathNodeType pathNodeType)
    • createBodyControl

      protected BodyControl createBodyControl()
    • getLookControl

      public LookControl getLookControl()
    • getMoveControl

      public MoveControl getMoveControl()
    • getJumpControl

      public JumpControl getJumpControl()
    • getNavigation

      public EntityNavigation getNavigation()
    • getVisibilityCache

      public MobVisibilityCache getVisibilityCache()
    • getTarget

      @Nullable public LivingEntity getTarget()
    • setTarget

      public void setTarget​(@Nullable LivingEntity target)
    • canTarget

      public boolean canTarget​(EntityType<?> type)
      Overrides:
      canTarget in class LivingEntity
    • canUseRangedWeapon

      public boolean canUseRangedWeapon​(RangedWeaponItem weapon)
    • onEatingGrass

      public void onEatingGrass()
    • initDataTracker

      protected void initDataTracker()
      Overrides:
      initDataTracker in class LivingEntity
    • getMinAmbientSoundDelay

      public int getMinAmbientSoundDelay()
    • playAmbientSound

      public void playAmbientSound()
    • baseTick

      public void baseTick()
      Overrides:
      baseTick in class LivingEntity
    • playHurtSound

      protected void playHurtSound​(DamageSource source)
      Overrides:
      playHurtSound in class LivingEntity
    • resetSoundDelay

      private void resetSoundDelay()
    • getCurrentExperience

      protected int getCurrentExperience​(PlayerEntity player)
      Overrides:
      getCurrentExperience in class LivingEntity
    • playSpawnEffects

      public void playSpawnEffects()
    • handleStatus

      @Environment(CLIENT) public void handleStatus​(byte status)
      Overrides:
      handleStatus in class LivingEntity
    • tick

      public void tick()
      Overrides:
      tick in class LivingEntity
    • updateGoalControls

      protected void updateGoalControls()
    • turnHead

      protected float turnHead​(float bodyRotation, float headRotation)
      Overrides:
      turnHead in class LivingEntity
    • getAmbientSound

      @Nullable protected SoundEvent getAmbientSound()
    • writeCustomDataToTag

      public void writeCustomDataToTag​(CompoundTag tag)
      Overrides:
      writeCustomDataToTag in class LivingEntity
    • readCustomDataFromTag

      public void readCustomDataFromTag​(CompoundTag tag)
      Overrides:
      readCustomDataFromTag in class LivingEntity
    • dropLoot

      protected void dropLoot​(DamageSource source, boolean causedByPlayer)
      Overrides:
      dropLoot in class LivingEntity
    • getLootContextBuilder

      protected LootContext.Builder getLootContextBuilder​(boolean causedByPlayer, DamageSource source)
      Overrides:
      getLootContextBuilder in class LivingEntity
    • getLootTable

      public final Identifier getLootTable()
      Overrides:
      getLootTable in class LivingEntity
    • getLootTableId

      protected Identifier 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 class LivingEntity
    • tickMovement

      public void tickMovement()
      Overrides:
      tickMovement in class LivingEntity
    • loot

      protected void loot​(ItemEntity item)
    • tryEquip

      public boolean tryEquip​(ItemStack equipment)
    • equipLootStack

      protected void equipLootStack​(EquipmentSlot slot, ItemStack stack)
    • updateDropChances

      public void updateDropChances​(EquipmentSlot slot)
    • prefersNewEquipment

      protected boolean prefersNewEquipment​(ItemStack newStack, ItemStack oldStack)
    • prefersNewDamageableItem

      public boolean prefersNewDamageableItem​(ItemStack newStack, ItemStack oldStack)
    • canPickupItem

      public boolean canPickupItem​(ItemStack stack)
    • canGather

      public boolean canGather​(ItemStack stack)
    • canImmediatelyDespawn

      public boolean canImmediatelyDespawn​(double distanceSquared)
    • cannotDespawn

      public boolean cannotDespawn()
    • isDisallowedInPeaceful

      protected boolean isDisallowedInPeaceful()
    • checkDespawn

      public void checkDespawn()
      Overrides:
      checkDespawn in class Entity
    • tickNewAi

      protected final void tickNewAi()
      Overrides:
      tickNewAi in class LivingEntity
    • sendAiDebugData

      protected void sendAiDebugData()
    • mobTick

      protected void mobTick()
    • getLookPitchSpeed

      public int getLookPitchSpeed()
    • getBodyYawSpeed

      public int getBodyYawSpeed()
    • getLookYawSpeed

      public int getLookYawSpeed()
    • lookAtEntity

      public void lookAtEntity​(Entity targetEntity, float maxYawChange, float maxPitchChange)
    • 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

      public boolean canSpawn​(WorldAccess world, SpawnReason spawnReason)
    • canSpawn

      public boolean canSpawn​(WorldView world)
    • getLimitPerChunk

      public int getLimitPerChunk()
    • spawnsTooManyForEachTry

      public boolean spawnsTooManyForEachTry​(int count)
    • getSafeFallDistance

      public int getSafeFallDistance()
      Overrides:
      getSafeFallDistance in class Entity
    • getItemsHand

      public Iterable<ItemStack> getItemsHand()
      Overrides:
      getItemsHand in class Entity
    • getArmorItems

      public Iterable<ItemStack> getArmorItems()
      Specified by:
      getArmorItems in class LivingEntity
    • getEquippedStack

      public ItemStack getEquippedStack​(EquipmentSlot slot)
      Specified by:
      getEquippedStack in class LivingEntity
    • equipStack

      public void equipStack​(EquipmentSlot slot, ItemStack stack)
      Specified by:
      equipStack in class LivingEntity
    • dropEquipment

      protected void dropEquipment​(DamageSource source, int lootingMultiplier, boolean allowDrops)
      Overrides:
      dropEquipment in class LivingEntity
    • getDropChance

      protected float getDropChance​(EquipmentSlot slot)
    • initEquipment

      protected void initEquipment​(LocalDifficulty difficulty)
    • getPreferredEquipmentSlot

      public static EquipmentSlot getPreferredEquipmentSlot​(ItemStack stack)
    • getEquipmentForSlot

      @Nullable public static Item getEquipmentForSlot​(EquipmentSlot equipmentSlot, int equipmentLevel)
    • updateEnchantments

      protected void updateEnchantments​(LocalDifficulty difficulty)
    • method_30759

      protected void method_30759​(float float2)
    • method_30758

      protected void method_30758​(float float2, EquipmentSlot equipmentSlot)
    • 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

      public void setEquipmentDropChance​(EquipmentSlot slot, float chance)
    • canPickUpLoot

      public boolean canPickUpLoot()
    • setCanPickUpLoot

      public void setCanPickUpLoot​(boolean pickUpLoot)
    • canEquip

      public boolean canEquip​(ItemStack stack)
      Overrides:
      canEquip in class LivingEntity
    • isPersistent

      public boolean isPersistent()
    • interact

      public final ActionResult interact​(PlayerEntity player, Hand hand)
      Called when a player interacts with this entity.
      Overrides:
      interact in class Entity
      Parameters:
      player - the player
      hand - the hand the player used to interact with this entity
    • method_29506

      private ActionResult method_29506​(PlayerEntity playerEntity, Hand hand)
    • onPlayerSpawnedChild

      protected void onPlayerSpawnedChild​(PlayerEntity player, MobEntity child)
    • interactMob

      protected ActionResult interactMob​(PlayerEntity player, Hand hand)
    • isInWalkTargetRange

      public boolean isInWalkTargetRange()
    • isInWalkTargetRange

      public boolean isInWalkTargetRange​(BlockPos pos)
    • setPositionTarget

      public void setPositionTarget​(BlockPos target, int range)
    • getPositionTarget

      public BlockPos getPositionTarget()
    • getPositionTargetRange

      public float getPositionTargetRange()
    • hasPositionTarget

      public boolean hasPositionTarget()
    • method_29243

      @Nullable public <T extends MobEntity> T method_29243​(EntityType<T> entityType, boolean bool)
    • updateLeash

      protected void updateLeash()
    • detachLeash

      public void detachLeash​(boolean sendPacket, boolean dropItem)
    • canBeLeashedBy

      public boolean canBeLeashedBy​(PlayerEntity player)
    • isLeashed

      public boolean isLeashed()
    • getHoldingEntity

      @Nullable public Entity getHoldingEntity()
    • attachLeash

      public void attachLeash​(Entity entity, boolean sendPacket)
    • setHoldingEntityId

      @Environment(CLIENT) public void setHoldingEntityId​(int id)
    • startRiding

      public boolean startRiding​(Entity entity, boolean force)
      Overrides:
      startRiding in class Entity
    • deserializeLeashTag

      private void deserializeLeashTag()
    • equip

      public boolean equip​(int slot, ItemStack item)
      Overrides:
      equip in class Entity
    • isLogicalSideForUpdatingMovement

      public boolean isLogicalSideForUpdatingMovement()
      Overrides:
      isLogicalSideForUpdatingMovement in class Entity
    • canEquipmentSlotContain

      public static boolean canEquipmentSlotContain​(EquipmentSlot slot, ItemStack item)
    • canMoveVoluntarily

      public boolean canMoveVoluntarily()
      Overrides:
      canMoveVoluntarily in class LivingEntity
    • 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

      public Arm getMainArm()
      Specified by:
      getMainArm in class LivingEntity
    • canTarget

      public boolean canTarget​(LivingEntity target)
      Overrides:
      canTarget in class LivingEntity
    • tryAttack

      public boolean tryAttack​(Entity target)
      Overrides:
      tryAttack in class LivingEntity
    • disablePlayerShield

      private void disablePlayerShield​(PlayerEntity player, ItemStack mobStack, ItemStack playerStack)
    • isAffectedByDaylight

      protected boolean isAffectedByDaylight()
    • swimUpward

      protected void swimUpward​(Tag<Fluid> fluid)
      Overrides:
      swimUpward in class LivingEntity
    • method_30076

      protected void method_30076()
      Overrides:
      method_30076 in class Entity