本文整理汇总了Java中net.minecraft.client.model.ModelRenderer.addChild方法的典型用法代码示例。如果您正苦于以下问题:Java ModelRenderer.addChild方法的具体用法?Java ModelRenderer.addChild怎么用?Java ModelRenderer.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.model.ModelRenderer
的用法示例。
在下文中一共展示了ModelRenderer.addChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifyModel
import net.minecraft.client.model.ModelRenderer; //导入方法依赖的package包/类
private static boolean modifyModel(ModelAdapter modelAdapter, ModelBase model, CustomModelRenderer customModelRenderer, ModelResolver modelResolver)
{
String s = customModelRenderer.getModelPart();
ModelRenderer modelrenderer = modelAdapter.getModelRenderer(model, s);
if (modelrenderer == null)
{
Config.warn("Model part not found: " + s + ", model: " + model);
return false;
}
else
{
if (!customModelRenderer.isAttach())
{
if (modelrenderer.cubeList != null)
{
modelrenderer.cubeList.clear();
}
if (modelrenderer.spriteList != null)
{
modelrenderer.spriteList.clear();
}
if (modelrenderer.childModels != null)
{
modelrenderer.childModels.clear();
}
}
modelrenderer.addChild(customModelRenderer.getModelRenderer());
ModelUpdater modelupdater = customModelRenderer.getModelUpdater();
if (modelupdater != null)
{
modelResolver.setThisModelRenderer(customModelRenderer.getModelRenderer());
modelResolver.setPartModelRenderer(modelrenderer);
if (!modelupdater.initialize(modelResolver))
{
return false;
}
customModelRenderer.getModelRenderer().setModelUpdater(modelupdater);
}
return true;
}
}
示例2: createModel
import net.minecraft.client.model.ModelRenderer; //导入方法依赖的package包/类
@Override
public void createModel()
{
this.textureHeight = 32;
this.textureWidth = 64;
ModelRenderer body = new ModelRenderer(this, "body");
body.addBox(0, 0, 0, 4, 6, 10);
body.setRotationPoint(-2, 11.5F, -5);
ModelRenderer wingL = new ModelRenderer(this, "wingL").setTextureOffset(28, 0);
wingL.addBox(0, -0.5F, 0, 4, 1, 9);
wingL.setRotationPoint(0, 0, 0);
body.addChild(wingL);
ModelRenderer wingR = new ModelRenderer(this, "wingR").setTextureOffset(28, 0);
wingR.addBox(0, -0.5F, 0, 4, 1, 9);
wingR.setRotationPoint(4, 0, 0);
body.addChild(wingR);
ModelRenderer tail = new ModelRenderer(this, "tail").setTextureOffset(0, 16);
tail.addBox(0, 0, 0, 2, 4, 6);
tail.setRotationPoint(1, 0, 9);
body.addChild(tail);
ModelRenderer tail2 = new ModelRenderer(this, "tail2").setTextureOffset(16, 16);
tail2.addBox(0, 0, 0, 1, 2, 5);
tail2.setRotationPoint(0.5F, 0, 1);
tail2.rotateAngleX = (float)Math.toRadians(25);
tail.addChild(tail2);
ModelRenderer legL = new ModelRenderer(this, "legL").setTextureOffset(28, 10);
legL.addBox(0, 0, 0, 2, 4, 2);
legL.setRotationPoint(-1, 5, 4);
legL.rotateAngleX = 0.174533F;
body.addChild(legL);
ModelRenderer legL2 = new ModelRenderer(this, "legL2").setTextureOffset(36, 10);
legL2.addBox(0, 0, 0, 1, 4, 1);
legL2.setRotationPoint(0.5F, 3.5F, 0.5F);
legL2.rotateAngleX = -0.174533F;
legL.addChild(legL2);
ModelRenderer legL3 = new ModelRenderer(this, "legL3").setTextureOffset(28, 16);
legL3.addBox(0, 0, 0, 3, 1, 3);
legL3.setRotationPoint(-1F, 3, -1F);
legL2.addChild(legL3);
ModelRenderer legR = new ModelRenderer(this, "legR").setTextureOffset(28, 10);
legR.addBox(0, 0, 0, 2, 4, 2);
legR.setRotationPoint(3, 5, 4);
legR.rotateAngleX = 0.174533F;
body.addChild(legR);
ModelRenderer legR2 = new ModelRenderer(this, "legR2").setTextureOffset(36, 10);
legR2.addBox(0, 0, 0, 1, 4, 1);
legR2.setRotationPoint(0.5F, 3.5F, 0.5F);
legR2.rotateAngleX = -0.174533F;
legR.addChild(legR2);
ModelRenderer legR3 = new ModelRenderer(this, "legR3").setTextureOffset(28, 16);
legR3.addBox(0, 0, 0, 3, 1, 3);
legR3.setRotationPoint(-1F, 3, -1F);
legR2.addChild(legR3);
ModelRenderer head = new ModelRenderer(this, "head").setTextureOffset(40, 16);
head.addBox(-1.5F, 0, -4, 3, 4, 3);
head.setRotationPoint(2F,-2,1.5F);
body.addChild(head);
ModelRenderer beak = new ModelRenderer(this, "beak").setTextureOffset(54, 0);
beak.addBox(0, 0, 0, 2, 1, 2);
beak.setRotationPoint(-1,1,-6);
head.addChild(beak);
ModelRenderer comb = new ModelRenderer(this, "comb").setTextureOffset(40, 10);
comb.addBox(0, 0, 0, 1, 2, 4);
comb.setRotationPoint(-0.5F,-2,-4);
head.addChild(comb);
ModelRenderer comb2 = new ModelRenderer(this, "comb2").setTextureOffset(50, 10);
comb2.addBox(0, 0, 0, 2, 3, 1);
comb2.setRotationPoint(-1F,2,-5);
head.addChild(comb2);
this.components.add(body);
}