Search in sources :

Example 1 with TileEntityHandle

use of com.bergerkiller.generated.net.minecraft.world.level.block.entity.TileEntityHandle in project BKCommonLib by bergerhealer.

the class WrapperConversion method getBlockFromTileEntity.

@ConverterMethod(input = "net.minecraft.world.level.block.entity.TileEntity")
public static org.bukkit.block.Block getBlockFromTileEntity(Object nmsTileEntityHandle) {
    TileEntityHandle handle = TileEntityHandle.createHandle(nmsTileEntityHandle);
    BlockPositionHandle pos = handle.getPosition();
    return handle.getWorld().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
}
Also used : TileEntityHandle(com.bergerkiller.generated.net.minecraft.world.level.block.entity.TileEntityHandle) BlockPositionHandle(com.bergerkiller.generated.net.minecraft.core.BlockPositionHandle) BaseBlockPositionHandle(com.bergerkiller.generated.net.minecraft.core.BaseBlockPositionHandle) ConverterMethod(com.bergerkiller.mountiplex.conversion.annotations.ConverterMethod)

Example 2 with TileEntityHandle

use of com.bergerkiller.generated.net.minecraft.world.level.block.entity.TileEntityHandle in project BKCommonLib by bergerhealer.

the class NMSTileEntity method getBlock.

public static Block getBlock(Object tileEntity) {
    TileEntityHandle handle = TileEntityHandle.createHandle(tileEntity);
    BlockPositionHandle pos = handle.getPosition();
    return handle.getWorld().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
}
Also used : TileEntityHandle(com.bergerkiller.generated.net.minecraft.world.level.block.entity.TileEntityHandle) BlockPositionHandle(com.bergerkiller.generated.net.minecraft.core.BlockPositionHandle)

Aggregations

BlockPositionHandle (com.bergerkiller.generated.net.minecraft.core.BlockPositionHandle)2 TileEntityHandle (com.bergerkiller.generated.net.minecraft.world.level.block.entity.TileEntityHandle)2 BaseBlockPositionHandle (com.bergerkiller.generated.net.minecraft.core.BaseBlockPositionHandle)1 ConverterMethod (com.bergerkiller.mountiplex.conversion.annotations.ConverterMethod)1