From 6ce6a239985e566c7847b7e88ad102a3c9f8c7e7 Mon Sep 17 00:00:00 2001 From: Sara Freimer Date: Wed, 24 Jan 2024 16:30:08 -0600 Subject: [PATCH] Expose what entity types have renderers to the AddLayer event (#562) --- .../neoforge/client/event/EntityRenderersEvent.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/client/event/EntityRenderersEvent.java b/src/main/java/net/neoforged/neoforge/client/event/EntityRenderersEvent.java index 21dd202561..9498a500e9 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/EntityRenderersEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/EntityRenderersEvent.java @@ -25,7 +25,6 @@ import net.minecraft.client.resources.PlayerSkin; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.SkullBlock; import net.minecraft.world.level.block.SkullBlock.Type; @@ -158,6 +157,13 @@ public > R getSkin(PlayerSkin.Model s return (R) skinMap.get(skinModel); } + /** + * {@return the set of entity types which have a renderer} + */ + public Set> getEntityTypes() { + return renderers.keySet(); + } + /** * Returns an entity renderer for the given entity type. Note that the returned renderer may not be a * {@link LivingEntityRenderer}. @@ -169,7 +175,7 @@ public > R getSkin(PlayerSkin.Model s */ @Nullable @SuppressWarnings("unchecked") - public > R getRenderer(EntityType entityType) { + public > R getRenderer(EntityType entityType) { return (R) renderers.get(entityType); }