tutorial:entity
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:entity [2021/07/15 19:07] – [Spawning your Entity] logdawg970 | tutorial:entity [2022/01/11 16:31] – external edit 127.0.0.1 | ||
---|---|---|---|
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 151: | Line 151: | ||
return new CubeEntityRenderer(context); | return new CubeEntityRenderer(context); | ||
}); | }); | ||
+ | // In 1.17, use EntityRendererRegistry.register (seen below) instead of EntityRendererRegistry.INSTANCE.register (seen above) | ||
+ | EntityRendererRegistry.register(EntityTesting.CUBE, | ||
+ | return new CubeEntityRenderer(context); | ||
+ | }); | ||
+ | | ||
+ | EntityModelLayerRegistry.registerModelLayer(MODEL_CUBE_LAYER, | ||
} | } | ||
} | } | ||
Line 194: | Line 200: | ||
ModelData modelData = new ModelData(); | ModelData modelData = new ModelData(); | ||
ModelPartData modelPartData = modelData.getRoot(); | ModelPartData modelPartData = modelData.getRoot(); | ||
- | modelPartData.addChild(EntityModelPartNames.CUBE, | + | modelPartData.addChild(EntityModelPartNames.CUBE, |
} | } | ||
</ | </ | ||
Line 219: | Line 225: | ||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { | public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { | ||
ImmutableList.of(this.base).forEach((modelRenderer) -> { | ImmutableList.of(this.base).forEach((modelRenderer) -> { | ||
- | modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha); | + | modelRenderer.render(matrices, vertices, light, overlay, red, green, blue, alpha); |
}); | }); | ||
} | } |
tutorial/entity.txt · Last modified: 2024/04/30 20:42 by ryhon