Kubejs Infinite Villagers Transaction (1.20.1) [KJS] Kubejs Minecraft Game

principle

The principle is very simple. In fact, when the villagers or stray merchants open the transaction interface each time, the upper limit of the number of transactions is changed to 2147483647, and the number of transactions to 0. Theoretically it is infinite transaction.

Update log

24/11/19:

Fixed an abnormal price of the items caused by the calculation of the villagers' replenishment (directly disabled the replenishment price adjustment)

Add new features: Right -click the fool villager Green robe His Holiness will turn the villagers into unemployment

Fixed a small number of bugs

Code

The code is placed in server_scripts

 Itemevents.entityInteracted (event => {

Const {target} = EVENT

Const EntityLists = ['Minecraft: Villager', 'Minecraft: Wandering_trader']

If (entityLists.indexof (target.gettype ())! = -1) {

Let data = target.getnbt ()

If (data.villagerdata.profession == 'Minecraft: nitwit') {{

Data.villagerdata.profession = 'MINECRAFT: None'

}

If (data.offer) {

For (var I = 0; I

Data.offers.Recipes [i] .maxuses = nbt.i (2147483647)

Data.offers.Recipes [i] .uses = nbt.i (0)

Data.offers.Recipes [i] .Remove ('Demand')

}}

Target.setnbt (data)

}

})

Regarding the amendments of the villagers/simple villagers, the principle is the same.

The code is also placed in server_scripts

Code:

 blockevents.rightClicked (event => {

Const {block} = EVENT

Const blockLists = ['Easy_villagers: Trader', 'Easy_villagers: Auto_Trader']

IfckLists.indexof (block.getid ())! = -1) {

Let data = block.GetentityData () ()

If (data.villager.tag.villager.villagerdata.profession == 'MINECRAFT: NITWIT') {{

Data.villager.tag.villager.villagerdata.prFession = 'Minecraft: None'

}

If (data.villager.tag.villager.offers) {{

For (var I = 0; I

Data.villager.tag.villager.offers.Rcipes [i] .maxuses = nbt.i (2147483647)

Data.villager.tag.villager.offers.Rcipes [i] .uses = nbt.i (0) data.villager.villager.offers.recipes [i] .remove ('demand')

}

}

Block.setentityData (data)

}

})