#Can't enchant custom sword

39 messages · Page 1 of 1 (latest)

azure solstice
#

It has the #forge:swords, #minecraft:swords, and #forge:tools tags but I can't enchant it at all

quick doveBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

azure solstice
#

Ok tested and it just can't be enchanted via enchanting table

rigid rose
#

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!")
azure solstice
#
  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')
})```
rigid rose
#

Good that you are uppercasing your rarity, that way you are avoiding

#

??turkish

sudden heartBOT
# rigid rose ??turkish

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
rigid rose
#

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

rigid rose
#

(that's durability BTW)

azure solstice
#

And not setting it to 0 makes it have 250 durability

rigid rose
#

Hmm, do tiers even support having unbreakable items...

#

I have some sad news for you:
Setting uses to 0 makes the tool unenchantable

azure solstice
#

Thats veryyyy annoying

#

Is there another way to make it unbreakable?

distant wasp
azure solstice
#

I’ll try this when I get home

azure solstice
sudden heartBOT
#

🗒️ 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.

azure solstice
#
  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')
})```
distant wasp
#

remove the quotes

#

.maxDamage(-1)

azure solstice
#

Still didnt work

#

The tool is taking damage

distant wasp
#

you could try with ItemEvents.modification

#

it definitely works for items with other mods

#

never tried it with kubejs items

azure solstice
#

I am now just adding the unbreakable tag to the recipe