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 Spawn Egg Functionality #350

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

OfficialKris
Copy link
Contributor

@OfficialKris OfficialKris commented Nov 29, 2024

Description

Adds initial mob support through spawn eggs. All spawn eggs work. No random characteristics are applied (ex. horse color or slime size). Serves as a basis for future work such as mob AI.

  • Added entities.json and extractor
  • Added entities registry
  • Added support for right clicking spawn egg and spawning entity
  • Added add_living_entity function to server and world and corresponding structures
  • Living entities spawn facing the player and at the location of the player's cursor

Testing

Tested both block placing and egg spawning
Tested spawning many different types of eggs

Future work on separate PRs:

  • Entities_Registry Enum as a macro
  • Random unique characteristics (horses color, slime size)
  • Mob AI
  • Mob attributes (health, affects)
  • Mob spawning

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?

TODO:

  • Fix constant player kicking after interacting with mobs (only attacks between players are allowed currently).
  • Add mobs to server implementation
  • Spawn rotation faces player

@Snowiiii
Copy link
Owner

Any progress on this ?

@OfficialKris
Copy link
Contributor Author

OfficialKris commented Dec 20, 2024

I was thinking that this should come in after an item manager. But maybe this could be merged in before that. However, I am finishing up the interactive blocks pr before this.

@OfficialKris OfficialKris marked this pull request as ready for review December 26, 2024 05:39
@Snowiiii
Copy link
Owner

For some reason the entity ids seem to be wrong at some type, For example spawning a Zombie will result in spawning a Zombie Horse (Which is the next Type), And Spawning a Zombie Horse will result in Spawning a Zombie Villager (Which is the next type)

@OfficialKris
Copy link
Contributor Author

First 30 entities were correct. The creaking_transient entity was removed from the list so the elements after were off by one. Fixed

@Snowiiii
Copy link
Owner

Just made an entity extractor my own (wanted to do that for a long time already), It also has the max_health for living entities, (The health is always random so its the max_health and not a static number as of my understanding). See 29ed502

@OfficialKris
Copy link
Contributor Author

Fixed with new entities extractor support. All good to go. Idk why the cargo formatting check failed. cargo fmt --check is all good on my end.

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.

2 participants