crwdns151763:0crwdne151763:0
crwdns151765:0crwdne151765:0
crwdns151767:0crwdne151767:0
crwdns151769:0:javadoc:crwdnd151769:0:javadoc:crwdne151769:0
import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; public boolean isTileEntity(Location<World> blockLoc) { return blockLoc.getTileEntity().isPresent(); }
crwdns151771:0:javadoc:crwdnd151771:0:javadoc:crwdnd151771:0:javadoc:crwdnd151771:0:javadoc:crwdne151771: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(); } }
crwdns151773:0:javadoc:crwdnd151773:0:javadoc:crwdne151773:0
crwdns151775:0crwdne151775:0
crwdns151777:0:javadoc:crwdne151777:0
crwdns151779:0crwdne151779: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; }
crwdns151781:0:javadoc:crwdne151781:0
crwdns151783:0crwdne151783:0
crwdns151785:0:javadoc:crwdne151785: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(); ... } }
crwdns151787:0crwdne151787:0