Interface EntityKJS

All Superinterfaces:
MessageSenderKJS, ScriptTypeHolder, WithPersistentData
All Known Subinterfaces:
ClientPlayerKJS, ItemEntityKJS, ItemFrameEntityKJS, LivingEntityKJS, LocalClientPlayerKJS, PlayerKJS, ServerPlayerKJS
All Known Implementing Classes:
AbstractClientPlayerMixin, net.minecraft.world.entity.Entity, EntityMixin, ItemEntityMixin, ItemFrameEntityMixin, net.minecraft.world.entity.LivingEntity, LivingEntityMixin, LocalPlayerMixin, net.minecraft.world.entity.player.Player, PlayerMixin, ServerPlayerMixin

@RemapPrefixForJS("kjs$") public interface EntityKJS extends WithPersistentData, MessageSenderKJS, ScriptTypeHolder
  • Method Details

    • kjs$self

      @HideFromJS default net.minecraft.world.entity.Entity kjs$self()
    • kjs$getLevel

      default net.minecraft.world.level.Level kjs$getLevel()
    • kjs$getServer

      @Nullable default @Nullable net.minecraft.server.MinecraftServer kjs$getServer()
    • kjs$getType

      default String kjs$getType()
    • kjs$isSelf

      @ThisIs(classNames="net.minecraft.client.player.LocalPlayer") @Info("Checks, whether the entity is a reference to yourself - that is - the client player you are controlling.") default boolean kjs$isSelf()
    • kjs$getProfile

      @Nullable @Info("If the entity is a player, gets the player\'s profile, otherwise returns `null`.") default @Nullable com.mojang.authlib.GameProfile kjs$getProfile()
    • kjs$getUsername

      @Info("Gets the entity\'s custom name, or entity ID if entity has no custom name.") default String kjs$getUsername()
    • kjs$getName

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

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

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

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

      @Info(value="Runs the specified console command with permission level of the entity. 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.")) default void kjs$runCommandSilent(String command)
      Specified by:
      kjs$runCommandSilent in interface MessageSenderKJS
    • kjs$isPlayer

      @ThisIs(net.minecraft.world.entity.player.Player.class) @Info("Checks if the entity is a player entity.") default boolean kjs$isPlayer()
    • kjs$isServerPlayer

      @ThisIs(net.minecraft.server.level.ServerPlayer.class) @Info("Checks if the entity is a server-side player.") default boolean kjs$isServerPlayer()
    • kjs$isClientPlayer

      @ThisIs(classNames="net.minecraft.client.player.AbstractClientPlayer") @Info("Checks if the entity is a client-side player.") default boolean kjs$isClientPlayer()
    • kjs$getItem

      @Nullable @Info("Gets the item stack corresponding to either:\n- the item contained in the item entity,\n- the item in the item frame.\nWill be `null` if the entity is neither an item entity nor an item frame.\n") default @Nullable net.minecraft.world.item.ItemStack kjs$getItem()
    • kjs$isFrame

      @ThisIs(net.minecraft.world.entity.decoration.ItemFrame.class) @Info("Checks if the entity is an item frame entity.") default boolean kjs$isFrame()
    • kjs$isItem

      @ThisIs(net.minecraft.world.entity.item.ItemEntity.class) @Info("Checks if the entity is an item entity.") default boolean kjs$isItem()
    • kjs$isLiving

      @ThisIs(net.minecraft.world.entity.LivingEntity.class) @Info("Checks if the entity is a `LivingEntity`.") default boolean kjs$isLiving()
    • kjs$isMonster

      @Info("Checks if the entity is a monster.") default boolean kjs$isMonster()
    • kjs$isAnimal

      @Info("Checks if the entity is an animal.") default boolean kjs$isAnimal()
    • kjs$isAmbientCreature

      @Info("Checks if the entity is an ambient creature.") default boolean kjs$isAmbientCreature()
    • kjs$isWaterCreature

      @Info("Checks if the entity is a water creature.") default boolean kjs$isWaterCreature()
    • kjs$isPeacefulCreature

      @Info("Checks if the entity is a peaceful creature (not a monster).") default boolean kjs$isPeacefulCreature()
    • kjs$setX

      default void kjs$setX(double x)
    • kjs$setY

      default void kjs$setY(double y)
    • kjs$setZ

      default void kjs$setZ(double z)
    • kjs$getMotionX

      default double kjs$getMotionX()
    • kjs$setMotionX

      default void kjs$setMotionX(double x)
    • kjs$getMotionY

      default double kjs$getMotionY()
    • kjs$setMotionY

      default void kjs$setMotionY(double y)
    • kjs$getMotionZ

      default double kjs$getMotionZ()
    • kjs$setMotionZ

      default void kjs$setMotionZ(double z)
    • kjs$teleportTo

      @Info(value="Teleports an entity to specified coordinates.",params={@Param(name="x",value="The `x` target coordinate."),@Param(name="y",value="The `y` target coordinate."),@Param(name="z",value="The `z` target coordinate.")}) default void kjs$teleportTo(double x, double y, double z) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • kjs$teleportToLevel

      @Info(value="Teleports an entity to a specified `ServerLevel`, to specified coordinates and rotation.",params={@Param(name="level",value="A `ServerLevel` to teleport the entity to."),@Param(name="x",value="The `x` target coordinate."),@Param(name="y",value="The `y` target coordinate."),@Param(name="z",value="The `z` target coordinate."),@Param(name="yaw",value="The entity\'s target yaw."),@Param(name="pitch",value="The entity\'s target pitch.")}) default boolean kjs$teleportToLevel(net.minecraft.server.level.ServerLevel level, double x, double y, double z, float yaw, float pitch) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • kjs$teleportTo

      @Info(value="Teleports an entity to a dimension of specified ID, to specified coordinates and rotation.",params={@Param(name="dimension",value="A `ResourceLocation` of the target dimension. It can be a string representing the dimension ID."),@Param(name="x",value="The `x` target coordinate."),@Param(name="y",value="The `y` target coordinate."),@Param(name="z",value="The `z` target coordinate."),@Param(name="yaw",value="The entity\'s target yaw."),@Param(name="pitch",value="The entity\'s target pitch.")}) default boolean kjs$teleportTo(net.minecraft.resources.ResourceLocation dimension, double x, double y, double z, float yaw, float pitch) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • kjs$teleportTo

      @Info(value="Teleports an entity to a dimension of specified ID, to specified coordinates and rotation.",params={@Param(name="x",value="The `x` target coordinate."),@Param(name="y",value="The `y` target coordinate."),@Param(name="z",value="The `z` target coordinate."),@Param(name="yaw",value="The entity\'s target yaw."),@Param(name="pitch",value="The entity\'s target pitch.")}) default void kjs$teleportTo(double x, double y, double z, float yaw, float pitch) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • kjs$setPosition

      default void kjs$setPosition(LevelBlock block)
    • kjs$setPositionAndRotation

      default void kjs$setPositionAndRotation(double x, double y, double z, float yaw, float pitch)
    • kjs$setPosition

      default void kjs$setPosition(double x, double y, double z)
    • kjs$setRotation

      default void kjs$setRotation(float yaw, float pitch)
    • kjs$getPassengers

      @Info("Gets a list of all passengers of the entity.") default EntityArrayList kjs$getPassengers()
    • kjs$getTeamId

      @Deprecated @Info("Replaced by `entity.getTeamName()`") default String kjs$getTeamId()
      Deprecated.
    • kjs$getTeamName

      @Info("Gets the name of the team entity is in, or `\'\'` (empty string) if the entity is not part of any team") default String kjs$getTeamName()
    • kjs$isOnScoreboardTeam

      @Info("Checks, whether the entity is part of any team.") default boolean kjs$isOnScoreboardTeam()
    • kjs$isOnScoreboardTeam

      @Info(value="Checks, whether the entity is part of a team called `teamName`.", params=@Param(name="teamName",value="The name of the team to check.")) default boolean kjs$isOnScoreboardTeam(String teamName)
    • kjs$getFacing

      @Info("Gets the entity\'s facing direction.\nIf the entity faces more than 45 degrees up or down, the resulting facing direction is respectively `up` or `down`.\nOtherwise, the resulting facing direction is determined by whichever cardinal direction is closer to entity\'s yaw.\n") default net.minecraft.core.Direction kjs$getFacing()
    • kjs$getBlock

      @Info("Gets a block at the position of the entity.") default LevelBlock kjs$getBlock()
    • kjs$getNbt

      default net.minecraft.nbt.CompoundTag kjs$getNbt()
    • kjs$setNbt

      default void kjs$setNbt(@Nullable @Nullable net.minecraft.nbt.CompoundTag nbt)
    • kjs$mergeNbt

      default net.minecraft.world.entity.Entity kjs$mergeNbt(@Nullable @Nullable net.minecraft.nbt.CompoundTag tag)
    • kjs$spawn

      default void kjs$spawn()
    • kjs$damage

      @Info(value="Damages an entity by a given amount of HP dealing generic damage.", params=@Param(name="hp",value="The amount of damage to deal.")) default boolean kjs$damage(float hp)
    • kjs$damage

      @Info(value="Damages an entity by a given amount of HP dealing a specific type of damage.",params={@Param(name="hp",value="The amount of damage to deal."),@Param(name="source",value="The damage source. It may be a string specifying a damage source, like `\'minecraft:cramming\'`.")}) default boolean kjs$damage(float hp, net.minecraft.world.damagesource.DamageSource source)
    • kjs$attack

      @Info("Replaced by `entity.damage(hp)`") @Deprecated default boolean kjs$attack(float hp)
      Deprecated.
    • kjs$attack

      @Info("Replaced by `entity.damage(hp, damageSource)`") @Deprecated default boolean kjs$attack(net.minecraft.world.damagesource.DamageSource source, float hp)
      Deprecated.
    • kjs$distanceToBlock

      @Info("Measures the distance of entity to block at specified `BlockPos`.") default double kjs$distanceToBlock(net.minecraft.core.BlockPos pos)
    • kjs$distanceToBlockSqr

      @Info("Measures the **square** of a distance of entity to the block at specified `BlockPos`.") default double kjs$distanceToBlockSqr(net.minecraft.core.BlockPos pos)
    • kjs$distanceTo

      @Info("Measures the distance of entity to the point at specified `x`, `y` and `z`.") default double kjs$distanceTo(double x, double y, double z)
    • kjs$distanceTo

      @Info("Measures the distance of entity to the point at specified 3D position vector.") default double kjs$distanceTo(net.minecraft.world.phys.Vec3 position)
    • kjs$getDistanceSq

      @Deprecated @Info("Replaced by `entity.distanceToSqr(x, y, z)`.") default double kjs$getDistanceSq(double x, double y, double z)
      Deprecated.
    • kjs$getDistance

      @Deprecated @Info("Replaced by `entity.distanceTo(x, y, z)`.") default double kjs$getDistance(double x, double y, double z)
      Deprecated.
    • kjs$getDistanceSq

      @Deprecated @Info("Replaced by `entity.distanceToBlockSqr(pos)`.") default double kjs$getDistanceSq(net.minecraft.core.BlockPos pos)
      Deprecated.
    • kjs$rayTrace

      default KubeRayTraceResult kjs$rayTrace(double distance, boolean fluids)
    • kjs$rayTrace

      default KubeRayTraceResult kjs$rayTrace(double distance)
    • kjs$rayTraceEntity

      @Nullable default @Nullable net.minecraft.world.entity.Entity kjs$rayTraceEntity(double distance, Predicate<net.minecraft.world.entity.Entity> filter)
    • kjs$getRawPersistentData

      @Nullable @HideFromJS default @Nullable net.minecraft.nbt.CompoundTag kjs$getRawPersistentData()
    • kjs$setRawPersistentData

      @HideFromJS default void kjs$setRawPersistentData(@Nullable @Nullable net.minecraft.nbt.CompoundTag tag)
    • kjs$getScriptType

      default ScriptType kjs$getScriptType()
      Specified by:
      kjs$getScriptType in interface ScriptTypeHolder