Search in sources :

Example 1 with Clearable

use of net.minecraft.world.Clearable in project FastAsyncWorldEdit by IntellectualSites.

the class PaperweightAdapter method clearContainerBlockContents.

@Override
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
    ServerLevel originalWorld = ((CraftWorld) world).getHandle();
    BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
    if (entity instanceof Clearable) {
        ((Clearable) entity).clearContent();
        return true;
    }
    return false;
}
Also used : Clearable(net.minecraft.world.Clearable) ServerLevel(net.minecraft.server.level.ServerLevel) BlockPos(net.minecraft.core.BlockPos) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) StructureBlockEntity(net.minecraft.world.level.block.entity.StructureBlockEntity)

Aggregations

BlockPos (net.minecraft.core.BlockPos)1 ServerLevel (net.minecraft.server.level.ServerLevel)1 Clearable (net.minecraft.world.Clearable)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 StructureBlockEntity (net.minecraft.world.level.block.entity.StructureBlockEntity)1 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)1