Class EntityArrayList

java.lang.Object
java.util.AbstractCollection<net.minecraft.world.entity.Entity>
java.util.AbstractList<net.minecraft.world.entity.Entity>
java.util.ArrayList<net.minecraft.world.entity.Entity>
dev.latvian.mods.kubejs.player.EntityArrayList
All Implemented Interfaces:
DataSenderKJS, MessageSenderKJS, Serializable, Cloneable, Iterable<net.minecraft.world.entity.Entity>, Collection<net.minecraft.world.entity.Entity>, List<net.minecraft.world.entity.Entity>, RandomAccess, SequencedCollection<net.minecraft.world.entity.Entity>

@RemapPrefixForJS("kjs$") public class EntityArrayList extends ArrayList<net.minecraft.world.entity.Entity> implements MessageSenderKJS, DataSenderKJS
See Also:
  • Field Details

    • ALWAYS_TRUE_PREDICATE

      public static final Predicate<net.minecraft.world.entity.Entity> ALWAYS_TRUE_PREDICATE
  • Constructor Details

    • EntityArrayList

      public EntityArrayList(int size)
    • EntityArrayList

      public EntityArrayList(Iterable<? extends net.minecraft.world.entity.Entity> entities)
    • EntityArrayList

      @Deprecated(forRemoval=true, since="7.2") public EntityArrayList(net.minecraft.world.level.Level level, Iterable<? extends net.minecraft.world.entity.Entity> entities)
      Deprecated, for removal: This API element is subject to removal in a future version.
      polyfill for when EntityArrayList needed a Level, will be removed in a future version!
  • Method Details

    • addAllIterable

      public void addAllIterable(Iterable<? extends net.minecraft.world.entity.Entity> entities)
    • kjs$getName

      public net.minecraft.network.chat.Component kjs$getName()
      Specified by:
      kjs$getName in interface MessageSenderKJS
    • kjs$getDisplayName

      public net.minecraft.network.chat.Component kjs$getDisplayName()
      Specified by:
      kjs$getDisplayName in interface MessageSenderKJS
    • kjs$tell

      @Info(value="Sends a message in chat to every entity in the list.", params=@Param(name="message",value="A text component. It may be a string, which will be implicitly wrapped into a text component.")) public void kjs$tell(net.minecraft.network.chat.Component message)
      Specified by:
      kjs$tell in interface MessageSenderKJS
    • kjs$setStatusMessage

      public void kjs$setStatusMessage(net.minecraft.network.chat.Component message)
      Specified by:
      kjs$setStatusMessage in interface MessageSenderKJS
    • kjs$runCommand

      @Info(value="Each entity in the list runs the specified console command with their permission level.", params=@Param(name="command",value="The console command. Slash at the beginning is optional.")) public void kjs$runCommand(String command)
      Specified by:
      kjs$runCommand in interface MessageSenderKJS
    • kjs$runCommandSilent

      @Info(value="Each entity in the list runs the specified console command with their permission level. The command won\'t output any logs in chat nor console", params=@Param(name="command",value="The console command. Slash at the beginning is optional.")) public void kjs$runCommandSilent(String command)
      Specified by:
      kjs$runCommandSilent in interface MessageSenderKJS
    • kjs$setActivePostShader

      public void kjs$setActivePostShader(@Nullable @Nullable net.minecraft.resources.ResourceLocation id)
      Specified by:
      kjs$setActivePostShader in interface MessageSenderKJS
    • kill

      @Info("Kills every entity in the list.") public void kill()
    • playSound

      @Info("Plays a sound from each entity in the list, unless the entity is silent.") public void playSound(net.minecraft.sounds.SoundEvent id, float volume, float pitch)
    • playSound

      @Info("Plays a sound from each entity in the list, unless the entity is silent.") public void playSound(net.minecraft.sounds.SoundEvent id)
    • filter

      @Info(value="Filters the entity list by passing each entity through a given predicate.\nEntities that pass the predicate will end up in the resulting entity list.\n", params=@Param(name="filter",value="The predicate - a function that takes an argument of `Entity` and returns a boolean.")) public EntityArrayList filter(Predicate<net.minecraft.world.entity.Entity> filter)
    • filterList

      @Info(value="Filters the entity list by passing each entity through all predicates in provided list.\nEntities that pass at least one of the predicates will end up in the resulting entity list.\n", params=@Param(name="filterList",value="The list of predicates - functions that take one argument of `Entity` and return boolean values.")) public EntityArrayList filterList(List<Predicate<net.minecraft.world.entity.Entity>> filterList)
    • filterSelector

      @Info(value="Filters the entity list based on the provided `EntitySelector`.", params=@Param(name="selector",value="The entity selector. It may be a string representing the entity selector as seen in commands, such as `\'@e[distance=..25]\'`")) public EntityArrayList filterSelector(net.minecraft.commands.arguments.selector.EntitySelector selector)
    • filterDistance

      @Info(value="Filters the entity list based on distance to the given point.\nEntities that are closer than `distance` away from the point specified by `x`, `y` and `z` coordinates will end up in the resulting list.\n",params={@Param(name="x",value="The `x` coordinate of the point."),@Param(name="y",value="The `y` coordinate of the point."),@Param(name="z",value="The `z` coordinate of the point."),@Param(name="distance",value="The maximum distance of entities from the point.")}) public EntityArrayList filterDistance(double x, double y, double z, double distance)
    • filterDistance

      @Info(value="Filters the entity list based on distance to the given block position.\nEntities that are closer than `distance` away from the center of the block will end up in the resulting list.\n",params={@Param(name="pos",value="The `BlockPos` - that is the center of the block at specified position. It can be a 3-element array of integers, such as `[64, 25, 39]`."),@Param(name="distance",value="The maximum distance of entities from the point.")}) public EntityArrayList filterDistance(net.minecraft.core.BlockPos pos, double distance)
    • filterPlayers

      @Info("Results in an entity list containing only players.") public EntityArrayList filterPlayers()
    • filterItems

      @Info("Results in an entity list containing only item entities.") public EntityArrayList filterItems()
    • filterType

      @Info(value="Filters the entity list based on the type of the entity. Only entities whose type is equal to the provided one will end up in the resulting list.", params=@Param(name="type",value="The entity type. It may be a string representing an entity ID, like `\'minecraft:creeper\'`.")) public EntityArrayList filterType(net.minecraft.world.entity.EntityType<?> type)
    • kjs$sendData

      @Info(value="Sends NBT data to every player in the list.",params={@Param(name="channel",value="String. Represents the network channel."),@Param(name="data",value="The NBT compound tag containing data to send. May be `null`.\nIt may be a JS object containing data or string representing stringified NBT.\n")}) public void kjs$sendData(String channel, @Nullable @Nullable net.minecraft.nbt.CompoundTag data)
      Specified by:
      kjs$sendData in interface DataSenderKJS
    • getFirst

      @Nullable @Info("Gets the first entity on the list, or `null` if the list is empty.") public @Nullable net.minecraft.world.entity.Entity getFirst()
      Specified by:
      getFirst in interface List<net.minecraft.world.entity.Entity>
      Specified by:
      getFirst in interface SequencedCollection<net.minecraft.world.entity.Entity>
      Overrides:
      getFirst in class ArrayList<net.minecraft.world.entity.Entity>