Skip to content

Commit

Permalink
Expose what entity types have renderers to the AddLayer event (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster authored Jan 24, 2024
1 parent dc41867 commit 6ce6a23
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -158,6 +157,13 @@ public <R extends EntityRenderer<? extends Player>> R getSkin(PlayerSkin.Model s
return (R) skinMap.get(skinModel);
}

/**
* {@return the set of entity types which have a renderer}
*/
public Set<EntityType<?>> getEntityTypes() {
return renderers.keySet();
}

/**
* Returns an entity renderer for the given entity type. Note that the returned renderer may not be a
* {@link LivingEntityRenderer}.
Expand All @@ -169,7 +175,7 @@ public <R extends EntityRenderer<? extends Player>> R getSkin(PlayerSkin.Model s
*/
@Nullable
@SuppressWarnings("unchecked")
public <T extends LivingEntity, R extends EntityRenderer<T>> R getRenderer(EntityType<? extends T> entityType) {
public <T extends Entity, R extends EntityRenderer<T>> R getRenderer(EntityType<? extends T> entityType) {
return (R) renderers.get(entityType);
}

Expand Down

0 comments on commit 6ce6a23

Please sign in to comment.