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

Partial Redstone #621

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft

Partial Redstone #621

wants to merge 40 commits into from

Conversation

4lve
Copy link
Contributor

@4lve 4lve commented Mar 10, 2025

Description

This is a partial redstone implementation that makes a great base for implementing new blocks that use redstone. It also revamped the block state packets, neighbor updates and state updates

Testing

Please follow our Coding Guidelines

@Snowiiii
Copy link
Collaborator

Do you think you could add pressure plates in this PR as well?. This would require to make a system that sends an event when an entity collides with an blocks which we also would need for other things (e.g. Eggs, Snowballs, Enderperals...)

@Snowiiii
Copy link
Collaborator

I also think https://redstone.build/ is a great website to see and understand the existing Vanilla redstone logic

@OfficialKris
Copy link
Contributor

Do you think you could add pressure plates in this PR as well?. This would require to make a system that sends an event when an entity collides with an blocks which we also would need for other things (e.g. Eggs, Snowballs, Enderperals...)

I think vanilla treats throwables differently than other entities. Since arrows get turned into a pickable item after they land they are slighly different than other throwables. That is why they can activate pressure plates. I think the algorithm for collisions is pretty simple from what I saw in the vanilla code. I think I can implement it in #523.

Redstone/pressureplace collisions would just be the same collision function just run on each tick rather than calculated on each tick and in between (think a snowball not colliding because it moved >1 block in-between ticks).

@4lve
Copy link
Contributor Author

4lve commented Mar 11, 2025

Do you think you could add pressure plates in this PR as well?. This would require to make a system that sends an event when an entity collides with an blocks which we also would need for other things (e.g. Eggs, Snowballs, Enderperals...)

Possibly after I'm done with everything else.

@4lve
Copy link
Contributor Author

4lve commented Mar 11, 2025

I also think https://redstone.build/ is a great website to see and understand the existing Vanilla redstone logic

I'm pretty familiar with redstone, the part I'm worried about is locationality

@@ -6,6 +6,19 @@ use serde::Deserialize;
use std::collections::{HashMap, HashSet};
use syn::{Ident, LitBool, LitInt, LitStr};

fn is_state_solid(state: &BlockState, all_shapes: &Vec<CollisionShape>) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn is_state_solid(state: &BlockState, all_shapes: &Vec<CollisionShape>) -> bool {
fn is_state_solid(state: &BlockState, all_shapes: &[CollisionShape]) -> bool {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fixed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but I'm ignoring clippy for now

@4lve 4lve changed the title Redstone Partial Redstone Mar 16, 2025
@Snowiiii Snowiiii requested a review from kralverde March 16, 2025 17:51
Copy link
Contributor

@kralverde kralverde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments.

Also you're going to hate me but is there any possibility of adding tests for redstone? :p

@Snowiiii
Copy link
Collaborator

The first thing i got when started the server

$
  thread 'tokio-runtime-worker' panicked at /home/alex/Documents/Development/Rust/Pumpkin/pumpkin/src/world/mod.rs:1344:45:
                                                                                                                           called `Option::unwrap()` on a `None` value
            note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

My region folder was empty

@4lve
Copy link
Contributor Author

4lve commented Mar 18, 2025

The first thing i got when started the server

$
  thread 'tokio-runtime-worker' panicked at /home/alex/Documents/Development/Rust/Pumpkin/pumpkin/src/world/mod.rs:1344:45:
                                                                                                                           called `Option::unwrap()` on a `None` value
            note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

My region folder was empty

Try now

@Snowiiii Snowiiii requested a review from kralverde March 18, 2025 14:20
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.

5 participants