From 458e5a7cd5da3e30ddfe312d850c5d416bc09781 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Fri, 26 Aug 2022 17:13:00 +0700 Subject: [PATCH] remove pig and cow + *entity uses minecraft-data real!11!1 --- changelog.json | 5 ++--- commands/cow.js | 18 ------------------ commands/entity.js | 15 ++++++++------- commands/pig.js | 18 ------------------ index.js | 2 ++ package.json | 1 + 6 files changed, 13 insertions(+), 46 deletions(-) delete mode 100644 commands/cow.js delete mode 100644 commands/pig.js diff --git a/changelog.json b/changelog.json index 42591b3..eebd20f 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,4 @@ [ - "Better auto refill on core break (instead of clooping fill core command in the core)", - "*music list colors", - "Better *list" + "Remove pig and cow command", + "*entity now uses minecraft-data" ] \ No newline at end of file diff --git a/commands/cow.js b/commands/cow.js deleted file mode 100644 index cb7653f..0000000 --- a/commands/cow.js +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable max-len */ -module.exports = { - name: 'cow', - alias: [], - description: 'Summon cows at everyone', - usage: '[specific] ', - trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]==='specific') { - const specific = args[1]; - bot.core.run(`minecraft:execute unless entity @s[name= run ] run execute as @a at ${specific} run summon cow`); - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': 'Cows ', 'color': '#FCA6A6'}, {'text': 'spawning at ' + `${specific}`, 'color': 'white'}])); - } else { - bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon cow'); - bot.core.run('minecraft:tellraw @a ["",{"text":"Cows ","color":"white"},{"text":"spawned at everyone","color":"white"}]'); - } - }, -}; diff --git a/commands/entity.js b/commands/entity.js index 566d333..1890993 100644 --- a/commands/entity.js +++ b/commands/entity.js @@ -6,14 +6,15 @@ module.exports = { usage: '[specific] ', trusted: 0, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (typeof args[0]==='undefined') return; - const entity = args[0]; - if (typeof args[1]==='undefined') { - bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon ' + entity); - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Entity ', color: 'white'}, {text: `"${entity}" `, color: 'green'}, {text: 'spawning at everyone...', color: 'white'}])); - } else if (args[1]==='specific' && typeof args[2]!=='undefined') { + if (!args[0]) return; + const entity = bot.mcData.blocksByName[args[0]]; + if (!entity) throw new SyntaxError('Invalid block'); + if (!args[1]) { + bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon minecraft:' + entity.name); + bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Entity ', color: 'white'}, {text: `"${entity.displayName}" `, color: 'green'}, {text: 'spawning at everyone...', color: 'white'}])); + } else if (args[1]==='specific' && args[2]) { bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at ' + args[2] + ' run summon ' + entity); - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `Entity `, color: 'white'}, {text: `"${entity}" `, color: 'green'}, {text: 'spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}])); + bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `Entity `, color: 'white'}, {text: `"${entity.displayName}" `, color: 'green'}, {text: 'spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}])); } }, }; diff --git a/commands/pig.js b/commands/pig.js deleted file mode 100644 index 36782ed..0000000 --- a/commands/pig.js +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable max-len */ -module.exports = { - name: 'pig', - alias: [], - description: 'Summon pigs at everyone', - usage: '[specific] ', - trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]==='specific') { - const specific = args[1]; - bot.core.run(`minecraft:execute unless entity @s[name= run ] run execute as @a at ${specific} run summon pig`); - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': 'Pigs ', 'color': 'white'}, {'text': 'spawning at ' + `${specific}`, 'color': 'white'}])); - } else { - bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon pig'); - bot.core.run('minecraft:tellraw @a ["",{"text":"Pigs ","color":"#FCA6A6"},{"text":"spawned at everyone","color":"white"}]'); - } - }, -}; diff --git a/index.js b/index.js index 17db944..e2823b9 100644 --- a/index.js +++ b/index.js @@ -263,6 +263,8 @@ function main() { }; bot.vm = new VM(bot.vmoptions); + bot.mcData = require('minecraft-data')('1.18.2'); + loginfinish = true; await sleep(1400); bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'ChomeNS Bot', color: 'yellow'}, {text: ' - a bot made by ', color: 'gray'}, {text: 'chayapak', color: 'gold'}])); diff --git a/package.json b/package.json index 8ba6e28..75eaf7c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "electron": "^20.1.0", "express": "^4.18.1", "flying-squid": "^1.5.0", + "minecraft-data": "^3.11.0", "mineflayer": "^4.3.0", "moment": "^2.29.3", "moment-timezone": "^0.5.34",