User Tools

Site Tools


tutorial:entity

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:entity [2020/06/11 20:22] – add source link draylartutorial:entity [2020/08/12 14:26] – add link to villager activites emmanuelmess
Line 19: Line 19:
 The two generic entity classes that come after ''LivingEntity'' are: The two generic entity classes that come after ''LivingEntity'' are:
   * ''MobEntity''   * ''MobEntity''
-  * ''MobEntityWithAi''+  * ''PathAwareEntity''
    
-''MobEntity'' has AI logic and movement controls. ''MobEntityWithAi'' provides extra capabilities+''MobEntity'' has AI logic and movement controls. ''PathAwareEntity'' provides extra capabilities
 for pathfinding favor, and various AI tasks require this to operate. for pathfinding favor, and various AI tasks require this to operate.
  
-In this tutorial, we will look at creating a cube entity that extends ''MobEntityWithAi''.+In this tutorial, we will look at creating a cube entity that extends ''PathAwareEntity''.
 This entity will have a model & texture. Movement and mechanics will be covered in a future tutorial. This entity will have a model & texture. Movement and mechanics will be covered in a future tutorial.
  
 ===== Creating & Registering an Entity ===== ===== Creating & Registering an Entity =====
  
-Create a class that extends ''MobEntityWithAi''. This class serves as the brains and main hub for our custom entity.+Create a class that extends ''PathAwareEntity''. This class serves as the brains and main hub for our custom entity.
  
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
 /* /*
- * Our Cube Entity extends MobEntityWithAi, which extends MobEntity, which extends LivingEntity.+ * Our Cube Entity extends PathAwareEntity, which extends MobEntity, which extends LivingEntity.
  *  *
  * LivingEntity has health and can deal damage.  * LivingEntity has health and can deal damage.
  * MobEntity has movement controls and AI capabilities.  * MobEntity has movement controls and AI capabilities.
- MobEntityWithAi has pathfinding favor and slightly tweaked leash behavior.+ PathAwareEntity has pathfinding favor and slightly tweaked leash behavior.
  */  */
-public class CubeEntity extends MobEntityWithAi {+public class CubeEntity extends PathAwareEntity {
  
-    public CubeEntity(EntityType<? extends MobEntityWithAi> entityType, World world) {+    public CubeEntity(EntityType<? extends PathAwareEntity> entityType, World world) {
         super(entityType, world);         super(entityType, world);
     }     }
Line 256: Line 256:
 You can spawn your entity by typing ''/summon entitytesting:cube'' in-game. Press f3+b to view hitboxes: You can spawn your entity by typing ''/summon entitytesting:cube'' in-game. Press f3+b to view hitboxes:
 {{https://i.imgur.com/MmQvluB.png}} {{https://i.imgur.com/MmQvluB.png}}
 +
 +===== Adding tasks & activities =====
 +
 +To add activities see [[:villager_activities|here]].
  
tutorial/entity.txt · Last modified: 2023/09/13 20:30 by nebelnidas