Class BatEntity

All Implemented Interfaces:
Attackable, DataTracked, EquipmentHolder, Targeter, ScoreHolder, CommandOutput, Nameable, EntityLike

public class BatEntity extends AmbientEntity
Mappings:
Namespace Name
named net/minecraft/entity/passive/BatEntity
intermediary net/minecraft/class_1420
official cfc
  • Field Details

    • field_46966

      public static final float field_46966
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_46966 Lnet/minecraft/entity/passive/BatEntity;field_46966:F
      intermediary field_46966 Lnet/minecraft/class_1420;field_46966:F
      official b Lcfc;b:F
    • field_46967

      public static final float field_46967
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_46967 Lnet/minecraft/entity/passive/BatEntity;field_46967:F
      intermediary field_46967 Lnet/minecraft/class_1420;field_46967:F
      official c Lcfc;c:F
    • BAT_FLAGS

      private static final TrackedData<Byte> BAT_FLAGS
      The tracked flags of bats. Only has the 1 bit for roosting.
      Mappings:
      Namespace Name Mixin selector
      named BAT_FLAGS Lnet/minecraft/entity/passive/BatEntity;BAT_FLAGS:Lnet/minecraft/entity/data/TrackedData;
      intermediary field_6728 Lnet/minecraft/class_1420;field_6728:Lnet/minecraft/class_2940;
      official bX Lcfc;bX:Lakk;
    • ROOSTING_FLAG

      private static final int ROOSTING_FLAG
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named ROOSTING_FLAG Lnet/minecraft/entity/passive/BatEntity;ROOSTING_FLAG:I
      intermediary field_30269 Lnet/minecraft/class_1420;field_30269:I
      official bY Lcfc;bY:I
    • CLOSE_PLAYER_PREDICATE

      private static final TargetPredicate CLOSE_PLAYER_PREDICATE
      Mappings:
      Namespace Name Mixin selector
      named CLOSE_PLAYER_PREDICATE Lnet/minecraft/entity/passive/BatEntity;CLOSE_PLAYER_PREDICATE:Lnet/minecraft/entity/ai/TargetPredicate;
      intermediary field_18100 Lnet/minecraft/class_1420;field_18100:Lnet/minecraft/class_4051;
      official bZ Lcfc;bZ:Lcei;
    • flyingAnimationState

      public final AnimationState flyingAnimationState
      Mappings:
      Namespace Name Mixin selector
      named flyingAnimationState Lnet/minecraft/entity/passive/BatEntity;flyingAnimationState:Lnet/minecraft/entity/AnimationState;
      intermediary field_46968 Lnet/minecraft/class_1420;field_46968:Lnet/minecraft/class_7094;
      official d Lcfc;d:Lbsr;
    • roostingAnimationState

      public final AnimationState roostingAnimationState
      Mappings:
      Namespace Name Mixin selector
      named roostingAnimationState Lnet/minecraft/entity/passive/BatEntity;roostingAnimationState:Lnet/minecraft/entity/AnimationState;
      intermediary field_46969 Lnet/minecraft/class_1420;field_46969:Lnet/minecraft/class_7094;
      official e Lcfc;e:Lbsr;
    • hangingPosition

      @Nullable private @Nullable BlockPos hangingPosition
      Mappings:
      Namespace Name Mixin selector
      named hangingPosition Lnet/minecraft/entity/passive/BatEntity;hangingPosition:Lnet/minecraft/util/math/BlockPos;
      intermediary field_6729 Lnet/minecraft/class_1420;field_6729:Lnet/minecraft/class_2338;
      official ca Lcfc;ca:Liz;
  • Constructor Details

    • BatEntity

      public BatEntity(EntityType<? extends BatEntity> type, World world)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/entity/Entity;<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V
      intermediary <init> Lnet/minecraft/class_1297;<init>(Lnet/minecraft/class_1299;Lnet/minecraft/class_1937;)V
      official <init> Lbsw;<init>(Lbtc;Ldca;)V
  • Method Details

    • isFlappingWings

      public boolean isFlappingWings()
      Returns whether the entity is flapping their wings.

      Entities flapping their wings will call Entity.addFlapEffects() inside Entity.addAirTravelEffects().

      Overrides:
      isFlappingWings in class Entity
      Returns:
      whether the entity is flapping their wings
      Mappings:
      Namespace Name Mixin selector
      named isFlappingWings Lnet/minecraft/entity/Entity;isFlappingWings()Z
      intermediary method_5776 Lnet/minecraft/class_1297;method_5776()Z
      official aV Lbsw;aV()Z
    • initDataTracker

      protected void initDataTracker(DataTracker.Builder builder)
      Initializes data tracker.
      Overrides:
      initDataTracker in class MobEntity
      API Note:
      Subclasses should override this and add to the builder any data that needs to be tracked.
      Mappings:
      Namespace Name Mixin selector
      named initDataTracker Lnet/minecraft/entity/Entity;initDataTracker(Lnet/minecraft/entity/data/DataTracker$Builder;)V
      intermediary method_5693 Lnet/minecraft/class_1297;method_5693(Lnet/minecraft/class_2945$class_9222;)V
      official a Lbsw;a(Lako$a;)V
    • getSoundVolume

      protected float getSoundVolume()
      Overrides:
      getSoundVolume in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      named getSoundVolume Lnet/minecraft/entity/LivingEntity;getSoundVolume()F
      intermediary method_6107 Lnet/minecraft/class_1309;method_6107()F
      official fe Lbtr;fe()F
    • getSoundPitch

      public float getSoundPitch()
      Overrides:
      getSoundPitch in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      named getSoundPitch Lnet/minecraft/entity/LivingEntity;getSoundPitch()F
      intermediary method_6017 Lnet/minecraft/class_1309;method_6017()F
      official ff Lbtr;ff()F
    • getAmbientSound

      @Nullable public @Nullable SoundEvent getAmbientSound()
      Overrides:
      getAmbientSound in class MobEntity
      Mappings:
      Namespace Name Mixin selector
      named getAmbientSound Lnet/minecraft/entity/mob/MobEntity;getAmbientSound()Lnet/minecraft/sound/SoundEvent;
      intermediary method_5994 Lnet/minecraft/class_1308;method_5994()Lnet/minecraft/class_3414;
      official v Lbtt;v()Lavz;
    • getHurtSound

      protected SoundEvent getHurtSound(DamageSource source)
      Overrides:
      getHurtSound in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      named getHurtSound Lnet/minecraft/entity/LivingEntity;getHurtSound(Lnet/minecraft/entity/damage/DamageSource;)Lnet/minecraft/sound/SoundEvent;
      intermediary method_6011 Lnet/minecraft/class_1309;method_6011(Lnet/minecraft/class_1282;)Lnet/minecraft/class_3414;
      official d Lbtr;d(Lbrp;)Lavz;
    • getDeathSound

      protected SoundEvent getDeathSound()
      Overrides:
      getDeathSound in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      named getDeathSound Lnet/minecraft/entity/LivingEntity;getDeathSound()Lnet/minecraft/sound/SoundEvent;
      intermediary method_6002 Lnet/minecraft/class_1309;method_6002()Lnet/minecraft/class_3414;
      official o_ Lbtr;o_()Lavz;
    • isPushable

      public boolean isPushable()
      Returns whether the entity can be pushed by other entities.
      Overrides:
      isPushable in class LivingEntity
      Returns:
      whether the entity can be pushed by other entities
      Mappings:
      Namespace Name Mixin selector
      named isPushable Lnet/minecraft/entity/Entity;isPushable()Z
      intermediary method_5810 Lnet/minecraft/class_1297;method_5810()Z
      official bA Lbsw;bA()Z
    • pushAway

      protected void pushAway(Entity entity)
      Overrides:
      pushAway in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      named pushAway Lnet/minecraft/entity/LivingEntity;pushAway(Lnet/minecraft/entity/Entity;)V
      intermediary method_6087 Lnet/minecraft/class_1309;method_6087(Lnet/minecraft/class_1297;)V
      official D Lbtr;D(Lbsw;)V
    • tickCramming

      protected void tickCramming()
      Overrides:
      tickCramming in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      named tickCramming Lnet/minecraft/entity/LivingEntity;tickCramming()V
      intermediary method_6070 Lnet/minecraft/class_1309;method_6070()V
      official q Lbtr;q()V
    • createBatAttributes

      public static DefaultAttributeContainer.Builder createBatAttributes()
      Mappings:
      Namespace Name Mixin selector
      named createBatAttributes Lnet/minecraft/entity/passive/BatEntity;createBatAttributes()Lnet/minecraft/entity/attribute/DefaultAttributeContainer$Builder;
      intermediary method_26878 Lnet/minecraft/class_1420;method_26878()Lnet/minecraft/class_5132$class_5133;
      official s Lcfc;s()Lbuy$a;
    • isRoosting

      public boolean isRoosting()
      Returns whether this bat is hanging upside-down under a block.
      Mappings:
      Namespace Name Mixin selector
      named isRoosting Lnet/minecraft/entity/passive/BatEntity;isRoosting()Z
      intermediary method_6450 Lnet/minecraft/class_1420;method_6450()Z
      official u Lcfc;u()Z
    • setRoosting

      public void setRoosting(boolean roosting)
      Mappings:
      Namespace Name Mixin selector
      named setRoosting Lnet/minecraft/entity/passive/BatEntity;setRoosting(Z)V
      intermediary method_6449 Lnet/minecraft/class_1420;method_6449(Z)V
      official w Lcfc;w(Z)V
    • tick

      public void tick()
      Ticks this entity.
      Overrides:
      tick in class MobEntity
      See Also:
      API Note:
      This can be overridden to add additional logics. super.tick(); should be called in those cases.
      Implementation Note:
      By default, this delegates all logics to MobEntity.baseTick().
      Mappings:
      Namespace Name Mixin selector
      named tick Lnet/minecraft/entity/Entity;tick()V
      intermediary method_5773 Lnet/minecraft/class_1297;method_5773()V
      official l Lbsw;l()V
    • mobTick

      protected void mobTick()
      Overrides:
      mobTick in class MobEntity
      Mappings:
      Namespace Name Mixin selector
      named mobTick Lnet/minecraft/entity/mob/MobEntity;mobTick()V
      intermediary method_5958 Lnet/minecraft/class_1308;method_5958()V
      official Z Lbtt;Z()V
    • getMoveEffect

      protected Entity.MoveEffect getMoveEffect()
      Returns the possible effect(s) of an entity moving.
      Overrides:
      getMoveEffect in class Entity
      Implementation Note:
      If an entity does not emit game events or play move sounds, this method should be overridden as returning a value other than ALL allows skipping some movement logic and boost ticking performance.
      Mappings:
      Namespace Name Mixin selector
      named getMoveEffect Lnet/minecraft/entity/Entity;getMoveEffect()Lnet/minecraft/entity/Entity$MoveEffect;
      intermediary method_33570 Lnet/minecraft/class_1297;method_33570()Lnet/minecraft/class_1297$class_5799;
      official bb Lbsw;bb()Lbsw$b;
    • fall

      protected void fall(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition)
      Called when the entity falls. Flying mobs should override this to do nothing.
      Overrides:
      fall in class LivingEntity
      Implementation Note:
      If on ground, this calls Block.onLandedUpon(net.minecraft.world.World, net.minecraft.block.BlockState, net.minecraft.util.math.BlockPos, net.minecraft.entity.Entity, float), which can add or reduce fall damage, emits
      invalid reference
      GameEvent#HIT_GROUND
      , then calls Entity.onLanding(). Otherwise, if heightDifference is negative, it subtracts that value from Entity.fallDistance.
      Mappings:
      Namespace Name Mixin selector
      named fall Lnet/minecraft/entity/Entity;fall(DZLnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V
      intermediary method_5623 Lnet/minecraft/class_1297;method_5623(DZLnet/minecraft/class_2680;Lnet/minecraft/class_2338;)V
      official a Lbsw;a(DZLdse;Liz;)V
    • canAvoidTraps

      public boolean canAvoidTraps()
      Returns whether the entity cannot trigger pressure plates or tripwires.

      BatEntity is the only entity in vanilla that can avoid traps.

      Overrides:
      canAvoidTraps in class Entity
      Returns:
      whether the entity cannot trigger pressure plates or tripwires
      Mappings:
      Namespace Name Mixin selector
      named canAvoidTraps Lnet/minecraft/entity/Entity;canAvoidTraps()Z
      intermediary method_5696 Lnet/minecraft/class_1297;method_5696()Z
      official r_ Lbsw;r_()Z
    • damage

      public boolean damage(DamageSource source, float amount)
      Applies a damage to this entity. The exact implementation differs between subclasses.

      invalid reference
      LivingEntity
      has health value, and damaging the entity decreases it. This also handles shields, extra damage to helmets for falling blocks, setting the attacker, playing hurt sound, etc.

      Some entities like

      invalid reference
      ItemEntity
      also have health value, which the overridden method decrements. There also exist several entities, like EndCrystalEntity, where any damage discards the entity (perhaps with an explosion).

      If this is overridden, it must check the result of Entity.isInvulnerableTo(net.minecraft.entity.damage.DamageSource) and return early.

      Overrides:
      damage in class LivingEntity
      Returns:
      whether the entity was actually damaged
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named damage Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z
      intermediary method_5643 Lnet/minecraft/class_1297;method_5643(Lnet/minecraft/class_1282;F)Z
      official a Lbsw;a(Lbrp;F)Z
    • readCustomDataFromNbt

      public void readCustomDataFromNbt(NbtCompound nbt)
      Reads custom data from nbt. Subclasses have to implement this.

      NBT is a storage format; therefore, a data from NBT is loaded to an entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the entity.

      nbt might not have all expected keys, or might have a key whose value does not meet the requirement (such as the type or the range). This method should fall back to a reasonable default value instead of throwing an exception.

      Overrides:
      readCustomDataFromNbt in class MobEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named readCustomDataFromNbt Lnet/minecraft/entity/Entity;readCustomDataFromNbt(Lnet/minecraft/nbt/NbtCompound;)V
      intermediary method_5749 Lnet/minecraft/class_1297;method_5749(Lnet/minecraft/class_2487;)V
      official a Lbsw;a(Lus;)V
    • writeCustomDataToNbt

      public void writeCustomDataToNbt(NbtCompound nbt)
      Writes custom data to nbt. Subclasses have to implement this.

      NBT is a storage format; therefore, a data from NBT is loaded to an entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the entity.

      Overrides:
      writeCustomDataToNbt in class MobEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named writeCustomDataToNbt Lnet/minecraft/entity/Entity;writeCustomDataToNbt(Lnet/minecraft/nbt/NbtCompound;)V
      intermediary method_5652 Lnet/minecraft/class_1297;method_5652(Lnet/minecraft/class_2487;)V
      official b Lbsw;b(Lus;)V
    • canSpawn

      public static boolean canSpawn(EntityType<BatEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random)
      Mappings:
      Namespace Name Mixin selector
      named canSpawn Lnet/minecraft/entity/passive/BatEntity;canSpawn(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/WorldAccess;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)Z
      intermediary method_20661 Lnet/minecraft/class_1420;method_20661(Lnet/minecraft/class_1299;Lnet/minecraft/class_1936;Lnet/minecraft/class_3730;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)Z
      official b Lcfc;b(Lbtc;Ldcb;Lbtv;Liz;Lazh;)Z
    • isTodayAroundHalloween

      private static boolean isTodayAroundHalloween()
      Mappings:
      Namespace Name Mixin selector
      named isTodayAroundHalloween Lnet/minecraft/entity/passive/BatEntity;isTodayAroundHalloween()Z
      intermediary method_6451 Lnet/minecraft/class_1420;method_6451()Z
      official y Lcfc;y()Z
    • updateAnimations

      private void updateAnimations()
      Mappings:
      Namespace Name Mixin selector
      named updateAnimations Lnet/minecraft/entity/passive/BatEntity;updateAnimations()V
      intermediary method_54758 Lnet/minecraft/class_1420;method_54758()V
      official gm Lcfc;gm()V