Fix game crashing when modded entities are present (#6364)

This commit is contained in:
bl4ckscor3 2019-12-19 06:56:01 +01:00 committed by tterrag
parent 83ebdcd8f2
commit 40de19f16e
2 changed files with 19 additions and 1 deletions

View file

@ -1,6 +1,23 @@
--- a/net/minecraft/client/renderer/entity/EntityRendererManager.java
+++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java
@@ -445,4 +445,8 @@
@@ -183,13 +183,15 @@
this.field_178637_m = new PlayerRenderer(this);
this.field_178636_l.put("default", this.field_178637_m);
this.field_178636_l.put("slim", new PlayerRenderer(this, true));
+ }
+ //FORGE: Validate the existence of a renderer for each entity type after modded entity renderers have been added
+ public void validateRendererExistence() {
for(EntityType<?> entitytype : Registry.field_212629_r) {
if (entitytype != EntityType.field_200729_aH && !this.field_78729_o.containsKey(entitytype)) {
throw new IllegalStateException("No renderer registered for " + Registry.field_212629_r.func_177774_c(entitytype));
}
}
-
}
public <T extends Entity> EntityRenderer<? super T> func_78713_a(T p_78713_1_) {
@@ -445,4 +447,8 @@
public FontRenderer func_78716_a() {
return this.field_78736_p;
}

View file

@ -47,6 +47,7 @@ public class RenderingRegistry
public static void loadEntityRenderers(EntityRendererManager manager)
{
INSTANCE.entityRenderers.forEach((key, value) -> register(manager, key, value));
manager.validateRendererExistence();
}
@SuppressWarnings("unchecked")