Interface CustomBlock


public interface CustomBlock
继承这个类实现自定义方块,重写Block中的方法控制方块属性

Inherit this class to implement a custom block, override the methods in the Block to control the feature of the block.

  • Method Summary

    Modifier and Type
    Method
    Description
    double
    覆写该方法设置自定义方块的被挖掘所需要的时间(单位秒)
    该方法设置自定义方块的定义
    double
    覆写该方法设置自定义方块的摩擦因数
    default int
    该方法必须被覆写为使用接口的定义,请使用
    int
    覆写该方法设置自定义方块的吸收光的等级
    int
    覆写该方法设置自定义方块的发出光的等级
    default String
    该方法必须被覆写为使用接口的定义,请使用
    @NonNull String
    覆写该方法设置自定义方块的命名空间ID
    double
    覆写该方法设置自定义方块的爆炸抗性
    default boolean
     
    default Block
    Plugins do not need @Override
    default Block
    toCustomBlock(int meta)
    Plugins do not need @Override
    一般不需要被覆写,继承父类会提供
  • Method Details

    • getFrictionFactor

      double getFrictionFactor()
      覆写该方法设置自定义方块的摩擦因数

      @Override this method to set the friction factor of the custom block

    • getResistance

      double getResistance()
      覆写该方法设置自定义方块的爆炸抗性

      @Override this method to set the Explosive resistance of the custom block

    • getLightFilter

      int getLightFilter()
      覆写该方法设置自定义方块的吸收光的等级

      @Override this method to set the level of light absorption of the custom block

    • getLightLevel

      int getLightLevel()
      覆写该方法设置自定义方块的发出光的等级

      @Override this method to set the level of light emitted by the custom block

    • calculateBreakTime

      double calculateBreakTime()
      覆写该方法设置自定义方块的被挖掘所需要的时间(单位秒)

      @Override this method to set the amount of time (in seconds) it takes for a custom block to be dug

    • getNamespaceId

      @NonNull @NonNull String getNamespaceId()
      覆写该方法设置自定义方块的命名空间ID

      @Override this method to set the namespace ID of the custom block

    • toItem

      Item toItem()
      一般不需要被覆写,继承父类会提供

      Generally, it does not need to be @Override, extend from the parent class will provide

    • getDefinition

      CustomBlockDefinition getDefinition()
      该方法设置自定义方块的定义

      This method sets the definition of custom block

    • getId

      default int getId()
      该方法必须被覆写为使用接口的定义,请使用

      The method must be @Override to use the definition of the interface, please use the
      @Override
      public int getId() { return CustomBlock.super.getId(); }

    • getName

      default String getName()
      该方法必须被覆写为使用接口的定义,请使用

      The method must be @Override to use the definition of the interface, please use the
      @Override
      public String getName() { return CustomBlock.super.getName(); }

    • toCustomBlock

      default Block toCustomBlock()
      Plugins do not need @Override
      Returns:
      the block
    • toCustomBlock

      default Block toCustomBlock(int meta)
      Plugins do not need @Override
      Returns:
      the block
    • reverseSending

      default boolean reverseSending()
      Returns:
      是否反转自定义方块属性解析的顺序
      Whether to reverse the order of properties parsing