diff --git a/.editorconfig b/.editorconfig index c8c5768..d9f69f7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ insert_final_newline = true [*.md] trim_trailing_whitespace = false -max_line_length = 80 +max_line_length = 103 [*.{json,yml,yaml,prettierrc}] indent_size = 2 diff --git a/main/theme/style.css b/main/theme/style.css index 7472e72..31e9949 100644 --- a/main/theme/style.css +++ b/main/theme/style.css @@ -1,3 +1,7 @@ -.VPDoc.has-aside .content-container { - max-width: 800px !important; +:root { + --vp-layout-max-width: 1500px; +} + +.content-container { + max-width: 850px !important; } diff --git a/wikis/lootjs/docs/api/item-filter.md b/wikis/lootjs/docs/api/item-filter.md index 2e51df7..978274c 100644 --- a/wikis/lootjs/docs/api/item-filter.md +++ b/wikis/lootjs/docs/api/item-filter.md @@ -213,10 +213,7 @@ Combines multiple item filters into one. Matches if all filters match. - `ItemFilter.allOf(...filters: ItemFilter[])` ```js -ItemFilter.allOf( - ItemFilter.hasEnchantment("minecraft:fortune"), - ItemFilter.equipmentSlotGroup("hand") -) +ItemFilter.allOf(ItemFilter.hasEnchantment("minecraft:fortune"), ItemFilter.equipmentSlotGroup("hand")) ``` ### `anyOf` diff --git a/wikis/lootjs/docs/api/loot-condition.md b/wikis/lootjs/docs/api/loot-condition.md index d8c41e0..5b40f62 100644 --- a/wikis/lootjs/docs/api/loot-condition.md +++ b/wikis/lootjs/docs/api/loot-condition.md @@ -19,9 +19,7 @@ LootEntry.of("minecraft:diamond").matchTool("#c:tools") ```js LootEntry.of("minecraft:diamond").matchTool( - ItemFilter.tag("c:tools").and( - ItemFilter.hasEnchantment("minecraft:fortune", 3) - ) + ItemFilter.tag("c:tools").and(ItemFilter.hasEnchantment("minecraft:fortune", 3)) ) ``` @@ -149,10 +147,7 @@ Passes with probability picked from a list of probabilities, indexed by enchantm - `LootCondition.randomTableBonus(enchantment: Enchantment, probabilities: number[])` ```js -LootEntry.of("minecraft:diamond").randomTableBonus( - "minecraft:fortune", - [0, 0.33, 0.66, 1.0] -) +LootEntry.of("minecraft:diamond").randomTableBonus("minecraft:fortune", [0, 0.33, 0.66, 1.0]) ``` ## `randomChanceWithEnchantment` @@ -206,10 +201,7 @@ If `exact` is set to `true`, it will check if the player is inside the structure - `LootCondition.matchStructure(structure: string | string[] | tag, exact: boolean)` ```js -LootEntry.of("minecraft:diamond").matchStructure( - ["minecraft:stronghold", "minecraft:village"], - false -) +LootEntry.of("minecraft:diamond").matchStructure(["minecraft:stronghold", "minecraft:village"], false) ``` ## `isLightLevel` @@ -253,9 +245,7 @@ Matches against the entity that died, opened the chest or destroyed the block. - `LootCondition.matchEntity(predicate: EntityPredicate)` ```js -LootEntry.of("minecraft:diamond").matchEntity( - Predicates.entity().isCrouching(true) -) +LootEntry.of("minecraft:diamond").matchEntity(Predicates.entity().isCrouching(true)) ``` ## `matchDirectAttacker` @@ -267,9 +257,7 @@ Matches against the direct entity which caused the death, e.g. the arrow entity, - `LootCondition.matchDirectAttacker(predicate: EntityPredicate)` ```js -LootEntry.of("minecraft:diamond").matchDirectAttacker( - Predicates.entity().isCrouching(true) -) +LootEntry.of("minecraft:diamond").matchDirectAttacker(Predicates.entity().isCrouching(true)) ``` ## `matchAttacker` @@ -281,9 +269,7 @@ Matches against the entity which caused the death. - `LootCondition.matchAttacker(predicate: EntityPredicate)` ```js -LootEntry.of("minecraft:diamond").matchAttacker( - Predicates.entity().isCrouching(true) -) +LootEntry.of("minecraft:diamond").matchAttacker(Predicates.entity().isCrouching(true)) ``` ## `matchPlayer` @@ -295,9 +281,7 @@ Matches against the player. If a player kills another player, it will check agai - `LootCondition.matchPlayer(predicate: EntityPredicate)` ```js -LootEntry.of("minecraft:diamond").matchPlayer( - Predicates.entity().isCrouching(true) -) +LootEntry.of("minecraft:diamond").matchPlayer(Predicates.entity().isCrouching(true)) ``` ## `matchPlayerCustom` diff --git a/wikis/lootjs/docs/api/loot-entries-transformer.md b/wikis/lootjs/docs/api/loot-entries-transformer.md index 483f3fd..866e381 100644 --- a/wikis/lootjs/docs/api/loot-entries-transformer.md +++ b/wikis/lootjs/docs/api/loot-entries-transformer.md @@ -34,9 +34,7 @@ We also can just use a simple item id. LootJS will automatically convert it into ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .removeItem("minecraft:diamond") + event.getLootTable("minecraft:chests/simple_dungeon").removeItem("minecraft:diamond") }) ``` @@ -66,9 +64,7 @@ We remove junk from the fishing loot table, no one needs junk. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:gameplay/fishing") - .removeReference("minecraft:gameplay/fishing/junk") + event.getLootTable("minecraft:gameplay/fishing").removeReference("minecraft:gameplay/fishing/junk") }) ``` @@ -111,16 +107,14 @@ Modifies all loot entries. Requires to always **return** a loot entry again. You ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .modifyEntry((entry) => { - if (entry.isItem() && entry.item.id === "minecraft:string") { - entry.setCount([5, 12]) - } - - // Remember to always return an entry! - return entry - }) + event.getLootTable("minecraft:chests/simple_dungeon").modifyEntry((entry) => { + if (entry.isItem() && entry.item.id === "minecraft:string") { + entry.setCount([5, 12]) + } + + // Remember to always return an entry! + return entry + }) }) ``` @@ -133,16 +127,14 @@ Same as `modifyEntry` but will only iterates through `LootItemEntry`s. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .modifyItem((itemEntry) => { - if (itemEntry.item.id === "minecraft:string") { - itemEntry.setCount([5, 12]) - } - - // Remember to always return an entry! - return itemEntry - }) + event.getLootTable("minecraft:chests/simple_dungeon").modifyItem((itemEntry) => { + if (itemEntry.item.id === "minecraft:string") { + itemEntry.setCount([5, 12]) + } + + // Remember to always return an entry! + return itemEntry + }) }) ``` diff --git a/wikis/lootjs/docs/api/loot-function.md b/wikis/lootjs/docs/api/loot-function.md index 63f9bbe..9ee9592 100644 --- a/wikis/lootjs/docs/api/loot-function.md +++ b/wikis/lootjs/docs/api/loot-function.md @@ -72,11 +72,7 @@ Applies a bonus based on the binomial distribution, where `n = enchantmentLevel - `LootFunction.applyBinomialDistributionBonus(enchantment, p: number, extra: number)` ```js -LootEntry.of("minecraft:emerald_ore").applyBinomialDistributionBonus( - "minecraft:fortune", - 0.2, - 3 -) +LootEntry.of("minecraft:emerald_ore").applyBinomialDistributionBonus("minecraft:fortune", 0.2, 3) ``` ## `applyEnchantmentBonus` @@ -94,10 +90,7 @@ LootEntry.of("minecraft:emerald_ore").applyEnchantmentBonus([2, 5]) ``` ```js -LootEntry.of("minecraft:emerald_ore").applyEnchantmentBonus( - "minecraft:fortune", - [2, 5] -) +LootEntry.of("minecraft:emerald_ore").applyEnchantmentBonus("minecraft:fortune", [2, 5]) ``` ## `setCount` @@ -155,9 +148,7 @@ LootEntry.of("minecraft:emerald_ore").setCustomData({ someCustomStuff: true }) - `LootFunction.setName(name: Component)` ```js -LootEntry.of("minecraft:emerald_ore").setName( - Component.translatable("item.minecraft.emerald_ore") -) +LootEntry.of("minecraft:emerald_ore").setName(Component.translatable("item.minecraft.emerald_ore")) ``` ```js @@ -177,10 +168,7 @@ LootEntry.of("minecraft:emerald_ore").enchantRandomly() ``` ```js -LootEntry.of("minecraft:emerald_ore").enchantRandomly([ - "minecraft:fortune", - "minecraft:unbreaking", -]) +LootEntry.of("minecraft:emerald_ore").enchantRandomly(["minecraft:fortune", "minecraft:unbreaking"]) ``` ## `enchantWithLevels` diff --git a/wikis/lootjs/docs/api/loot-modifier.md b/wikis/lootjs/docs/api/loot-modifier.md index e7d328a..ec4bc88 100644 --- a/wikis/lootjs/docs/api/loot-modifier.md +++ b/wikis/lootjs/docs/api/loot-modifier.md @@ -11,9 +11,7 @@ Besides actions you can also apply any [loot condition](/api/loot-condition) and ```js LootJS.modifiers((event) => { - event - .addTableModifier("minecraft:chests/simple_dungeon") - .addLoot("minecraft:gunpowder") + event.addTableModifier("minecraft:chests/simple_dungeon").addLoot("minecraft:gunpowder") }) ``` @@ -50,9 +48,7 @@ LootJS.modifiers((event) => { */ const stickWhenFortune = LootEntry.of("minecraft:stick") .applyOreBonus("minecraft:fortune") - .when((c) => - c.matchMainHand(ItemFilter.hasEnchantment("minecraft:fortune")) - ) + .when((c) => c.matchMainHand(ItemFilter.hasEnchantment("minecraft:fortune"))) /** * Second loot entry with a condition. Will drop if the player has silk touch and the first entry doesn't match. @@ -104,9 +100,7 @@ LootJS.modifiers((event) => { /** * Random chance is 0 so no diamond will ever drop. Just to show, that it will skip all other entries. */ - const diamondNoDrop = LootEntry.of("minecraft:diamond").when((c) => - c.randomChance(0.0) - ) + const diamondNoDrop = LootEntry.of("minecraft:diamond").when((c) => c.randomChance(0.0)) /** * No conditions just an item, but this will not drop, because the previous entry failed. @@ -116,13 +110,7 @@ LootJS.modifiers((event) => { event .addBlockLootModifier("minecraft:coal_ore") .removeLoot(Ingredient.all) - .addSequenceLoot( - stickWhenFortune, - appleWhenEfficiency, - flint, - diamondNoDrop, - ironIngot - ) + .addSequenceLoot(stickWhenFortune, appleWhenEfficiency, flint, diamondNoDrop, ironIngot) }) ``` @@ -135,9 +123,7 @@ Remove all `items` which matches the given [ItemFilter]. ```js LootJS.modifiers((event) => { - event - .addTableModifier("minecraft:chests/simple_dungeon") - .removeLoot("minecraft:string") + event.addTableModifier("minecraft:chests/simple_dungeon").removeLoot("minecraft:string") }) ``` @@ -242,11 +228,9 @@ Creates a new nested loot modifier. You can also pre-filter it, so you can only ```js LootJS.modifiers((event) => { - event - .addTableModifier("minecraft:chests/simple_dungeon") - .group((modifier) => { - // Work with the modifier - }) + event.addTableModifier("minecraft:chests/simple_dungeon").group((modifier) => { + // Work with the modifier + }) }) ``` diff --git a/wikis/lootjs/docs/api/loot-pool.md b/wikis/lootjs/docs/api/loot-pool.md index 98d9298..7905d24 100644 --- a/wikis/lootjs/docs/api/loot-pool.md +++ b/wikis/lootjs/docs/api/loot-pool.md @@ -13,10 +13,7 @@ Get the name of the pool. May return `null` if no name is set. Some mods will gi ```js LootJS.lootTables((event) => { - let name = event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .getName() + let name = event.getLootTable("minecraft:chests/simple_dungeon").firstPool().getName() }) ``` @@ -29,10 +26,7 @@ Sets the name of the pool. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .name("example_name") + event.getLootTable("minecraft:chests/simple_dungeon").firstPool().name("example_name") }) ``` @@ -45,10 +39,7 @@ Sets the number of rolls of the pool. The default value is `1`. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .rolls([1, 5]) // Will roll between 1 and 5 times + event.getLootTable("minecraft:chests/simple_dungeon").firstPool().rolls([1, 5]) // Will roll between 1 and 5 times }) ``` @@ -61,10 +52,7 @@ Sets the number of bonus rolls of the pool. The default value is `0`. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .bonusRolls(1) + event.getLootTable("minecraft:chests/simple_dungeon").firstPool().bonusRolls(1) }) ``` @@ -96,10 +84,7 @@ Returns a list of all conditions attached to the pool. Alternative to `when`. Se ```js LootJS.lootTables((event) => { - let conditions = event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .getConditions() + let conditions = event.getLootTable("minecraft:chests/simple_dungeon").firstPool().getConditions() conditions.add(LootCondition.randomChance(0.5)) }) ``` @@ -132,10 +117,7 @@ Returns a list of all loot item functions attached to the pool. Alternative to ` ```js LootJS.lootTables((event) => { - let functions = event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .getFunctions() + let functions = event.getLootTable("minecraft:chests/simple_dungeon").firstPool().getFunctions() functions.add(LootFunction.setCount([1, 25])) }) ``` @@ -150,10 +132,7 @@ Returns a list of all `LootEntry` in the pool. ```js LootJS.lootTables((event) => { - let entries = event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .getEntries() + let entries = event.getLootTable("minecraft:chests/simple_dungeon").firstPool().getEntries() entries.addEntry("minecraft:apple") }) @@ -179,10 +158,7 @@ LootJS.lootTables((event) => { ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .addEntry("minecraft:apple") // Loot JS will automatically convert it. + event.getLootTable("minecraft:chests/simple_dungeon").firstPool().addEntry("minecraft:apple") // Loot JS will automatically convert it. }) ``` @@ -190,10 +166,7 @@ Or you can directly use `addItem` ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .firstPool() - .addItem("minecraft:apple") + event.getLootTable("minecraft:chests/simple_dungeon").firstPool().addItem("minecraft:apple") }) ``` diff --git a/wikis/lootjs/docs/api/loot-table.md b/wikis/lootjs/docs/api/loot-table.md index 66c70ce..45fd458 100644 --- a/wikis/lootjs/docs/api/loot-table.md +++ b/wikis/lootjs/docs/api/loot-table.md @@ -36,9 +36,7 @@ Creates a new pool and returns it. ```js LootJS.lootTables((event) => { - let pool = event - .getLootTable("minecraft:chests/simple_dungeon") - .createPool() + let pool = event.getLootTable("minecraft:chests/simple_dungeon").createPool() }) ``` @@ -59,9 +57,7 @@ Returns a list of all [item functions](/api/loot-function) attached to the loot ```js LootJS.lootTables((event) => { - let functions = event - .getLootTable("minecraft:chests/simple_dungeon") - .getFunctions() + let functions = event.getLootTable("minecraft:chests/simple_dungeon").getFunctions() }) ``` @@ -74,13 +70,11 @@ Adds a custom callback when the loot table is rolled. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/simple_dungeon") - .onDrop((context, loot) => { - for (let item of loot) { - console.log(item) - } - }) + event.getLootTable("minecraft:chests/simple_dungeon").onDrop((context, loot) => { + for (let item of loot) { + console.log(item) + } + }) }) ``` diff --git a/wikis/lootjs/docs/event.md b/wikis/lootjs/docs/event.md index 1c869ae..68fb4c3 100644 --- a/wikis/lootjs/docs/event.md +++ b/wikis/lootjs/docs/event.md @@ -91,11 +91,9 @@ LootJS.lootTables((event) => { ```js LootJS.lootTables((event) => { - event - .modifyBlockTables(["minecraft:diamond_ore", "minecraft:emerald_ore"]) - .createPool((pool) => { - // editing the pool - }) + event.modifyBlockTables(["minecraft:diamond_ore", "minecraft:emerald_ore"]).createPool((pool) => { + // editing the pool + }) }) ``` @@ -169,11 +167,9 @@ LootJS.lootTables((event) => { }) // If we want to match multiple types, we can use an array - event - .modifyLootTypeTables([LootType.CHEST, LootType.ENTITY]) - .createPool((pool) => { - // editing the pool - }) + event.modifyLootTypeTables([LootType.CHEST, LootType.ENTITY]).createPool((pool) => { + // editing the pool + }) }) ``` diff --git a/wikis/lootjs/docs/loot-modifiers/event.md b/wikis/lootjs/docs/loot-modifiers/event.md index 60fd067..9011e62 100644 --- a/wikis/lootjs/docs/loot-modifiers/event.md +++ b/wikis/lootjs/docs/loot-modifiers/event.md @@ -52,20 +52,14 @@ Valid loot types are `chest`, `block`, `entity`, `fishing`, `archaeology`, `gift ```js LootJS.modifiers((event) => { - event - .addTypeModifier("chest") - .randomChance(0.5) - .addLoot("minecraft:gunpowder") + event.addTypeModifier("chest").randomChance(0.5).addLoot("minecraft:gunpowder") }) ``` ```js LootJS.modifiers((event) => { // We can also use multiple ones - event - .addTypeModifier("block", "entity") - .randomChance(0.5) - .addLoot("minecraft:gunpowder") + event.addTypeModifier("block", "entity").randomChance(0.5).addLoot("minecraft:gunpowder") }) ``` @@ -78,10 +72,7 @@ Add a new loot modifier for all entities which match the given filter. ```js LootJS.modifiers((event) => { - event - .addEntityModifier("minecraft:creeper") - .randomChance(0.5) - .addLoot("minecraft:gunpowder") + event.addEntityModifier("minecraft:creeper").randomChance(0.5).addLoot("minecraft:gunpowder") }) ``` @@ -96,10 +87,7 @@ LootJS.modifiers((event) => { ```js LootJS.modifiers((event) => { - event - .addEntityModifier("#minecraft:skeletons") - .randomChance(0.5) - .addLoot("minecraft:stick") + event.addEntityModifier("#minecraft:skeletons").randomChance(0.5).addLoot("minecraft:stick") }) ``` @@ -112,10 +100,7 @@ Add a new loot modifier for all blocks which match the given filter. ```js LootJS.modifiers((event) => { - event - .addBlockModifier("minecraft:iron_ore") - .randomChance(0.5) - .addLoot("minecraft:iron_nugget") + event.addBlockModifier("minecraft:iron_ore").randomChance(0.5).addLoot("minecraft:iron_nugget") }) ``` @@ -130,10 +115,7 @@ LootJS.modifiers((event) => { ```js LootJS.modifiers((event) => { - event - .addBlockModifier("#c:ores") - .randomChance(0.5) - .addLoot("minecraft:flint") + event.addBlockModifier("#c:ores").randomChance(0.5).addLoot("minecraft:flint") }) ``` diff --git a/wikis/lootjs/docs/loot-tables/create-loot-table.md b/wikis/lootjs/docs/loot-tables/create-loot-table.md index df57897..7fafdbd 100644 --- a/wikis/lootjs/docs/loot-tables/create-loot-table.md +++ b/wikis/lootjs/docs/loot-tables/create-loot-table.md @@ -52,9 +52,7 @@ LootJS.lootTables((event) => { event.create("lootjs:rare_equipment").createPool((pool) => { // Per default it will always be `#minecraft:on_random_loot` for `enchantWithLevels` pool.addEntry( - LootEntry.of("minecraft:diamond_leggings") - .withWeight(3) - .enchantWithLevels([20, 39]) + LootEntry.of("minecraft:diamond_leggings").withWeight(3).enchantWithLevels([20, 39]) ) }) }) @@ -68,15 +66,11 @@ Let's add some more items to the first pool. LootJS.lootTables((event) => { event.create("lootjs:rare_equipment").createPool((pool) => { pool.addEntry( - LootEntry.of("minecraft:diamond_leggings") - .withWeight(3) - .enchantWithLevels([20, 39]) + LootEntry.of("minecraft:diamond_leggings").withWeight(3).enchantWithLevels([20, 39]) ) pool.addEntry( - LootEntry.of("minecraft:iron_pickaxe") - .withWeight(10) - .enchantWithLevels([10, 19]) + LootEntry.of("minecraft:iron_pickaxe").withWeight(10).enchantWithLevels([10, 19]) ) pool.addEntry( @@ -128,9 +122,7 @@ Now we want to add our loot table to the `minecraft:gameplay/fishing` loot table ```js LootJS.lootTables((event) => { event.getLootTable("minecraft:gameplay/fishing").firstPool((pool) => { - pool.addEntry( - LootEntry.reference("lootjs:rare_equipment").randomChance(0.1) - ) + pool.addEntry(LootEntry.reference("lootjs:rare_equipment").randomChance(0.1)) }) }) ``` diff --git a/wikis/lootjs/docs/loot-tables/event.md b/wikis/lootjs/docs/loot-tables/event.md index e19c1fe..3ecec79 100644 --- a/wikis/lootjs/docs/loot-tables/event.md +++ b/wikis/lootjs/docs/loot-tables/event.md @@ -97,11 +97,9 @@ LootJS.lootTables((event) => { ```js LootJS.lootTables((event) => { - event - .modifyBlockTables(["minecraft:diamond_ore", "minecraft:emerald_ore"]) - .createPool((pool) => { - // editing the pool - }) + event.modifyBlockTables(["minecraft:diamond_ore", "minecraft:emerald_ore"]).createPool((pool) => { + // editing the pool + }) }) ``` @@ -173,11 +171,9 @@ LootJS.lootTables((event) => { }) // If we want to match multiple types, we can use an array - event - .modifyLootTypeTables(LootType.CHEST, LootType.ENTITY) - .createPool((pool) => { - // editing the pool - }) + event.modifyLootTypeTables(LootType.CHEST, LootType.ENTITY).createPool((pool) => { + // editing the pool + }) }) ``` diff --git a/wikis/lootjs/docs/loot-tables/modify-loot-table.md b/wikis/lootjs/docs/loot-tables/modify-loot-table.md index f4a5bda..7825a6d 100644 --- a/wikis/lootjs/docs/loot-tables/modify-loot-table.md +++ b/wikis/lootjs/docs/loot-tables/modify-loot-table.md @@ -12,10 +12,7 @@ Let's add a simple `apple` to our chest loot. ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/desert_pyramid") - .firstPool() - .addEntry("minecraft:apple") + event.getLootTable("minecraft:chests/desert_pyramid").firstPool().addEntry("minecraft:apple") }) ``` @@ -43,9 +40,7 @@ LootJS.lootTables((event) => { event .getLootTable("minecraft:chests/desert_pyramid") .firstPool() - .addEntry( - LootEntry.of("minecraft:apple").withWeight(20).setCount([2, 5]) - ) + .addEntry(LootEntry.of("minecraft:apple").withWeight(20).setCount([2, 5])) }) ``` @@ -76,9 +71,6 @@ We also want to remove `minecraft:bone` from our desert pyramids loot table. `re ```js LootJS.lootTables((event) => { - event - .getLootTable("minecraft:chests/desert_pyramid") - .firstPool() - .removeItem("minecraft:bone") + event.getLootTable("minecraft:chests/desert_pyramid").firstPool().removeItem("minecraft:bone") }) ``` diff --git a/wikis/morejs/docs/understanding-trades.md b/wikis/morejs/docs/understanding-trades.md index 112d791..816bb16 100644 --- a/wikis/morejs/docs/understanding-trades.md +++ b/wikis/morejs/docs/understanding-trades.md @@ -1,10 +1,10 @@ # Understanding villager trades -In Minecraft the concept of villager trades is separated into a `trade` and an `offer`. -Offers are what the user sees in the trading UI when interacting with a villager. It contains information about the costs and the output of the offer. +In Minecraft the concept of villager trades is separated into a `trade` and an `offer`. +Offers are what the user sees in the trading UI when interacting with a villager. It contains information about the costs and the output of the offer. -Offers are generated from a trade, this also means that a trade may not have information about the sold items. One example is the enchanted book trade, it contains the costs in emeralds and what enchantments are possible. +Offers are generated from a trade, this also means that a trade may not have information about the sold items. One example is the enchanted book trade, it contains the costs in emeralds and what enchantments are possible. -Offer generation is triggered when a villager gets a profession or level up. For wanderer trades this happens on spawn. +Offer generation is triggered when a villager gets a profession or level up. For wanderer trades this happens on spawn. -From a technical standpoint a trade is just a function `(villager, level) => MerchantOffer`. This means that modded trades have a chance that they can't be filtered by MoreJS. +From a technical standpoint a trade is just a function `(villager, level) => MerchantOffer`. This means that modded trades have a chance that they can't be filtered by MoreJS. diff --git a/wikis/morejs/docs/update-offer.md b/wikis/morejs/docs/update-offer.md index aa45c60..63c2b14 100644 --- a/wikis/morejs/docs/update-offer.md +++ b/wikis/morejs/docs/update-offer.md @@ -53,10 +53,7 @@ We will remove the clay trade from the mason and replace it with a trade from th ```js MoreJS.updateOffer((event) => { - if ( - event.isProfession("minecraft:mason") && - event.offer.firstCost.id === "minecraft:clay_ball" - ) { + if (event.isProfession("minecraft:mason") && event.offer.firstCost.id === "minecraft:clay_ball") { // Get all level 2 trades from shepherd const shepherdTrades = event.getVillagerTrades("minecraft:shepherd", 2) @@ -75,10 +72,7 @@ We will add a 20% chance to replace an offer with a random biome map for the car ```js MoreJS.updateOffer((event) => { - if ( - event.isProfession("minecraft:cartographer") && - event.random.nextDouble() < 0.2 - ) { + if (event.isProfession("minecraft:cartographer") && event.random.nextDouble() < 0.2) { const randomBiome = Registry.of("worldgen/biome") .getValues("#minecraft:is_overworld") .getRandom() diff --git a/wikis/morejs/docs/villager-trades.md b/wikis/morejs/docs/villager-trades.md index fbf0ddf..769a88f 100644 --- a/wikis/morejs/docs/villager-trades.md +++ b/wikis/morejs/docs/villager-trades.md @@ -78,10 +78,7 @@ MoreJS.villagerTrades((event) => { ```js MoreJS.villagerTrades((event) => { // Removes all vanilla trades from farmer and workers - event.removeVanillaTypedTrades( - ["minecraft:farmer", "minecraft:worker"], - [1, 5] - ) + event.removeVanillaTypedTrades(["minecraft:farmer", "minecraft:worker"], [1, 5]) }) ``` @@ -89,12 +86,7 @@ MoreJS.villagerTrades((event) => { ```js MoreJS.villagerTrades((event) => { - event.addTrade( - "minecraft:farmer", - 2, - Item.of("minecraft:diamond", 10), - "minecraft:stick" - ) + event.addTrade("minecraft:farmer", 2, Item.of("minecraft:diamond", 10), "minecraft:stick") }) ``` @@ -115,12 +107,7 @@ We also can use `TradeItem` if we want to have a random range for the costs. ```js MoreJS.villagerTrades((event) => { // This will randomly pick the cost between 3 and 10 - event.addTrade( - "minecraft:farmer", - 2, - TradeItem.of("minecraft:diamond", 3, 10), - "minecraft:stick" - ) + event.addTrade("minecraft:farmer", 2, TradeItem.of("minecraft:diamond", 3, 10), "minecraft:stick") }) ``` @@ -131,10 +118,7 @@ You can find all available trades under [`VillagerUtils`](/villager-utils). ```js MoreJS.villagerTrades((event) => { - const jungleMapTrade = VillagerUtils.createBiomeMapTrade( - "minecraft:diamond", - "minecraft:jungle" - ) + const jungleMapTrade = VillagerUtils.createBiomeMapTrade("minecraft:diamond", "minecraft:jungle") event.addTrade("minecraft:farmer", 1, jungleMapTrade) }) diff --git a/wikis/morejs/docs/wanderer-trades.md b/wikis/morejs/docs/wanderer-trades.md index 0bba2eb..172eee6 100644 --- a/wikis/morejs/docs/wanderer-trades.md +++ b/wikis/morejs/docs/wanderer-trades.md @@ -12,7 +12,7 @@ Event can be used by using `MoreJS.wandererTrades((event) => {...})` - `.addTrade(level: number, trade: Trade)` - `.addCustomTrade(level: number, (offer, entity, random) => {})` - `.removeTrade(filter: TradeFilter)` - - Allows better control over trade removal. See [example](#tradefilter) for usage. + - Allows better control over trade removal. See [example](#tradefilter) for usage. - `.removeVanillaTypedTrades(level: number | Range)` - `.removeVanillaTypedTrades()` - `.removeModdedTypedTrades(level: number | Range)`