MCPcopy Index your code
hub / github.com/walterhiggins/ScriptCraft / _redrawMenuSign

Function _redrawMenuSign

src/main/js/modules/signs/menu.js:33–58  ·  view source on GitHub ↗
(p_sign, p_selectedIndex, p_displayOptions)

Source from the content-addressed store, hash-verified

31 redraw a menu sign
32*/
33var _redrawMenuSign = function(p_sign, p_selectedIndex, p_displayOptions) {
34 var optLen = p_displayOptions.length,
35 i,
36 text;
37 // the offset is where the menu window begins
38 var offset = Math.max(
39 0,
40 Math.min(optLen - 3, Math.floor(p_selectedIndex / 3) * 3)
41 );
42 for (i = 0; i < 3; i++) {
43 text = '';
44 if (offset + i < optLen) {
45 text = p_displayOptions[offset + i];
46 }
47 if (offset + i == p_selectedIndex) {
48 text = ('' + text).replace(/^ /, '>');
49 }
50 setLine(p_sign, i + 1, text);
51 }
52 if (__plugin.canary) {
53 p_sign.update();
54 }
55 if (__plugin.bukkit) {
56 p_sign.update(true);
57 }
58};
59
60var _updaters = {};
61/*

Callers 2

_updateSignFunction · 0.85
convertToMenuSignFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected