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

Entity docs #171

Draft
wants to merge 61 commits into
base: main
Choose a base branch
from
Draft

Conversation

IchHabeHunger54
Copy link
Member

@IchHabeHunger54 IchHabeHunger54 commented Oct 3, 2024

Adds some long-needed entity documentation. Supersedes #15 and #95 . Closes #90 . This PR:

  • Adds articles about the following:
    • Entities in general
    • Data and networking in the context of entities
    • The LivingEntity, Mob and Player classes, along with their subclasses
    • Attributes and AttributeModifiers
    • Entity renderers and entity models
  • Removes the Entities article in the Networking section, in favor of the new Data and Networking article
  • Updates the Interaction Pipeline article with left-click and middle-click behavior, and also renames it to just Interactions
  • Adds and adjusts links to the new Entities section as necessary
  • Explicitly leaves WIP markers for pathfinding, goals and brains, as these deserve their own PR

This PR is a draft, and many sections are TODOs. Opening now for early feedback.


Preview URL: https://pr-171.neoforged-docs-previews.pages.dev

IchHabeHunger54 and others added 30 commits January 29, 2024 18:04
Co-authored-by: ChampionAsh5357 <[email protected]>
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) October 30, 2024 18:08 Active
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) October 30, 2024 18:32 Active
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) October 30, 2024 18:59 Active
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) November 5, 2024 17:03 Active
@neoforged-automation neoforged-automation bot added the needs rebase This Pull Request needs to be rebased before being merged label Nov 15, 2024
@neoforged-automation
Copy link

@IchHabeHunger54, this pull request has conflicts, please resolve them for this PR to move forward.

# Conflicts:
#	docs/items/index.md
#	docs/items/interactionpipeline.md
#	docs/items/tools.md
#	docs/resources/server/enchantments/builtin.md
@neoforged-automation neoforged-automation bot removed the needs rebase This Pull Request needs to be rebased before being merged label Nov 15, 2024
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) November 15, 2024 23:20 Active
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) November 20, 2024 15:48 Active
@IchHabeHunger54 IchHabeHunger54 requested a review from a team November 20, 2024 15:50
Copy link
Contributor

@ChampionAsh5357 ChampionAsh5357 left a comment

Choose a reason for hiding this comment

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

General comments without looking at the sections that still need to be written. Make sure the information is relevant to 1.21.3. Otherwise, nice job.

docs/blocks/index.md Outdated Show resolved Hide resolved
docs/entities/index.md Show resolved Hide resolved
docs/entities/index.md Outdated Show resolved Hide resolved
```java
@Override
// The boolean return value determines whether the entity was actually damaged or not.
public boolean hurt(DamageSource damageSource, float amount) {
Copy link
Contributor

Choose a reason for hiding this comment

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

hurt is a final method, are you trying to refer to hurtServer and hurtClient? I'm guessing this was probably written before the 1.21.2 update.


- `#tick`: This is the central tick method, and the one you will want to override in 99% of cases.
- By default, this forwards to `#baseTick`, however this is overridden by almost every subclass.
- `#baseTick`: This method handles updating some values common to all entities, including the "on fire" state, freezing from powder snow, the swimming state, and passing through portals.
Copy link
Contributor

Choose a reason for hiding this comment

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

When should I override baseTick then?

docs/entities/livingentity.md Outdated Show resolved Hide resolved
docs/entities/livingentity.md Show resolved Hide resolved
docs/entities/livingentity.md Outdated Show resolved Hide resolved
Comment on lines +156 to +158
Natural spawning is performed every tick for entities where `MobCategory#isFriendly()` is true, and every 400 ticks (\= 20 seconds) for entities where `MobCategory#isFriendly()` is false. If `MobCategory#isPersistent()` returns true, this process additionally also happens on chunk generation.

For each chunk and mob category, it is checked whether there are less than `MobCategory#getMaxInstancesPerChunk() * loadedChunks / 289` in the world. Additionally, for each chunk, it is required that there are less than `MobCategory#getMaxInstancesPerChunk()` entities of that `MobCategory` near at least one player (near means that the distance between mob and player \<\= 128) for spawning of that `MobCategory` to occur.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the detail is good, but it is also very confusing to read and understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't disagree, I just felt it was important to mention it here regardless, and I'm unsure how to improve this.

docs/items/interactions.md Show resolved Hide resolved
@neoforged-pages-deployments neoforged-pages-deployments bot deployed to neoforged-docs-previews (Preview) November 21, 2024 12:48 Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition Adding or rewriting information. large Major additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entities - Simply Complicated
2 participants