BlockEntity
Link to blockentity
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.block.entity.BlockEntity;
Extending CapabilityProvider<BlockEntity>
Link to extending-capabilityproviderblockentity
BlockEntity extends CapabilityProvider<BlockEntity>. That means all methods available in CapabilityProvider<BlockEntity> are also available in BlockEntity
使用方式
Link to 使用方式
Name: getBlockPos
Return Type: BlockPos
ZenScript Copy// BlockEntity.getBlockPos() as BlockPos
myBlockEntity.getBlockPos();
Name: getBlockState
Return Type: BlockState
ZenScript Copy// BlockEntity.getBlockState() as BlockState
myBlockEntity.getBlockState();
Name: getLevel
Return Type: Level?
ZenScript Copy// BlockEntity.getLevel() as Level?
myBlockEntity.getLevel();
Name: getRegistryName
Return Type: ResourceLocation
ZenScript Copy// BlockEntity.getRegistryName() as ResourceLocation
myBlockEntity.getRegistryName();
Name: hasLevel
Return Type: boolean
ZenScript Copy// BlockEntity.hasLevel() as boolean
myBlockEntity.hasLevel();
名称 | 类型 | 可获得 | 可设置 |
---|---|---|---|
名称 blockPos | 类型 BlockPos | 可获得 true | 可设置 false |
名称 blockState | 类型 BlockState | 可获得 true | 可设置 false |
名称 data | 类型 IData #数据 | 可获得 true | 可设置 true |
名称 hasLevel | 类型 布尔值 | 可获得 true | 可设置 false |
名称 level | 类型 Level? | 可获得 true | 可设置 false |
名称 registryName | 类型 资源位置 | 可获得 true | 可设置 false |