NitoriJS

KubeJS addon for Gensokyo Legacy.

NitoriJS

KubeJS addon for Gensokyo Legacy, applicable to modpack authors.

Currently it supports modifying the transaction content in the character store and adding custom character dialogues, with more modification features to be introduced in the future.

Usage

Static data

  • Writing: ServerEvents.highPriorityData(e => GLData.tradeOffer(e, {...}))
  • Effective: Next time you enter the world
  • Suitable for: Fixed new products/new dialogues/new tasks/gifts/structural configurations

Runtime events

  • Writing: GL.trade(e => { e.addOffer({...}); e.offers.forEach(...) })
  • Effective: Immediately (reopen the store)
  • Suitable for: dynamic price increases, discounts, unlocking based on players/tasks, opening stores for any character

Example

// kubejs/server_scripts/mypack_shop.js
// All goods purchased by characters with copper coins have increased in price by 25%
GL.trade(event => {
    for(let i = 0; i < event.offers.length; i++) {
        const offer = event.offers[i]
        if(offer.kind === 'TRADE' && offer.coin > 0) {
            offer.setCoin(Math.max(1, Math.ceil(price * 1.25)))
        }
    }
})

// Add a product for Kawashiro Nitori that allows for the exchange of "any mod item" for diamonds, with a purchase limit of 2 and daily restocking
GL.trade(event => {
    if (event.characterId !== 'gensokyolegacy:kawashiro_nitori') return
    event.addOffer({
        id: 'mypack/nitori/diamond',
        output: 'minecraft:diamond',
        inputs: [{ item: '#forge:gems/emerald', count: 3 }],
        coin: 16,
        stock: 2,
        restockTime: 24000
    })
})

More examples can be found in the GitHub repository.

NitoriJS Team

profile avatar
  • 5
    Projects
  • 623
    Downloads

More from EndDavidView all