Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

BlockEntity

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.block.entity.BlockEntity;

Extends

BlockEntity extends CapabilityProvider<BlockEntity>.

Implements

BlockEntity implements the following interfaces:

ICapabilityProviderImpl<ICapabilityProviderImpl>,ICapabilityProvider

Undocumented Interfaces

IBlockEntityExtension,ICapabilitySerializable<CompoundTag>,INBTSerializable<Tag>

Members

Getter
script.zs
// BlockEntity.blockPos as BlockPos
myBlockEntity.blockPos

Return Type: BlockPos

blockPos() as BlockPos
script.zs
// BlockEntity.blockPos() as BlockPos;
myBlockEntity.blockPos();

Return Type: BlockPos

Getter
script.zs
// BlockEntity.blockState as BlockState
myBlockEntity.blockState

Return Type: BlockState

blockState() as BlockState
script.zs
// BlockEntity.blockState() as BlockState;
myBlockEntity.blockState();

Return Type: BlockState

Getter
script.zs
// BlockEntity.data as IData
myBlockEntity.data

Return Type: IData

Setter
script.zs
// BlockEntity.data = (data as IData);
myBlockEntity.data = myIData;

Parameters:

data Type: IData
data(data as IData)
script.zs
// BlockEntity.data(data as IData);
myBlockEntity.data(myIData);

Parameters:

data Type: IData
getCapability(cap as Capability<T>, side as Direction) as T?
Gets the capability for the given side.

Returns: The found capability or null.

script.zs
// BlockEntity.getCapability<T>(cap as Capability<T>, side as Direction) as T?;
myBlockEntity.getCapability<T>(Capabilities.ENERGY, <constant:minecraft:direction:north>);

Parameters:

cap Type: Capability<T> - The capability to get.
side Type: Direction - The side to get the capability from, can be null.

Return Type: T?

getCapability(cap as Capability<T>) as T?
Gets the capability.

Returns: The found capability or null.

script.zs
// BlockEntity.getCapability<T>(cap as Capability<T>) as T?;
myBlockEntity.getCapability<T>(Capabilities.ENERGY);

Parameters:

cap Type: Capability<T> - The capability to get.

Return Type: T?

Getter
script.zs
// BlockEntity.hasLevel as bool
myBlockEntity.hasLevel

Return Type: bool

hasLevel() as bool
script.zs
// BlockEntity.hasLevel() as bool;
myBlockEntity.hasLevel();

Return Type: bool

Getter
script.zs
// BlockEntity.level as Level
myBlockEntity.level

Return Type: Level

level() as Level
script.zs
// BlockEntity.level() as Level;
myBlockEntity.level();

Return Type: Level

Getter
script.zs
// BlockEntity.registryName as ResourceLocation
myBlockEntity.registryName

Return Type: ResourceLocation

registryName() as ResourceLocation
script.zs
// BlockEntity.registryName() as ResourceLocation;
myBlockEntity.registryName();

Return Type: ResourceLocation

updateData(data as IData)
script.zs
// BlockEntity.updateData(data as IData);
myBlockEntity.updateData(myIData);

Parameters:

data Type: IData