Skip to content

Conversation

@JaaiDead
Copy link
Contributor

@JaaiDead JaaiDead commented Jan 17, 2025

closes #147

https://deploy-preview-267--nimble-elf-d9d491.netlify.app/develop/entities/first-entity


TODO by Earthcomputer

  • Create and register entity and attributes.
  • Add and explain goals
  • And renderer, model and texture
    • This will include the leg swing animation, but not the dancing animation.
    • At this point, the mob can be spawned with /summon.
  • Add TrackedData for dancing, and explain how to use the data tracker for synchronizing values to the client.
  • Add dancingTimeLeft which will be saved and loaded from NBT, explain saving and loading entities from NBT.
  • Add the dancing animation.
  • Add the spawn egg.

@JaaiDead JaaiDead requested review from a team as code owners January 17, 2025 07:40
@JaaiDead JaaiDead marked this pull request as draft January 17, 2025 07:40
@netlify
Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for nimble-elf-d9d491 ready!

Name Link
🔨 Latest commit cfa8042
🔍 Latest deploy log https://app.netlify.com/projects/nimble-elf-d9d491/deploys/693b04a03ec59c0007860d65
😎 Deploy Preview https://deploy-preview-267--nimble-elf-d9d491.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@its-miroma its-miroma added new-content A new page or set of pages help-wanted Anyone is welcome to work on this todo:expand This should be expanded labels Jan 17, 2025
@JaaiDead JaaiDead marked this pull request as ready for review January 18, 2025 16:56
@JaaiDead
Copy link
Contributor Author

Implementation of Client-Side Code needs suggestion , Server Side Code - needs review

@JaaiDead JaaiDead marked this pull request as draft January 18, 2025 17:30
@JaaiDead JaaiDead changed the title Custom Entities Documentation Custom Entities Guide Jan 24, 2025
@its-miroma its-miroma mentioned this pull request Jan 29, 2025
9 tasks
Copy link
Member

@its-miroma its-miroma left a comment

Choose a reason for hiding this comment

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

the article still needs work

JaaiDead and others added 5 commits November 20, 2025 23:03
Co-authored-by: Miroma <its.miroma@proton.me>
Co-authored-by: Miroma <its.miroma@proton.me>
Co-authored-by: Miroma <its.miroma@proton.me>
@JaaiDead
Copy link
Contributor Author

can PR #320 be merged with this PR?

@cassiancc cassiancc marked this pull request as ready for review December 9, 2025 02:37
@cassiancc cassiancc removed the request for review from a team December 11, 2025 15:27
cassiancc
cassiancc previously approved these changes Dec 11, 2025

@[code transcludeWith=:::model_animation](@/reference/latest/src/client/java/com/example/docs/entity/model/MiniGolemEntityModel.java)

Most of the math is provided by Blockbench.
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh? On the contrary, I believe I probably took this from one of vanilla's entities. It swings the legs based on a fairly simple transformation of a sine wave.

Does Blockbench commonly generate this? In which case I would change the wording to suggest that it can be generated by Blockbench, and instead describe the maths directly rather than a hand-wavy "Blockbench will do it for you" comment.


### Using Synched Entity Data {#using-synched-entity-data}

We can store data on the entity itself by defining an `EntityDataAccessor` for it. This data will be synchronized with the client, making it a good place to define our dancing state.
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a little brief to me, although maybe I'm tripping. I think my problem with it is the way it's framed. As a mod developer of course you would do this as a subtask of making a dancing animation, but in a tutorial the important part is introducing the reader to synched entity data and explaining what it's all about. The same goes for the next section as well.

So rather than "we need a place to store our data, ah that's convenient there's this thing we can use to synchronize with the client", it should be "one way to synchronize entity data with the client is to use synched entity data. [Insert a brief introduction of synched entity data]. We will be using this for storing whether the entity is dancing, and synchronizing that information with the client. [Insert how we use synched entity data in this specific case".

Another problem with how this is worded is it implies that the primary purpose for synched entity data is to store data in an entity, when in fact it is to synchronize to the client. If anything doesn't need to be synchronized (and sometimes even if it does), you should use a field or another mechanism.

I think part of the problem is that this is included as a subsection of "adding a dancing animation", rather than a section in its own right. Even though it's part of setting up the animation, the dancing is part of the narrative of the whole tutorial, and only the actual animation itself needs to be under an animation header.


We can store data on the entity itself by defining an `EntityDataAccessor` for it. This data will be synchronized with the client, making it a good place to define our dancing state.

@[code transcludeWith=:::datatracker](@/reference/latest/src/main/java/com/example/docs/entity/MiniGolemEntity.java)
Copy link
Contributor

Choose a reason for hiding this comment

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

There is some animation state code interleaved in here. I think that should be left to the animation section later. (The field and the override of onSyncedDataUpdated.


Looking into the game, you now have all you need to spawn the entity with `/summon example-mod:mini_golem`!

![Spawn Egg showcase](/assets/develop/entity/mini_golem_summoned.png)
Copy link
Contributor

Choose a reason for hiding this comment

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

The alt text here is wrong


Let's make this entity a bit more lively by giving it a dancing animation. We'll create a `MiniGolemAnimations` class with a simple animation that allows the Mini Golem to dance.

@[code transcludeWith=:::dancing_animation](@/reference/latest/src/client/java/com/example/docs/entity/animation/MiniGolemAnimations.java)
Copy link
Contributor

Choose a reason for hiding this comment

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

As explained in the big long comment, I think this part should go in its own section at the end (just before the spawn egg).

Co-authored-by: Joseph Burton <burtonjae@hotmail.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help-wanted Anyone is welcome to work on this new-content A new page or set of pages priority:medium This should be addressed relatively quickly todo:expand This should be expanded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Developer Guides: Entities

4 participants