Class BlockAttachedEntity

java.lang.Object
net.minecraft.entity.Entity
net.minecraft.entity.decoration.BlockAttachedEntity
All Implemented Interfaces:
DataTracked, ScoreHolder, CommandOutput, Nameable, EntityLike
Direct Known Subclasses:
AbstractDecorationEntity, LeashKnotEntity

public abstract class BlockAttachedEntity extends Entity
Mappings:
Namespace Name
named net/minecraft/entity/decoration/BlockAttachedEntity
intermediary net/minecraft/class_9691
official cix
  • Field Details

    • LOGGER

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/entity/decoration/BlockAttachedEntity;LOGGER:Lorg/slf4j/Logger;
      intermediary field_51590 Lnet/minecraft/class_9691;field_51590:Lorg/slf4j/Logger;
      official c Lcix;c:Lorg/slf4j/Logger;
    • attachCheckTimer

      private int attachCheckTimer
      Mappings:
      Namespace Name Mixin selector
      named attachCheckTimer Lnet/minecraft/entity/decoration/BlockAttachedEntity;attachCheckTimer:I
      intermediary field_51591 Lnet/minecraft/class_9691;field_51591:I
      official d Lcix;d:I
    • attachedBlockPos

      protected BlockPos attachedBlockPos
      Mappings:
      Namespace Name Mixin selector
      named attachedBlockPos Lnet/minecraft/entity/decoration/BlockAttachedEntity;attachedBlockPos:Lnet/minecraft/util/math/BlockPos;
      intermediary field_51589 Lnet/minecraft/class_9691;field_51589:Lnet/minecraft/class_2338;
      official b Lcix;b:Ljd;
  • Constructor Details

    • BlockAttachedEntity

      protected BlockAttachedEntity(EntityType<? extends BlockAttachedEntity> 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> Lbsr;<init>(Lbsx;Ldcw;)V
    • BlockAttachedEntity

      protected BlockAttachedEntity(EntityType<? extends BlockAttachedEntity> type, World world, BlockPos attachedBlockPos)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/entity/decoration/BlockAttachedEntity;<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V
      intermediary <init> Lnet/minecraft/class_9691;<init>(Lnet/minecraft/class_1299;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)V
      official <init> Lcix;<init>(Lbsx;Ldcw;Ljd;)V
  • Method Details

    • updateAttachmentPosition

      protected abstract void updateAttachmentPosition()
      Mappings:
      Namespace Name Mixin selector
      named updateAttachmentPosition Lnet/minecraft/entity/decoration/BlockAttachedEntity;updateAttachmentPosition()V
      intermediary method_6895 Lnet/minecraft/class_9691;method_6895()V
      official p Lcix;p()V
    • tick

      public void tick()
      Ticks this entity.
      Overrides:
      tick in class Entity
      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 Entity.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 Lbsr;l()V
    • canStayAttached

      public abstract boolean canStayAttached()
      Mappings:
      Namespace Name Mixin selector
      named canStayAttached Lnet/minecraft/entity/decoration/BlockAttachedEntity;canStayAttached()Z
      intermediary method_6888 Lnet/minecraft/class_9691;method_6888()Z
      official s Lcix;s()Z
    • canHit

      public boolean canHit()
      Returns whether the entity can be hit with a projectile or be targeted by the player crosshair.
      Overrides:
      canHit in class Entity
      Returns:
      whether the entity can be hit with a projectile or be targeted by the player crosshair
      Mappings:
      Namespace Name Mixin selector
      named canHit Lnet/minecraft/entity/Entity;canHit()Z
      intermediary method_5863 Lnet/minecraft/class_1297;method_5863()Z
      official bA Lbsr;bA()Z
    • handleAttack

      public boolean handleAttack(Entity attacker)
      Handles a player attacking the entity. This is called before damage(net.minecraft.entity.damage.DamageSource, float) and can be used to restrict players from attacking the entity by returning true.
      Overrides:
      handleAttack in class Entity
      Returns:
      whether to stop handling the attack
      See Also:
      API Note:
      For example, ArmorStandEntity checks whether the player can modify blocks at the entity's position.
      Mappings:
      Namespace Name Mixin selector
      named handleAttack Lnet/minecraft/entity/Entity;handleAttack(Lnet/minecraft/entity/Entity;)Z
      intermediary method_5698 Lnet/minecraft/class_1297;method_5698(Lnet/minecraft/class_1297;)Z
      official u Lbsr;u(Lbsr;)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 Entity
      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 Lbsr;a(Lbrk;F)Z
    • move

      public void move(MovementType movementType, Vec3d movement)
      Overrides:
      move in class Entity
      Mappings:
      Namespace Name Mixin selector
      named move Lnet/minecraft/entity/Entity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V
      intermediary method_5784 Lnet/minecraft/class_1297;method_5784(Lnet/minecraft/class_1313;Lnet/minecraft/class_243;)V
      official a Lbsr;a(Lbts;Lexc;)V
    • addVelocity

      public void addVelocity(double deltaX, double deltaY, double deltaZ)
      Overrides:
      addVelocity in class Entity
      Mappings:
      Namespace Name Mixin selector
      named addVelocity Lnet/minecraft/entity/Entity;addVelocity(DDD)V
      intermediary method_5762 Lnet/minecraft/class_1297;method_5762(DDD)V
      official j Lbsr;j(DDD)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.

      Specified by:
      writeCustomDataToNbt in class Entity
      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 Lbsr;b(Lub;)V
    • 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.

      Specified by:
      readCustomDataFromNbt in class Entity
      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 Lbsr;a(Lub;)V
    • onBreak

      public abstract void onBreak(@Nullable @Nullable Entity breaker)
      Mappings:
      Namespace Name Mixin selector
      named onBreak Lnet/minecraft/entity/decoration/BlockAttachedEntity;onBreak(Lnet/minecraft/entity/Entity;)V
      intermediary method_6889 Lnet/minecraft/class_9691;method_6889(Lnet/minecraft/class_1297;)V
      official b Lcix;b(Lbsr;)V
    • shouldSetPositionOnLoad

      protected boolean shouldSetPositionOnLoad()
      Overrides:
      shouldSetPositionOnLoad in class Entity
      Mappings:
      Namespace Name Mixin selector
      named shouldSetPositionOnLoad Lnet/minecraft/entity/Entity;shouldSetPositionOnLoad()Z
      intermediary method_5638 Lnet/minecraft/class_1297;method_5638()Z
      official bC Lbsr;bC()Z
    • setPosition

      public void setPosition(double x, double y, double z)
      Sets the position and refreshes the bounding box.

      This should be called after creating an instance of non-living entities. For living entities, Entity.refreshPositionAndAngles(net.minecraft.util.math.BlockPos, float, float) should be used instead.

      Overrides:
      setPosition in class Entity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named setPosition Lnet/minecraft/entity/Entity;setPosition(DDD)V
      intermediary method_5814 Lnet/minecraft/class_1297;method_5814(DDD)V
      official a_ Lbsr;a_(DDD)V
    • getAttachedBlockPos

      public BlockPos getAttachedBlockPos()
      Mappings:
      Namespace Name Mixin selector
      named getAttachedBlockPos Lnet/minecraft/entity/decoration/BlockAttachedEntity;getAttachedBlockPos()Lnet/minecraft/util/math/BlockPos;
      intermediary method_59940 Lnet/minecraft/class_9691;method_59940()Lnet/minecraft/class_2338;
      official t Lcix;t()Ljd;
    • onStruckByLightning

      public void onStruckByLightning(ServerWorld world, LightningEntity lightning)
      Called when the entity is struck by lightning. This sets the entity on fire and deals lightning damage by default; entities that do not take such damage should override this method to do nothing.
      Overrides:
      onStruckByLightning in class Entity
      Mappings:
      Namespace Name Mixin selector
      named onStruckByLightning Lnet/minecraft/entity/Entity;onStruckByLightning(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/LightningEntity;)V
      intermediary method_5800 Lnet/minecraft/class_1297;method_5800(Lnet/minecraft/class_3218;Lnet/minecraft/class_1538;)V
      official a Lbsr;a(Laqu;Lbtm;)V
    • calculateDimensions

      public void calculateDimensions()
      Calculates and sets the dimension (bounding box) of the entity and refreshes its position.
      Overrides:
      calculateDimensions in class Entity
      Mappings:
      Namespace Name Mixin selector
      named calculateDimensions Lnet/minecraft/entity/Entity;calculateDimensions()V
      intermediary method_18382 Lnet/minecraft/class_1297;method_18382()V
      official i_ Lbsr;i_()V