crwdns122121:0crwdne122121:0

crwdns122123:0crwdne122123:0

crwdns122125:0crwdne122125:0

crwdns122127:0:javadoc:crwdnd122127:0:javadoc:crwdne122127:0

import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

public boolean isTileEntity(Location<World> blockLoc) {
    return blockLoc.getTileEntity().isPresent();
}

crwdns122129:0:javadoc:crwdnd122129:0:javadoc:crwdnd122129:0:javadoc:crwdnd122129:0:javadoc:crwdne122129:0

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

public boolean isJukebox(TileEntity entity) {
    return entity.getType().equals(TileEntityTypes.JUKEBOX);
}

public void ejectDiscFromJukebox(TileEntity entity) {
    if (isJukebox(entity)) {
        Jukebox jukebox = (Jukebox) entity;
        jukebox.ejectRecord();
    }
}

crwdns122131:0:javadoc:crwdnd122131:0:javadoc:crwdne122131:0

crwdns122133:0crwdne122133:0

crwdns122135:0:javadoc:crwdne122135:0

crwdns122137:0crwdne122137:0

import org.spongepowered.api.data.manipulator.mutable.tileentity.SignData;
import org.spongepowered.api.text.Text;

import java.util.Optional;

public Optional<Text> getFirstLine(TileEntity entity) {
    Optional<SignData> data = entity.getOrCreate(SignData.class);
    if (data.isPresent()) {
        return Optional.of(data.get().lines().get(0));
    }
    return Optional.empty();
}

public boolean setFirstLine(TileEntity entity, Text line) {
    if (entity.supports(SignData.class)) {
        SignData sign = entity.getOrCreate(SignData.class).get();
        sign.set(sign.lines().set(0, line));
        entity.offer(sign);
        return true;
    }
    return false;
}

crwdns122139:0:javadoc:crwdne122139:0

crwdns122141:0crwdne122141:0

crwdns122143:0:javadoc:crwdne122143:0

import org.spongepowered.api.block.tileentity.carrier.TileEntityCarrier;
import org.spongepowered.api.item.inventory.Inventory;

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

crwdns122145:0crwdne122145:0