本文整理汇总了Java中net.minecraft.client.renderer.entity.RenderPlayer.getMainModel方法的典型用法代码示例。如果您正苦于以下问题:Java RenderPlayer.getMainModel方法的具体用法?Java RenderPlayer.getMainModel怎么用?Java RenderPlayer.getMainModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.entity.RenderPlayer
的用法示例。
在下文中一共展示了RenderPlayer.getMainModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: injectModel
import net.minecraft.client.renderer.entity.RenderPlayer; //导入方法依赖的package包/类
void injectModel(EntityPlayer player) {
Minecraft mc = Minecraft.getMinecraft();
Render<EntityPlayer> pr = mc.getRenderManager().getEntityRenderObject(player);
if (!((Render) pr instanceof RenderPlayer)) {
if (!invalid) {
Core.logWarning("Unable to patch Player model!");
}
invalid = true;
return;
}
RenderPlayer playerRenderer = (RenderPlayer) (Render) pr;
ModelRenderer head = playerRenderer.getMainModel().bipedHead;
if (head.childModels != null) {
for (Iterator<ModelRenderer> it = head.childModels.iterator(); it.hasNext(); ) {
ModelRenderer child = it.next();
if (child instanceof LmpMaskRenderer) {
it.remove();
}
}
}
head.addChild(new LmpMaskRenderer(playerRenderer.getMainModel()));
}
示例2: replaceOldModel
import net.minecraft.client.renderer.entity.RenderPlayer; //导入方法依赖的package包/类
public static void replaceOldModel() {
RenderPlayer renderer = getOldRenderer("default");
if(renderer == null) {
InfinityLib.instance.getLogger().debug("Failed overriding left arm swing behaviour");
return;
}
ModelPlayer oldModel = renderer.getMainModel();
ModelPlayer newModel = null;
for(Field field : RenderLivingBase.class.getDeclaredFields()) {
if(field.getType() == ModelBase.class) {
try {
field.setAccessible(true);
Object obj = field.get(renderer);
if (obj == oldModel) {
newModel = MODEL_MAIN;
field.set(renderer, newModel);
break;
}
} catch (Exception e) {
InfinityLib.instance.getLogger().printStackTrace(e);
}
}
}
if(newModel != null) {
//replace relevant fields in RenderPlayer
replaceEntriesInRenderPlayer(renderer, newModel);
replaceEntriesInRenderPlayer(getOldRenderer("slim"), MODEL_SLIM);
}
}
示例3: getTarget
import net.minecraft.client.renderer.entity.RenderPlayer; //导入方法依赖的package包/类
private static ModelBiped getTarget(RenderPlayer render, ModelBase chest, ModelBase legs, boolean onBack) {
if (chest instanceof ModelBiped) {
return (ModelBiped) chest;
} else if (legs instanceof ModelBiped && !onBack) {
return (ModelBiped) legs;
}
return render.getMainModel();
}