This commit is contained in:
ChomeNS 2022-12-18 10:27:50 +07:00
parent 92cc8366fd
commit a40c8a0cd5

View file

@ -1,22 +1,26 @@
const convert = require('color-convert');
const convert = require('color-convert')
module.exports = {
inject: function (bot) {
bot.bruhifyText = '';
let startHue = 0;
timer = setInterval(() => {
if (bot.bruhifyText === '') return;
bot.bruhifyText = ''
let startHue = 0
const timer = setInterval(() => {
if (bot.bruhifyText === '') return
let hue = startHue;
const displayName = bot.bruhifyText;
const increment = (360 / Math.max(displayName.length, 20));
const component = [];
let hue = startHue
const displayName = bot.bruhifyText
const increment = (360 / Math.max(displayName.length, 20))
const component = []
for (const character of displayName) {
const color = convert.hsv.hex(hue, 100, 100);
component.push({text: character, color: `#${color}`});
hue = (hue + increment) % 360;
const color = convert.hsv.hex(hue, 100, 100)
component.push({ text: character, color: `#${color}` })
hue = (hue + increment) % 360
}
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`)
startHue = (startHue + increment) % 360
}, 100)
bot.on('end', () => {
clearInterval(timer)
})
}
}
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`);
startHue = (startHue + increment) % 360;
}, 100);
},
};