接口 IPlayerExtension

所有已知实现类:
FakePlayer, GameTestPlayer, Player, ServerPlayer

public interface IPlayerExtension
  • 方法详细资料

    • self

      private Player self()
    • isCloseEnough

      default boolean isCloseEnough(Entity entity, double dist)
      Utility check to see if the player is close enough to a target entity. Uses "eye-to-closest-corner" checks.
      参数:
      entity - The entity being checked against
      dist - The max distance allowed
      返回:
      If the eye-to-center distance between this player and the passed entity is less than dist.
      Implementation Note:
      This method inflates the bounding box by the pick radius, which differs from vanilla. But vanilla doesn't use the pick radius, the only entity with > 0 is AbstractHurtingProjectile.
    • openMenu

      default OptionalInt openMenu(MenuProvider menuProvider, BlockPos pos)
      Request to open a GUI on the client, from the server

      Refer to IMenuTypeExtension.create(IContainerFactory) for creating a MenuType that can consume the extra data sent to the client by this method.

      Use FriendlyByteBuf.readBlockPos() to read the position you pass to this method.

      参数:
      menuProvider - A supplier of container properties including the registry name of the container
      pos - A block pos, which will be encoded into the additional data for this request, after data written by IMenuProviderExtension.writeClientSideData(AbstractContainerMenu, RegistryFriendlyByteBuf).
    • openMenu

      default OptionalInt openMenu(MenuProvider menuProvider, Consumer<RegistryFriendlyByteBuf> extraDataWriter)
      Request to open a GUI on the client, from the server

      Refer to IMenuTypeExtension.create(IContainerFactory) for creating a MenuType that can consume the extra data sent to the client by this method.

      The maximum size for #extraDataWriter is 32600 bytes.

      参数:
      menuProvider - A supplier of container properties including the registry name of the container
      extraDataWriter - Consumer to write any additional data the GUI needs. This data is written after IMenuProviderExtension.writeClientSideData(AbstractContainerMenu, RegistryFriendlyByteBuf).
      返回:
      The window ID of the opened GUI, or empty if the GUI could not be opened
    • mayFly

      default boolean mayFly()
      Determine whether a player is allowed creative flight via game mode or attribute.

      Modders are discouraged from setting Abilities.mayfly directly.

      返回:
      true when creative flight is available
      另请参阅:
    • isFakePlayer

      default boolean isFakePlayer()
      返回 whether this player is a fake player, such as FakePlayer
      返回:
      whether this player is a fake player, such as FakePlayer