crwdns156461:0crwdne156461:0

crwdns156463:0crwdne156463:0

crwdns156465:0crwdne156465:0

crwdns156467:0:javadoc:crwdnd156467:0:javadoc:crwdne156467:0

import org.spongepowered.api.world.server.ServerLocation;

public boolean isTileEntity(ServerLocation blockLoc) {
    return blockLoc.blockEntity().isPresent();
}

crwdns156469:0:javadoc:crwdnd156469:0:javadoc:crwdnd156469:0:javadoc:crwdnd156469:0:javadoc:crwdne156469:0

import org.spongepowered.api.block.Jukebox;
import org.spongepowered.api.block.TileEntity;
import org.spongepowered.api.block.TileEntityTypes;

public boolean isJukebox(BlockEntity entity) {
    return entity.getType().equals(BlockEntityTypes.JUKEBOX.get());
}

public void ejectDiscFromJukebox(BlockEntity entity) {
    if (isJukebox(entity)) {
        Jukebox jukebox = (Jukebox) entity;
        jukebox.eject();
    }
}

crwdns156471:0:javadoc:crwdnd156471:0:javadoc:crwdne156471:0

crwdns156473:0crwdne156473:0

crwdns156475:0:javadoc:crwdne156475:0

crwdns156477:0crwdne156477:0

import net.kyori.adventure.text.Component;
import org.spongepowered.api.block.entity.Sign;

import java.util.Optional;
import java.util.List;

public Optional<Component> getFirstLine(BlockEntity entity) {
    Optional<List<Component>> lines = entity.get(Keys.SIGN_LINES)
    if (data.isPresent()) {
        return Optional.of(data.get().get(0));
    }
    return Optional.empty();
}

public boolean setFirstLine(BlockEntity entity, Component line) {
    if (entity.supports(Keys.SIGN_LINES)) {
        List<Component> lines = Arrays.asList(line);
        entity.offer(Keys.SIGN_LINES, lines);
        return true;
    }
    return false;
}

crwdns156479:0:javadoc:crwdne156479:0

crwdns156481:0crwdne156481:0

crwdns156483:0:javadoc:crwdne156483:0

import org.spongepowered.api.block.entity.carrier.CarrierBlockEntity;
import org.spongepowered.api.item.inventory.Inventory;

public void useInventory(TileEntity entity) {
    if (entity instanceof CarrierBlockEntity) {
        CarrierBlockEntity carrier = (CarrierBlockEntity) entity;
        Inventory inventory = carrier.getInventory();
        [...]
    }
}

crwdns156485:0crwdne156485:0