當前位置: 首頁>>代碼示例>>Java>>正文


Java ModelRenderer.addChild方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:50,代碼來源:CustomEntityModels.java

示例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);
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:72,代碼來源:ModelChicken.java


注:本文中的net.minecraft.client.model.ModelRenderer.addChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。