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

Added compile time BlockState #347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Alvsch
Copy link
Contributor

@Alvsch Alvsch commented Nov 27, 2024

Description

Added block_state! macro for compile time BlockState

Testing

Loading into a pre-generated minecraft world, moving around and generating new chunks

Checklist

Things need to be done before this Pull Request can be merged.

  • Code is well-formatted and adheres to project style guidelines: cargo fmt
  • Code does not produce any clippy warnings: cargo clippy
  • All unit tests pass: cargo test
  • I added new unit tests, so other people don't accidentally break my code by changing other parts of the codebase. How?

@kralverde
Copy link
Contributor

Do you think you can also add a static reference to state to block state and also add the block id to state?

@Snowiiii
Copy link
Owner

We now have duplicate code and also load the JSON twice which is a waste of RAM

@Alvsch
Copy link
Contributor Author

Alvsch commented Nov 28, 2024

We now have duplicate code and also load the JSON twice which is a waste of RAM

I would like to fix that, but cyclic dependencies caused a bit of problems

@Snowiiii
Copy link
Owner

We now have duplicate code and also load the JSON twice which is a waste of RAM

I would like to fix that, but cyclic dependencies caused a bit of problems

Whats are the Problems?. Why you can't just remove it in pumpkin-world ?

@Alvsch
Copy link
Contributor Author

Alvsch commented Nov 28, 2024

Whats are the Problems?. Why you can't just remove it in pumpkin-world ?

We can't remove it from pumpkin-world because some functions require it at runtime as the values aren't known at compile time, such as commands.

We now have duplicate code and also load the JSON twice which is a waste of RAM

I would like to fix that, but cyclic dependencies caused a bit of problems

I realized that pumpkin-macro's static variables are only compile time so what I said before is kind of irrelevant

@kralverde
Copy link
Contributor

We now have duplicate code and also load the JSON twice which is a waste of RAM

No, in the macro the json is loaded at compile time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants