Class RenderOffsets

java.lang.Object
cn.nukkit.item.customitem.data.RenderOffsets

@PowerNukkitXOnly @Since("1.19.31-r1") public class RenderOffsets extends Object
RenderOffsets是设置 render_offsets 项目组件。可以设置参数来偏移物品的在不同视角下的呈现方式。

RenderOffsets is the component that sets the render_offsets item. Parameters can be set to offset the rendering of items in different views.

  • Field Details

  • Constructor Details

    • RenderOffsets

      public RenderOffsets(@Nullable Offset mainHandFirstPerson, @Nullable Offset mainHandThirdPerson, @Nullable Offset offHandFirstPerson, @Nullable Offset offHandThirdPerson)
      设置自定义物品在不同视角下的渲染偏移量

      Set rendering offsets for custom items at different viewpoints

      Parameters:
      mainHandFirstPerson - 设置第一人称主手物品的偏移量
      Set the offset of the first person main hand item
      mainHandThirdPerson - 设置第三人称主手物品的偏移量
      Set the offset of the third person main hand item
      offHandFirstPerson - 设置第一人称副手物品的偏移量
      Set the offset of the first person offhand item
      offHandThirdPerson - 设置第三人称副手物品的偏移量
      Set the offset of the third person offhand item
  • Method Details

    • scaleOffset

      public static RenderOffsets scaleOffset(double multiplier)
      以指定参数调整第一人称主手的scale偏移量

      Adjusts the scale offset of the first-person main hand with the specified multiplier

      Parameters:
      multiplier - 按照指定规模缩放物品,这只会影响scale,所以物品位置可能不正确
      Scaling the item to the specified scale multiplier number, which only affects the scale, so the item position may not be correct.
      Returns:
      the render offsets
    • scaleOffset

      public static RenderOffsets scaleOffset(int textureSize)
      按照指定的物品材质大小缩放为标准16x16像素物品显示

      Scale to a standard 16x16 pixel item display at the specified item texture size

      Parameters:
      textureSize - 指定物品材质的像素大小,只能为16的倍数
      Specify the pixel size of the item texture, which can only be a multiple of 16.
      Returns:
      the render offsets