> For the complete documentation index, see [llms.txt](https://1294243258.gitbook.io/untiltheend-introduction/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://1294243258.gitbook.io/untiltheend-introduction/gu-you-shu-xing/temperature-wen-du.md).

# Temperature-温度

本篇数值均为插件默认数值，部分蓝色框内为服主自定义内容

## 温度模块

### 环境温度(未设定方块温度)

#### 决定因素

* 季节决定→春秋适宜，夏热冬寒
* 天数决定→例如盛夏比初夏和晚夏热
* 生物群系决定→沙漠、黏土山较热，雪地高山较冷等
* 海拔决定→高度大于**50°**&#x65F6;，每高一格温&#x5EA6;**-0.15°**

#### 计算公式（不可自定义）

```c
春天：温度=随机小数*(-5)+随机小数*5+1.5*天数-Math.sqrt(Math.sqrt(Math.sqrt(world.getTime())));
夏天：温度=随机小数*(-5)+随机小数*15-0.2*天数*天数+4.6*天数+35.5-Math.sqrt(Math.sqrt(Math.sqrt(world.getTime())));
秋天：温度=随机小数*(-5)+随机小数*5+50-1.5*天数-Math.sqrt(Math.sqrt(Math.sqrt(world.getTime())));
冬天：温度=0.15*天数*天数-3.5*天数+3.3-随机小数*(-5)+随机小数*5-Math.sqrt(Math.sqrt(Math.sqrt(world.getTime())));
```

### 方块温度(已设定方块温度)

#### 某种方块的温度（下界很热，末地很冷）

* 燃烧的熔炉: 65&#x20;
* 岩浆: 75&#x20;
* 火: 75&#x20;
* 各种冰块: 0&#x20;
* 地狱岩: 55&#x20;
* 灵魂沙: 65&#x20;
* 岩浆块: 75&#x20;
* 信标: 37&#x20;
* 末地石: 0

{% code title="temperature.yml" %}

```yaml
blockTemperature: #方块的温度(没有设置的方块为环境温度)
# 方块Material名字: 温度
  BURNING_FURNACE: 65 
  LAVA: 75
  STATIONARY_LAVA: 75
  FIRE: 75
  FROSTED_ICE: 0
  ICE: 0
  PACKED_ICE: 0
  NETHERRACK: 55
  SOUL_SAND: 65
  MAGMA: 75
  BEACON: 37
  ENDER_STONE: 0
  #可以继续添加
```

{% endcode %}

### 综合温度计算

* 玩家将会被周围**9\*9\*9**的方块温度影响
* 如果方块没有自己的温度，那么它就是环境温度（见上）
* 如果方块已经在temperature.yml中设定好，那么它就是设定的温度
* 若方块比较远，则方块温度对玩家的影响很小，反之则很大

#### 某一坐标温度的计算（公式极为复杂，直接上代码，不可自定义）

{% code title="TemperatureProvider.java" %}

```java
public static double getBlockTemperature(Location loc) {
        if (!Config.enableWorlds.contains(loc.getWorld())) return 37;
        if (loc.getBlock() == null) return 37;
        World world = loc.getWorld();
        Block block = loc.getBlock();
        Material material = ItemFactory.getType(block);
        if (blockTemperatures.containsKey(material)) return blockTemperatures.get(material);
        int seasonTem = TemperatureProvider.worldTemperatures.get(world);
        double tems = seasonTem;
        int tot = 1;
        for (int x = -4; x <= 4; x++)
            for (int y = -4; y <= 4; y++)
                for (int z = -4; z <= 4; z++) {
                    Location newLoc = new Location(loc.getWorld(), loc.getX() + x, loc.getY() + y, loc.getZ() + z);
                    if (newLoc.getBlock() == null) continue;
                    Material blockMaterial = ItemFactory.getType(newLoc.getBlock());
                    double factor = loc.distance(newLoc) * 0.4;
                    if (blockTemperatures.containsKey(blockMaterial)) {
                        int blockTem = blockTemperatures.get(blockMaterial);
                        int dValue = Math.abs(blockTem - seasonTem);
                        double influent = (double) dValue / factor;
                        tot++;
                        if (blockTem > seasonTem) tems += seasonTem + influent;
                        else tems += seasonTem - influent;
                    }
                }
        double result = (tems / tot);
        result = (result - (1.5 * ((loc.getBlockY() - 50) / 10D)));
        final double temperature = block.getTemperature();
        result += ((temperature - 0.8) * 14);
        return result;
    }
```

{% endcode %}

## 影响玩家温度的因素

#### 玩家的湿度

* 玩家身上若较潮湿，则玩家温度下降
* 设玩家湿度为H，则玩家温度的变化为： **(-H/5)温度/7.5秒**

{% code title="temperature.yml" %}

```yaml
humidityChangeSpeed: 150 
#玩家温度随湿度的变化速度(数值越小，变化越快，反之变化越慢)
```

{% endcode %}

#### 玩家所在坐标的自然温度

* **坐标的温度计算见上“综合温度计算”**
* 设玩家温度为T，其所在坐标的温度为T'
* 则玩家温度变化情况为：  **±1温度/5秒**

{% code title="temperature.yml" %}

```yaml
temperatureChangeSpeedNatural: 5 
#没有暖石的玩家温度随环境变化的速度(越小变化越快，反之变化越慢)
```

{% endcode %}

### 玩家携带的保温物品

#### **暖石（扔出到地上则带有地面坐标的温度，坐标温度计算见上）**

* 设玩家温度为T，其所在坐标的温度为T'，其身上携带暖石的温度为T''
* 则玩家的**温度T会向T''趋近**，而非向T'趋近
* 玩家温度的变化情况为： **±1温度/秒**
*
* 当然，暖石的温度也不是一成不变的，**其温度T''会向T'趋近**
* （趋近速率比玩家无暖石时T向T'趋近速率要**慢很多**）
* 默认速率为： **10%的几率：±1温度/秒  即  ±1温度/10秒**

{% hint style="info" %}
**所以，如果想保持自己的正常温度，请不断把暖石的温度刷新到玩家的适宜温度**
{% endhint %}

{% code title="temperature.yml" %}

```yaml
temperatureChangeSpeedStone: 1 
#有暖石的玩家温度随暖石变化的速度(越小变化越快，反之变化越慢)
stoneChangePercent: 0.1 
#暖石温度随自然变化的速率(大于0小于1)
```

{% endcode %}

#### 衣物（穿着于身上）

* 草帽：减缓温度上升的速率（减缓40%）
* 兔毛耳罩：减缓温度下降的速率（减缓40%）

### 玩家使用的物品

* 冰雹（使用1个温度-1）
* 豪华风扇（每使用一次**5\*5\*5范围**内温&#x5EA6;**-30度**）
* 水球（每使用一只温度-15度）

## 玩家温度导致的结果

#### 闷烧

* 当玩家周围温度高于55度时，玩家周围的可燃方块每秒有5%的几率开始闷烧
* 闷烧的阶段：
* ①10秒的冒烟时间，此时方块会有冒烟、冒火花的粒子效果
* ②-1)若玩家上前蹲下右击，视为踩灭行为，闷烧终止，但玩家本身收到2秒的燃烧效果
* ②-2)若玩家没有踩灭，①后方块会直接烧起来

{% code title="temperature.yml" %}

```yaml
smoulderPercent: 0.05 
#闷烧的几率(大于0小于1)
smoulderSpeed: 20 
#闷烧计算的数量(数值越小，闷烧出现越频繁)
smoulderTimeout: 200 
#闷烧开始后到方块开始着火的可熄灭时间
smoulderCancellerFireTicks: 40 
#踩灭闷烧的玩家将得到多久的燃烧效果
```

{% endcode %}

#### 不适

* 若玩家温度小于10度，则会出现缓慢和冻伤效果（-0.5生命/秒）
* 若玩家温度大于55度，则会出现中暑效果（-1生命/秒）

{% code title="temperature.yml" %}

```yaml
coldTem: 10 
#寒冷标准温度(低于这个温度判定为寒冷状态，开始扣血+缓慢)
hotTem: 55 
#炎热标准温度(高于这个温度判定为炎热状态，开始扣血+闷烧)
```

{% endcode %}

## 方块温度导致的结果

#### 周围方块/背包 内物品出现 融化/凝固/升华/蒸发 现象

* 水桶->冰块 低于0度
* 冰->空气 高于10度
* 岩浆块->地狱岩 低于40度
* 岩浆桶->黑曜石 低于40度
* 末地石->石头 高于20度
* 石头->圆石 高于50度
* 灵魂沙->沙子 低于40度
* 火->空气 低于10度
* **可继续添加**

{% code title="temperature.yml" %}

```yaml
#随着温度变化，背包内物品也变化的方块设定
fmBlocks:
  #格式（可以无限添加）：
  #物品Material名:
  #  increase: true/false (true代表高于温度变化，false代表低于温度变化)
  #  temperature: 0 (高于/低于某个温度时变化)
  #  newBlock: 变化成的新物品的Material名
  WATER_BUCKET:
    increase: false
    temperature: 0
    newMaterial: ICE
  ICE:
    increase: true
    temperature: 10
    newMaterial: AIR
  MAGMA:
    increase: false
    temperature: 40
    newMaterial: NETHERRACK
  LAVA_BUCKET:
    increase: false
    temperature: 40
    newMaterial: OBSIDIAN
  ENDER_STONE:
    increase: true
    temperature: 20
    newMaterial: STONE
  STONE:
    increase: true
    temperature: 50
    newMaterial: COBBLESTONE
  SOUL_SAND:
    increase: false
    temperature: 40
    newMaterial: SAND
  FIRE:
    increase: false
    temperature: 10
    newMaterial: AIR
```

{% endcode %}

### 温度-完

赞助地址：<https://afdian.net/order/create?plan_id=7cc5be1eb8dd11e9a25e52540025c377>

QQ官方交流群：1051331429
