#Can't enchant custom sword
39 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Ok tested and it just can't be enchanted via enchanting table
How did you create your custom item?
(Paste the script here)
Make sure to put it in a code block though
Like this:
```js
console.log("Hello, world!")
```
It will turn into:
console.log("Hello, world!")
event.add('supporter', tier => {
tier.uses = 0
tier.speed = 8
tier.attackDamageBonus = 3
tier.level = 3
tier.enchantmentValue = 15
})
})
ItemEvents.toolTierRegistry(event => {
event.add('dragon', tier => {
tier.uses = 0
tier.speed = 8
tier.attackDamageBonus = 16
tier.level = 6
tier.enchantmentValue = 20
})
})
StartupEvents.registry('item', event => {
event.create('justice', 'sword')
.displayName('§l§6§kA§r§c§lJustice§6§kA')
.unstackable()
.fireResistant(true)
.rarity('EPIC')
.tooltip('§4§lSplendor is Justice.')
.tooltip('')
.tooltip('§lMade for Rex_The_Knight55.')
.parentModel('thecatlord:item/divine_justice')
.texture('thecatlord:item/divine_justice')
.tier('supporter')
event.create('divine_justice', 'sword')
.displayName('§l§6§kA§r§c§lDivine Justice§6§kA')
.unstackable()
.fireResistant(true)
.rarity('EPIC')
.tooltip('§4§lSplendor is Justice.')
.tooltip('')
.tooltip('§lMade for Rex_The_Knight55.')
.parentModel('thecatlord:item/divine_justice')
.texture('thecatlord:item/divine_justice')
.tier('dragon')
})```
KubeJS, or more specifically - its dependency, Rhino, on 1.20.1 and below has a bug where beanified enum constants on Turkish locale get dotless ı instead of i.
Add the following to your JVM arguments to set the default Java locale to en_US without changing your whole system language:
-Duser.language=en -Duser.country=US
A simple custom item is normally enchantable:
StartupEvents.registry("item", event => {
event.create("kubejs:custom_sword", "sword").tier("IRON")
})
Even with custom tier set.
ItemEvents.toolTierRegistry((event) => {
event.add("custom", (tier) => {
tier.setAttackDamageBonus(6)
tier.setEnchantmentValue(15)
tier.setLevel(2)
tier.setRepairIngredient("minecraft:deepslate")
tier.setSpeed(10)
tier.setUses(500)
})
})
StartupEvents.registry("item", event => {
event.create("kubejs:custom_sword", "sword").tier("custom")
})
BTW - Swords are unstackable by default, you can omit that
Also, why are you setting the tool's uses to 0?
(that's durability BTW)
I want it to be unbreakable
And not setting it to 0 makes it have 250 durability
Hmm, do tiers even support having unbreakable items...
I have some sad news for you:
Setting uses to 0 makes the tool unenchantable
Item modification and set maxDamage to -1
I’ll try this when I get home
This didn't work
I will just be using the unbreakable tag on the item
🗒️ Send the code! 🗒️
You may have an issue with a KubeJS script and you explain it to the best of your ability yet without the actual code in question we have very little to go off of in trying to assist you.
event.add('supporter', tier => {
tier.speed = 8
tier.attackDamageBonus = 3
tier.level = 3
tier.enchantmentValue = 15
})
})
ItemEvents.toolTierRegistry(event => {
event.add('dragon', tier => {
tier.speed = 8
tier.attackDamageBonus = 16
tier.level = 6
tier.enchantmentValue = 20
})
})
StartupEvents.registry('item', event => {
event.create('justice', 'sword')
.displayName('§l§6§kA§r§c§lJustice§6§kA')
.maxDamage('-1')
.unstackable()
.fireResistant(true)
.rarity('EPIC')
.tooltip('§4§lSplendor is Justice.')
.tooltip('')
.tooltip('§lMade for Rex_The_Knight55.')
.parentModel('thecatlord:item/divine_justice')
.texture('thecatlord:item/divine_justice')
.tier('supporter')
event.create('divine_justice', 'sword')
.displayName('§l§6§kA§r§c§lDivine Justice§6§kA')
.unstackable()
.maxDamage('-1')
.fireResistant(true)
.rarity('EPIC')
.tooltip('§4§lSplendor is Justice.')
.tooltip('')
.tooltip('§lMade for Rex_The_Knight55.')
.parentModel('thecatlord:item/divine_justice')
.texture('thecatlord:item/divine_justice')
.tier('dragon')
})```
you could try with ItemEvents.modification
it definitely works for items with other mods
never tried it with kubejs items
Doesn't work
I am now just adding the unbreakable tag to the recipe