Class BatEntity

All Implemented Interfaces:
Attackable, Targeter, CommandOutput, Nameable, EntityLike

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

    • field_30268

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

      public static final int field_28637
      Mappings:
      Namespace Name Mixin selector
      official c Lbre;c:I
      intermediary field_28637 Lnet/minecraft/class_1420;field_28637:I
      named field_28637 Lnet/minecraft/entity/passive/BatEntity;field_28637:I
    • 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
      official d Lbre;d:Lacl;
      intermediary field_6728 Lnet/minecraft/class_1420;field_6728:Lnet/minecraft/class_2940;
      named BAT_FLAGS Lnet/minecraft/entity/passive/BatEntity;BAT_FLAGS:Lnet/minecraft/entity/data/TrackedData;
    • ROOSTING_FLAG

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

      private static final TargetPredicate CLOSE_PLAYER_PREDICATE
      Mappings:
      Namespace Name Mixin selector
      official bR Lbre;bR:Lbqk;
      intermediary field_18100 Lnet/minecraft/class_1420;field_18100:Lnet/minecraft/class_4051;
      named CLOSE_PLAYER_PREDICATE Lnet/minecraft/entity/passive/BatEntity;CLOSE_PLAYER_PREDICATE:Lnet/minecraft/entity/ai/TargetPredicate;
    • hangingPosition

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

    • BatEntity

      public BatEntity(EntityType<? extends BatEntity> type, World world)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lbfh;<init>(Lbfl;Lcmi;)V
      intermediary <init> Lnet/minecraft/class_1297;<init>(Lnet/minecraft/class_1299;Lnet/minecraft/class_1937;)V
      named <init> Lnet/minecraft/entity/Entity;<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)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
      official aN Lbfh;aN()Z
      intermediary method_5776 Lnet/minecraft/class_1297;method_5776()Z
      named isFlappingWings Lnet/minecraft/entity/Entity;isFlappingWings()Z
    • initDataTracker

      protected void initDataTracker()
      Initializes data tracker.
      Overrides:
      initDataTracker in class MobEntity
      Mappings:
      Namespace Name Mixin selector
      official a_ Lbfh;a_()V
      intermediary method_5693 Lnet/minecraft/class_1297;method_5693()V
      named initDataTracker Lnet/minecraft/entity/Entity;initDataTracker()V
    • getSoundVolume

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

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

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

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

      protected SoundEvent getDeathSound()
      Overrides:
      getDeathSound in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      official x_ Lbfx;x_()Lamq;
      intermediary method_6002 Lnet/minecraft/class_1309;method_6002()Lnet/minecraft/class_3414;
      named getDeathSound Lnet/minecraft/entity/LivingEntity;getDeathSound()Lnet/minecraft/sound/SoundEvent;
    • 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
      official bn Lbfh;bn()Z
      intermediary method_5810 Lnet/minecraft/class_1297;method_5810()Z
      named isPushable Lnet/minecraft/entity/Entity;isPushable()Z
    • pushAway

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

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

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

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

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

      public void tick()
      Ticks this entity.
      Overrides:
      tick in class MobEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official l Lbfh;l()V
      intermediary method_5773 Lnet/minecraft/class_1297;method_5773()V
      named tick Lnet/minecraft/entity/Entity;tick()V
    • mobTick

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

      protected Entity.MoveEffect getMoveEffect()
      Returns the possible effect(s) of an entity moving.
      Overrides:
      getMoveEffect in class Entity
      Mappings:
      Namespace Name Mixin selector
      official aQ Lbfh;aQ()Lbfh$b;
      intermediary method_33570 Lnet/minecraft/class_1297;method_33570()Lnet/minecraft/class_1297$class_5799;
      named getMoveEffect Lnet/minecraft/entity/Entity;getMoveEffect()Lnet/minecraft/entity/Entity$MoveEffect;
    • 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
      Mappings:
      Namespace Name Mixin selector
      official a Lbfh;a(DZLdbq;Lgt;)V
      intermediary method_5623 Lnet/minecraft/class_1297;method_5623(DZLnet/minecraft/class_2680;Lnet/minecraft/class_2338;)V
      named fall Lnet/minecraft/entity/Entity;fall(DZLnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)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
      official cq Lbfh;cq()Z
      intermediary method_5696 Lnet/minecraft/class_1297;method_5696()Z
      named canAvoidTraps Lnet/minecraft/entity/Entity;canAvoidTraps()Z
    • damage

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

      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 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
      official a Lbfh;a(Lbem;F)Z
      intermediary method_5643 Lnet/minecraft/class_1297;method_5643(Lnet/minecraft/class_1282;F)Z
      named damage Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z
    • readCustomDataFromNbt

      public void readCustomDataFromNbt(NbtCompound nbt)
      Reads custom data from nbt. Subclasses has 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
      official a Lbfh;a(Lre;)V
      intermediary method_5749 Lnet/minecraft/class_1297;method_5749(Lnet/minecraft/class_2487;)V
      named readCustomDataFromNbt Lnet/minecraft/entity/Entity;readCustomDataFromNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • writeCustomDataToNbt

      public void writeCustomDataToNbt(NbtCompound nbt)
      Writes custom data to nbt. Subclasses has 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
      official b Lbfh;b(Lre;)V
      intermediary method_5652 Lnet/minecraft/class_1297;method_5652(Lnet/minecraft/class_2487;)V
      named writeCustomDataToNbt Lnet/minecraft/entity/Entity;writeCustomDataToNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • canSpawn

      public static boolean canSpawn(EntityType<BatEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random)
      Mappings:
      Namespace Name Mixin selector
      official b Lbre;b(Lbfl;Lcmj;Lbgb;Lgt;Lapo;)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
      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
    • isTodayAroundHalloween

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

      protected float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions)
      Overrides:
      getActiveEyeHeight in class LivingEntity
      Mappings:
      Namespace Name Mixin selector
      official b Lbfx;b(Lbgj;Lbfi;)F
      intermediary method_18394 Lnet/minecraft/class_1309;method_18394(Lnet/minecraft/class_4050;Lnet/minecraft/class_4048;)F
      named getActiveEyeHeight Lnet/minecraft/entity/LivingEntity;getActiveEyeHeight(Lnet/minecraft/entity/EntityPose;Lnet/minecraft/entity/EntityDimensions;)F