/**
* Get the renderer's texture
*
* Very hard stuff are going on here
*/
@SideOnly(Side.CLIENT)
@SuppressWarnings({"unchecked", "rawtypes"})
protected void setupTexture()
{
Class<Render> clazz = (Class<Render>) this.renderer.getClass();
for (Method method : clazz.getDeclaredMethods())
{
Class[] args = method.getParameterTypes();
boolean hasEntityArg = args.length == 1 && args[0].isAssignableFrom(Entity.class);
boolean returnsRL = method.getReturnType().isAssignableFrom(ResourceLocation.class);
if (hasEntityArg && returnsRL)
{
try
{
method.setAccessible(true);
this.texture = (ResourceLocation) method.invoke(this.renderer, this.entity);
}
catch (Exception e)
{
Metamorph.log("Failed to get texture of a morph '" + this.name + "'!");
e.printStackTrace();
}
break;
}
}
}
EntityMorph.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:metamorph
作者:
评论列表
文章目录