Skip to content

fix: Fix CODEC in tutorial#427

Closed
jacobwojoski wants to merge 7 commits intoHytaleModding:mainfrom
jacobwojoski:main
Closed

fix: Fix CODEC in tutorial#427
jacobwojoski wants to merge 7 commits intoHytaleModding:mainfrom
jacobwojoski:main

Conversation

@jacobwojoski
Copy link
Contributor

@jacobwojoski jacobwojoski commented Feb 10, 2026

Pull Request

Description

  • Update ECS example to properly apply CODEC when registering the component so saving and loading of component data works correctly.

Type of Change

  • Documentation fix (typo, grammar, clarification)
  • New documentation (guide, tutorial, page)
  • Bug fix
  • New feature
  • Other

Screenshots

If applicable, add before/after screenshots:

Checklist

  • Tested locally with bun run dev
  • Ran bun audit (no critical vulnerabilities)
  • Checked spelling and grammar
  • Verified all links work
  • Followed Contributing Guidelines

Thank you for contributing!

Update the plugin to store the componentType in the component class. Also add in a component codec builder to allow component storage to disk.
Add a few additional comments
Add aditional comment about throw comdition
Fix this call to comp thats not local anymore
@oskarscot
Copy link
Collaborator

oskarscot commented Feb 10, 2026

This already exists in 2 guides and is greatly covered here: https://hytalemodding.dev/en/docs/guides/ecs/hytale-ecs-theory#codec
Mentioned in Block Components guide as well: https://hytalemodding.dev/en/docs/guides/ecs/block-components

@oskarscot oskarscot closed this Feb 10, 2026
@jacobwojoski
Copy link
Contributor Author

jacobwojoski commented Feb 10, 2026

Even though its specified in another location, Currently the example doesn't properly use the CODEC making it dead code. Wouldn't it still be worth updating the example to show how to properly use the CODEC? Or just remove the CODEC from the example.

@ItsNeil17
Copy link
Member

I think we should just update the example to reflect the correct code, all our examples across the website need to be consistent.

@oskarscot
Copy link
Collaborator

oskarscot commented Feb 10, 2026

I think we should just update the example to reflect the correct code, all our examples across the website need to be consistent.

In this specific example it's actually not wise to use a codec as this example showcases a component used for a temporary player state change, like the DeathComponent, which you wouldn't persist (which is what codec does and this PR tries to implement).

There are example here, using the PosionComponent as an example: https://hytalemodding.dev/en/docs/guides/ecs/hytale-ecs-theory#codec (example of a codec to persist a persist component)

This is also done here: https://hytalemodding.dev/en/docs/guides/ecs/block-components (custom block with a persistent component but no data)

Codecs are used for all persistence across hytale thus I believe having them covered in the ECS theory guide is appropriate.

If you really want to display codec usage, which already is done along with the rest of ECS types then please do it with an appropriate example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants