tutorial:entity
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:entity [2021/09/26 12:23] – Add missing bracket and update for 1.17 skullition | tutorial:entity [2025/03/31 13:02] (current) – new Identifier -> Identifier.of slainlight | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Creating an Entity ===== | ===== Creating an Entity ===== | ||
- | //The source code for this project can be found [[https:// | + | //The source code for this project can be found [[https:// |
Entities are a movable object in a world with logic attached to them. A few examples include: | Entities are a movable object in a world with logic attached to them. A few examples include: | ||
Line 10: | Line 10: | ||
Living Entities are Entities that have health and can deal damage. | Living Entities are Entities that have health and can deal damage. | ||
There are various classes that branch off `LivingEntity` for different purposes, including: | There are various classes that branch off `LivingEntity` for different purposes, including: | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
* '' | * '' | ||
- | * '' | + | * '' |
- | What you extend depends on your needs and goals are. | + | What you extend depends on what your needs and goals are. |
As you get further down the chain, the entity logic becomes more specific and curated to certain tasks. | As you get further down the chain, the entity logic becomes more specific and curated to certain tasks. | ||
The two generic entity classes that come after '' | The two generic entity classes that come after '' | ||
Line 61: | Line 61: | ||
*/ | */ | ||
public static final EntityType< | public static final EntityType< | ||
- | | + | |
- | | + | Identifier.of(" |
- | | + | |
); | ); | ||
Line 131: | Line 131: | ||
@Override | @Override | ||
public Identifier getTexture(CubeEntity entity) { | public Identifier getTexture(CubeEntity entity) { | ||
- | return | + | return Identifier.of(" |
} | } | ||
} | } | ||
Line 140: | Line 140: | ||
@Environment(EnvType.CLIENT) | @Environment(EnvType.CLIENT) | ||
public class EntityTestingClient implements ClientModInitializer { | public class EntityTestingClient implements ClientModInitializer { | ||
- | public static final EntityModelLayer MODEL_CUBE_LAYER = new EntityModelLayer(new Identifier(" | + | public static final EntityModelLayer MODEL_CUBE_LAYER = new EntityModelLayer(Identifier.of(" |
@Override | @Override | ||
public void onInitializeClient() { | public void onInitializeClient() { | ||
Line 151: | Line 151: | ||
return new CubeEntityRenderer(context); | return new CubeEntityRenderer(context); | ||
}); | }); | ||
- | // In 1.17, use EntityRendererRegistry.register instead of EntityRendererRegistry.INSTANCE.register | + | // In 1.17, use EntityRendererRegistry.register |
EntityRendererRegistry.register(EntityTesting.CUBE, | EntityRendererRegistry.register(EntityTesting.CUBE, | ||
return new CubeEntityRenderer(context); | return new CubeEntityRenderer(context); | ||
Line 197: | Line 197: | ||
} | } | ||
| | ||
+ | // You can use BlockBench, make your model and export it to get this method for your entity model. | ||
public static TexturedModelData getTexturedModelData() { | public static TexturedModelData getTexturedModelData() { | ||
ModelData modelData = new ModelData(); | ModelData modelData = new ModelData(); | ||
ModelPartData modelPartData = modelData.getRoot(); | ModelPartData modelPartData = modelData.getRoot(); | ||
modelPartData.addChild(EntityModelPartNames.CUBE, | modelPartData.addChild(EntityModelPartNames.CUBE, | ||
+ | return TexturedModelData.of(modelData, | ||
} | } | ||
</ | </ | ||
Line 274: | Line 276: | ||
===== Adding tasks & activities ===== | ===== Adding tasks & activities ===== | ||
- | To add activities see [[: | + | To add activities see [[tutorial: |
tutorial/entity.1632658982.txt.gz · Last modified: 2021/09/26 12:23 by skullition