UNPKG

@levimc-lse/interface-api

Version:

API for the logic tree development framework that supports cross-plugin UI queues at runtime in Minecraft Legacy Script Engine.

36 lines (35 loc) 1.84 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Title = void 0; const LevelType_1 = require("../LevelType"); class Title { constructor(content, fadeInTime, stayTime, fadeOutTime) { this.content = content; this.fadeInTime = fadeInTime; this.stayTime = stayTime; this.fadeOutTime = fadeOutTime; } render(playerIdentifier) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d; (_a = mc.getPlayer(playerIdentifier)) === null || _a === void 0 ? void 0 : _a.setTitle(this.content, 2, (_b = this.fadeInTime) !== null && _b !== void 0 ? _b : 10, (_c = this.stayTime) !== null && _c !== void 0 ? _c : 70, (_d = this.fadeOutTime) !== null && _d !== void 0 ? _d : 20); }); } getType() { return LevelType_1.LevelType.TITLE; } getOccupiedTicks() { var _a, _b, _c; return ((_a = this.fadeInTime) !== null && _a !== void 0 ? _a : 0) + ((_b = this.stayTime) !== null && _b !== void 0 ? _b : 0) + ((_c = this.fadeOutTime) !== null && _c !== void 0 ? _c : 0); } } exports.Title = Title;