Skip to content

Commit

Permalink
战利品收尾工程#1
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikidona committed Sep 24, 2024
1 parent 78d9255 commit fc82a4a
Show file tree
Hide file tree
Showing 15 changed files with 211 additions and 186 deletions.
1 change: 0 additions & 1 deletion docs/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 抽取项

- 抽取项存在于每个随机池的抽取项列表中。

## 抽取项类型

| 抽取项类型 | 作用 | 语句 |
|:------------:|:---------:|:---------:|
| 选择 | 从中掉落第一个满足条件的战利品 | - |
| 动态 | 用于潜影盒与纹饰陶罐 | - |
|| 什么都不掉的战利品 | addEmpty() |
| 物品 | 掉落一个物品 | addItem() |
|| 掉落一组物品 | - |
| 战利品表 | 从另一个战利品表决定掉落什么 | - |
| 序列 | 按依次掉落,直到某一项谓词不通过 | - |
| 物品标签 | 掉落标签中1个或全部物品 | - |

## 添加抽取项

- 在addPool(pool=>{})中使用;

- 示例:

```js
ServerEvents.blockLootTables(event => {
event.addBlock('minecraft:gravel', loot => {
loot.addPool(pool => {
pool.addItem('minecraft:diamond')// [!code ++]
})
})
})

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 随机池

- 存在于每个战利品表的随机池列表中,内含抽取项(战利品),每个随机池都有自己的抽取次数设置,触发战利品表时每个随机池进行有放回的独立抽取。

## 添加随机池

- 创建一个新随机池。

- 语句:addPool(pool=>{});

```js
ServerEvents.blockLootTables(event => {
event.addBlock('minecraft:gravel', loot => {
loot.addPool(pool => {// [!code ++]
})// [!code ++]
})
})
```

## 抽取次数

- **`默认值`** 默认值为1。

- pool.rolls 是一个[数字提供器](../MiscellaneousKnowledge/NumberProvider.md)

- pool.setUniformRolls(min, max) 设置取值范围,接受最小值与最大值

- pool.setBinomialRolls(n, p) 设置二项分布,接受n尝试次数,p每次尝试成功概率,期望次数np

::: code-group

```js [绝对值]
ServerEvents.blockLootTables(event => {
event.addBlock('minecraft:gravel', loot => {
loot.addPool(pool => {
pool.rolls = 1// [!code ++]
})
})
})
```

```js [取值范围]
ServerEvents.blockLootTables(event => {
event.addBlock('minecraft:gravel', loot => {
loot.addPool(pool => {
pool.setUniformRolls(1, 1)// [!code ++]
})
})
})
```

```js [二项分布]
ServerEvents.blockLootTables(event => {
event.addBlock('minecraft:gravel', loot => {
loot.addPool(pool => {
pool.setBinomialRolls(5, 0.5)// [!code ++]
})
})
})
```

:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 战利品表类型

- **`战利品表类型`** 战利品表上下文类型,也称为战利品表类型。

- 类型决定不同战利品表的作用。

- 类型决定不同战利品表的可用的谓词与修饰器。

| 战利品表类型 | 事件 | 示例 |
|:------------:|:---------:|:---------:|
| 方块 | ServerEvents.blockLootTables | [方块类型战利品表](./Block.md) |
| 实体 | ServerEvents.entityLootTables | [实体类型战利品表](./Entity.md) |
| 钓鱼 | ServerEvents.fishingLootTables | [钓鱼类型战利品表](./Fish.md) |
| 礼物 | ServerEvents.fishingLootTables | [礼物类型战利品表](./Gift.md) |
| 箱子 | ServerEvents.chestLootTables | [箱子类型战利品表](./Chest.md) |
| 通用 | ServerEvents.genericLootTables | [通用类型战利品表](./Generic.md) |
105 changes: 0 additions & 105 deletions docs/zh/modpack/kubejs/1.20.1/Introduction/LootTable/LootEntry.md

This file was deleted.

Loading

0 comments on commit fc82a4a

Please sign in to comment.