Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not wanting to attach to non WorldChunk chunks #80

Open
amusingimpala75 opened this issue Mar 7, 2021 · 1 comment
Open

Not wanting to attach to non WorldChunk chunks #80

amusingimpala75 opened this issue Mar 7, 2021 · 1 comment
Labels
components-chunk enhancement New feature or request

Comments

@amusingimpala75
Copy link

I only wish to add a component to a chunk if it is a WorldChunk, however the register method requires me to always return a component to be attached, even if it is a ReadOnly chunk. The issue arises when I need to grab information from a chunk on registration, but the ReadOnlyChunk's wrapped chunk is not init-ed yet.

  1. Register a chunk component and in the registering process try to cache the ChunkPos of the chunk.
  2. The game should crash with "Cannot invoke getPos in ReadOnlyChunk because this.wrapped is null!"
@UpcraftLP UpcraftLP added bug Something isn't working components-chunk labels Mar 7, 2021
@Pyrofab Pyrofab added enhancement New feature or request and removed bug Something isn't working labels Mar 18, 2021
@Pyrofab
Copy link
Member

Pyrofab commented Mar 18, 2021

A workaround is to have a dummy implementation for your chunk component that you attach to anything that is not a WorldChunk. But this seems to be a fairly common problem, so a proper solution seems in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
components-chunk enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants