Skip to content

Commit

Permalink
Fixed checking for render class being "too early (even during postini…
Browse files Browse the repository at this point in the history
…t)" causing mobs from mods to render with no renderer. Fixes #75
  • Loading branch information
iChun committed Sep 1, 2013
1 parent d16c7b2 commit 003c2ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
14 changes: 8 additions & 6 deletions morph/client/core/ClientProxy.java
Expand Up @@ -10,6 +10,7 @@
import morph.client.model.ModelList;
import morph.common.Morph;
import morph.common.core.CommonProxy;
import morph.common.core.EntityHelper;
import morph.common.core.ObfHelper;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.client.model.ModelBase;
Expand Down Expand Up @@ -72,8 +73,12 @@ else if(f.getType() == Class.class)

for(int i = compatibleEntities.size() - 1; i >= 0; i--)
{
Render rend = RenderManager.instance.getEntityClassRenderObject(compatibleEntities.get(i));
if(rend.getClass() == RenderEntity.class)
if(renders.containsKey(compatibleEntities.get(i)))
{
continue;
}
Render rend = EntityHelper.getEntityClassRenderObject(compatibleEntities.get(i));
if(rend != null && rend.getClass() == RenderEntity.class)
{
rend = renders.get(compatibleEntities.get(i));
}
Expand All @@ -82,10 +87,7 @@ else if(f.getType() == Class.class)
compatibleEntities.remove(i);
continue;
}
if(!renders.containsKey(compatibleEntities.get(i)))
{
renders.put(compatibleEntities.get(i), (RendererLivingEntity)rend);
}
renders.put(compatibleEntities.get(i), (RendererLivingEntity)rend);
}

for(Class clz : compatibleEntities)
Expand Down
17 changes: 15 additions & 2 deletions morph/common/core/EntityHelper.java
Expand Up @@ -9,6 +9,8 @@
import morph.common.morph.MorphHandler;
import morph.common.morph.MorphInfo;
import morph.common.morph.MorphState;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.IBossDisplayData;
Expand All @@ -17,14 +19,25 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class EntityHelper
{

@SideOnly(Side.CLIENT)
public static Render getEntityClassRenderObject(Class par1Class)
{
Render render = (Render)RenderManager.instance.entityRenderMap.get(par1Class);
if (render == null && par1Class != Entity.class)
{
render = getEntityClassRenderObject(par1Class.getSuperclass());
}
return render;
}

public static boolean morphPlayer(EntityPlayerMP player, EntityLivingBase living, boolean kill)
{
if(!(Morph.childMorphs != 0 || Morph.childMorphs == 0 && !living.isChild()) && (Morph.playerMorphs != 0 || Morph.playerMorphs == 0 && !(living instanceof EntityPlayer)) && (Morph.bossMorphs != 0 || Morph.bossMorphs == 0 && !(living instanceof IBossDisplayData)))
Expand Down

0 comments on commit 003c2ed

Please sign in to comment.