Skip to content

Commit

Permalink
udpate preview log 2024-04
Browse files Browse the repository at this point in the history
  • Loading branch information
lace-wing committed Mar 22, 2024
1 parent 5d09bda commit 7589c62
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions info/preview-updates/2024-04.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,80 @@ HookList<ModPlayer> HookOnThrow = PlayerLoader.AddModHook(HookList<ModPlayer>.Cr
如需相关帮助,可咨询 Chicken Bones 或 Mirsario。
-->

---

<!--
# `Several Asset Loading Improvements and Corresponding Asset Wiki Guide`
by **Chicken Bones and jopojelly** has been merged.
**Pull Request:** <https://github.com/tModLoader/tModLoader/compare/3ed8e6eff98af2b7fea55b236a7849e409617ff8...58ed35b2ddedcc7f67a7be50a57223de2cd414b0>
**Arrives in Preview**: <t:1711052919:f> (Direct to Preview due to importance)
**Arrives in Stable**: <t:1711933200:f>
**Runtime Breakage**: 🟢 - **None**
**Source-code Breakage**: 🟢 - **None**, but you should update your code according to the guide. The `ShaderData` change will be a compile error in the subsequent month.
## Short Summary
> - We've noticed that many mods do not use `Assets<T>` as efficiently as they can. These changes and accompanying guides will help modders improve their mod's load times and performance.
> - A new [Assets wiki page](<https://github.com/tModLoader/tModLoader/wiki/Assets>) has been made to teach modders various guidelines on how to properly use the `Asset` class.
> - [ExampleMod has been updated](<https://github.com/tModLoader/tModLoader/pull/4121>) to follow these new guidelines. It serves as a practical example of the guidelines taught in the Asset wiki page.
> - Log messages will warn about mods that spend a long time using `AssetRequestMode.ImmediateLoad` during mod loading.
> - `ShaderData` now has a constructor that takes a `Asset<Effect>`, allowing for more efficient Shader loading.
## Porting Notes
> - Please read the new [Assets wiki page](<https://github.com/tModLoader/tModLoader/wiki/Assets>) and apply the guidelines taught within.
> - Replace `ShaderData` constructors with the new `Asset<Effect>` approach:
> Old:
> ```new ArmorShaderData(new Ref<Effect>(Mod.Assets.Request<Effect>("Assets/Effects/ExampleEffect", AssetRequestMode.ImmediateLoad).Value), "ExampleDyePass")```
> New:
> ```new ArmorShaderData(Mod.Assets.Request<Effect>("Assets/Effects/ExampleEffect"), "ExampleDyePass")```
-->

# 改进素材加载 API 及其指南
by **Chicken Bones****jopojelly**
**提交**<https://github.com/tModLoader/tModLoader/compare/3ed8e6e...58ed35b>
**更新至预览版**:2024-03-22 04:28(因其重要性直接进入预览版)
**更新至稳定版**:2024-04-01 09:00
**运行时破坏性**:🟢 - ****
**代码破坏性**:🟢 - ****,但你应该根据指南修改代码;下个月,`ShaderData` 的改动将产生编译异常。

## 简要总结
- 我们注意到许多模组没让 `Assets<T>` 达到应有的效率;此次更新会帮助模组制作者们改善性能,缩减加载时间。
- 新增了[关于如何正确使用类 `Asset` 的 Wiki 页面](<https://github.com/tModLoader/tModLoader/wiki/Assets>)
- 相应的,[示例模组也根据指南更新了](<https://github.com/tModLoader/tModLoader/pull/4121>)
- 新增了警告长时间 `AssetRequestMode.ImmediateLoad` 的模组加载日志。
- 新增了 `ShaderData``Asset<Effect>` 构造函数,提高着色器加载效率。

## 提示
- 请阅读 [`Asset` 的 Wiki 页面](<https://github.com/tModLoader/tModLoader/wiki/Assets>)并遵守其中的准则。
- Replace `ShaderData` constructors with the new `Asset<Effect>` approach:
- 更新构造 `ShaderData` 的方法:
旧:
```new ExampleShaderData(new Ref<Effect>(Mod.Assets.Request<Effect>("Assets/Effects/ExampleEffect", AssetRequestMode.ImmediateLoad).Value), "ExampleDyePass")```
新:
```new ExampleShaderData(Mod.Assets.Request<Effect>("Assets/Effects/ExampleEffect"), "ExampleDyePass")```

<!--
# 改进素材加载 API 及其指南
by Chicken Bones 和 jopojelly
提交:https://github.com/tModLoader/tModLoader/compare/3ed8e6e...58ed35b
更新至预览版:2024-03-22 04:28(因其重要性直接进入预览版)
更新至稳定版:2024-04-01 09:00
运行时破坏性:🟢 - 无
代码破坏性:🟢 - 无,但你应该根据指南修改代码;下个月,ShaderData 的改动将产生编译异常。
## 简要总结
- 我们注意到许多模组没让 Assets<T> 达到应有的效率;此次更新会帮助模组制作者们改善性能,缩减加载时间。
- 新增了关于如何正确使用类 Asset 的 Wiki 页面(https://github.com/tModLoader/tModLoader/wiki/Assets)。
- 相应的,示例模组也根据指南更新了(https://github.com/tModLoader/tModLoader/pull/4121>)。
- 新增了警告长时间 AssetRequestMode.ImmediateLoad 的模组加载日志。
- 新增了 ShaderData 的 Asset<Effect> 构造函数,提高着色器加载效率。
## 提示
- 请阅读 Asset 的 Wiki 页面(https://github.com/tModLoader/tModLoader/wiki/Assets)并遵守其中的准则。
- Replace ShaderData constructors with the new Asset<Effect> approach:
- 更新构造 ShaderData 的方法:
旧:
new ExampleShaderData(new Ref<Effect>(Mod.Assets.Request<Effect>("Assets/Effects/ExampleEffect", AssetRequestMode.ImmediateLoad).Value), "ExampleDyePass")
新:
new ExampleShaderData(Mod.Assets.Request<Effect>("Assets/Effects/ExampleEffect"), "ExampleDyePass")
-->

0 comments on commit 7589c62

Please sign in to comment.