Class MarkerEntity

java.lang.Object
net.minecraft.entity.Entity
net.minecraft.entity.MarkerEntity
All Implemented Interfaces:
DataTracked, ScoreHolder, Nameable, EntityLike

public class MarkerEntity extends Entity
Mappings:
Namespace Name
named net/minecraft/entity/MarkerEntity
intermediary net/minecraft/class_6335
official bwg
  • Field Details

    • DATA_KEY

      private static final String DATA_KEY
      The name of the compound tag that stores the marker's custom data.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named DATA_KEY Lnet/minecraft/entity/MarkerEntity;DATA_KEY:Ljava/lang/String;
      intermediary field_33457 Lnet/minecraft/class_6335;field_33457:Ljava/lang/String;
      official a Lbwg;a:Ljava/lang/String;
    • data

      private NbtCompound data
      Mappings:
      Namespace Name Mixin selector
      named data Lnet/minecraft/entity/MarkerEntity;data:Lnet/minecraft/nbt/NbtCompound;
      intermediary field_33458 Lnet/minecraft/class_6335;field_33458:Lnet/minecraft/class_2487;
      official b Lbwg;b:Lux;
  • Constructor Details

    • MarkerEntity

      public MarkerEntity(EntityType<?> 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> Lbvj;<init>(Lbvq;Ldhh;)V
  • Method Details

    • 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 h Lbvj;h()V
    • initDataTracker

      protected void initDataTracker(DataTracker.Builder builder)
      Initializes data tracker.
      Specified by:
      initDataTracker in class Entity
      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 Lbvj;a(Lalg$a;)V
    • readCustomDataFromNbt

      protected 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 Lbvj;a(Lux;)V
    • writeCustomDataToNbt

      protected 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 Lbvj;b(Lux;)V
    • createSpawnPacket

      public Packet<ClientPlayPacketListener> createSpawnPacket(EntityTrackerEntry entityTrackerEntry)
      Returns a packet to notify the clients of the entity's spawning.
      Overrides:
      createSpawnPacket in class Entity
      Returns:
      a packet to notify the clients of the entity's spawning
      API Note:
      Subclasses should return new EntitySpawnS2CPacket(this), unless they use a custom spawning packet.
      Mappings:
      Namespace Name Mixin selector
      named createSpawnPacket Lnet/minecraft/entity/Entity;createSpawnPacket(Lnet/minecraft/server/network/EntityTrackerEntry;)Lnet/minecraft/network/packet/Packet;
      intermediary method_18002 Lnet/minecraft/class_1297;method_18002(Lnet/minecraft/class_3231;)Lnet/minecraft/class_2596;
      official a Lbvj;a(Lasf;)Laac;
    • canAddPassenger

      protected boolean canAddPassenger(Entity passenger)
      Returns whether entity can ride this entity.

      Returning false causes other entities to be unable to ride this entity. For example, BoatEntity uses this to restrict how many passengers can ride the same boat (2 for normal, 1 for chest boat).

      This is the opposite of Entity.canStartRiding(net.minecraft.entity.Entity).

      Overrides:
      canAddPassenger in class Entity
      Returns:
      whether entity can ride this entity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named canAddPassenger Lnet/minecraft/entity/Entity;canAddPassenger(Lnet/minecraft/entity/Entity;)Z
      intermediary method_5818 Lnet/minecraft/class_1297;method_5818(Lnet/minecraft/class_1297;)Z
      official r Lbvj;r(Lbvj;)Z
    • couldAcceptPassenger

      protected boolean couldAcceptPassenger()
      Returns true if this entity supports passengers in general.
      Overrides:
      couldAcceptPassenger in class Entity
      Returns:
      true if this entity supports passengers in general
      Mappings:
      Namespace Name Mixin selector
      named couldAcceptPassenger Lnet/minecraft/entity/Entity;couldAcceptPassenger()Z
      intermediary method_48921 Lnet/minecraft/class_1297;method_48921()Z
      official bR Lbvj;bR()Z
    • addPassenger

      protected void addPassenger(Entity passenger)
      Adds passenger as a passenger. This should not be called normally; call Entity.startRiding(Entity) instead. (Note that the entity to pass and the entity to call are swapped in this case; entity.startRiding(vehicle) is the equivalent of vehicle.addPassenger(entity).)
      Overrides:
      addPassenger in class Entity
      Throws:
      IllegalStateException - when the method is called directly
      Mappings:
      Namespace Name Mixin selector
      named addPassenger Lnet/minecraft/entity/Entity;addPassenger(Lnet/minecraft/entity/Entity;)V
      intermediary method_5627 Lnet/minecraft/class_1297;method_5627(Lnet/minecraft/class_1297;)V
      official p Lbvj;p(Lbvj;)V
    • getPistonBehavior

      public PistonBehavior getPistonBehavior()
      Returns the behavior of the piston for this entity.

      This is PistonBehavior.NORMAL by default. AreaEffectCloudEntity, MarkerEntity, and marker ArmorStandEntity return PistonBehavior.IGNORE, causing the piston to not affect the entity's position. Other piston behaviors are inapplicable to entities, and treated like PistonBehavior.NORMAL.

      Overrides:
      getPistonBehavior in class Entity
      Returns:
      the behavior of the piston for this entity
      Mappings:
      Namespace Name Mixin selector
      named getPistonBehavior Lnet/minecraft/entity/Entity;getPistonBehavior()Lnet/minecraft/block/piston/PistonBehavior;
      intermediary method_5657 Lnet/minecraft/class_1297;method_5657()Lnet/minecraft/class_3619;
      official n_ Lbvj;n_()Leub;
    • 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 s_ Lbvj;s_()Z
    • damage

      public final boolean damage(ServerWorld world, 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

      invalid reference
      #isInvulnerableTo
      and return early.
      Specified by:
      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/server/world/ServerWorld;Lnet/minecraft/entity/damage/DamageSource;F)Z
      intermediary method_64397 Lnet/minecraft/class_1297;method_64397(Lnet/minecraft/class_3218;Lnet/minecraft/class_1282;F)Z
      official a Lbvj;a(Lash;Lbtz;F)Z