Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/plugins/anvil.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module.exports = inject

function inject (bot) {
const Item = require('prismarine-item')(bot.registry)
// The anvil custom name limit was raised from 35 to 50 characters in 1.17
const maxNameLength = bot.supportFeature('anvilNameLengthIsFifty') ? 50 : 35

const matchWindowType = window => /minecraft:(?:chipped_|damaged_)?anvil/.test(window.type)

Expand Down Expand Up @@ -43,7 +45,7 @@ function inject (bot) {
}

async function combine (itemOne, itemTwo, name) {
if (name?.length > 35) err('Name is too long.')
if (name?.length > maxNameLength) err('Name is too long.')
if (bot.supportFeature('useMCItemName')) {
bot._client.registerChannel('MC|ItemName', 'string')
}
Expand All @@ -70,7 +72,7 @@ function inject (bot) {
}

async function rename (item, name) {
if (name?.length > 35) err('Name is too long.')
if (name?.length > maxNameLength) err('Name is too long.')
if (bot.supportFeature('useMCItemName')) {
bot._client.registerChannel('MC|ItemName', 'string')
}
Expand Down
Loading