Introduction
Viewpoint is a mod for Project Zomboid. It draws the game in first and third person. Other authors can add to it with addons, resource packs and Shaderpacks. Players see each package and control it from the settings window.
The three kinds of package
Section titled “The three kinds of package”| Kind | Contains | Descriptor |
|---|---|---|
| Addon | Java code. It can also contain assets, shader snippets and Lua. | addon.properties |
| Resource Pack | Models, tiles, sounds and data. No Java and no shader code. | pack.properties |
| Shaderpack | GLSL files and their options. No Java. | pack.properties |
A model pack in the older Viewpoint model pack format is a resource pack with the legacy flag. See Package kinds.
What Viewpoint does with your package
Section titled “What Viewpoint does with your package”- It loads your jar in a class loader of its own. Your code can use
viewpoint.api, and the members of Viewpoint that are on the internals list. - It shows your package in the settings window: an addon in Advanced, Addons, a resource pack in Graphics, Resource Packs, and a Shaderpack in Graphics, Shaderpacks. The player orders it, switches it on and off, and reads what it does. A restart is not necessary.
- It checks your jar when it loads it, and shows a label: Normal, Amber or Red. See Labels.
- It installs the hooks that you declare, runs them in the player’s order, and lists each active hook.
- It gives you files, downloads and assets through its services. Each service has a permission and limits.
What you can do in API 1.0
Section titled “What you can do in API 1.0”| To do this | Use | Page |
|---|---|---|
| Read where the view is and what it shows | ViewState, ViewListener | View state |
| Give settings and key bindings | settings.properties, AddonSettings, KeyAction | Settings & keys |
| Read the view state from Lua | Viewpoint.Addons | Lua mirror |
| Give your Java functions to Lua | @LuaExport | Lua exports |
| Keep files | AddonFiles | Files |
| Get a file from the internet | AddonDownloads | Downloads |
| Load models, textures, sounds and data | AddonAssets | Assets |
| Give a feature to other addons | Services | Services |
| Move the camera | CameraLayer, CameraClaim | Camera layers |
| Follow the aim and the shots | AimListener, ShotListener | Aim & shots |
| Choose the model of an object | ModelProvider, AttachmentProvider | Model providers |
| Give numbers to shader code | ShaderValues | Shader values |
| Add a piece of GLSL to a shader | AddonSnippets | Shader snippets |
| Draw with OpenGL | DrawCallback, Gpu | Draw callbacks (planned) |
| Change what a game method does | @Hook | Managed patching |
| Change what a method of Viewpoint does | @Hook on a listed member | Hooking Viewpoint |
| Replace the game’s tile art | The tiles folder of a resource pack | Tiles |
| Choose a model from the state of an object | A version 2 manifest | Model states |
| Change how the whole frame looks | A Shaderpack | Shaderpack format |
A page marked planned is not written yet. Its feature is part of API 1.0. The sidebar group Planned lists these pages.
Licence
Section titled “Licence”The addon API (viewpoint-api.jar), the samples and these pages have the MIT licence. Viewpoint itself has a different
licence. The font of these pages is Roboto Medium, under the Apache 2.0 licence (notice).
Where to go next
Section titled “Where to go next”- Getting started: make the smallest addon and switch it on.
- Sample walkthrough: the samples that use each service.
- Package kinds: which kind of package to make.
- Descriptor: all keys of the descriptors.
- Glossary: the terms these pages use.