@Override public HornGlowRenderer addBox(String par1Str, float par2, float par3, float par4, int par5, int par6, int par7) { par1Str = this.boxName + "." + par1Str; TextureOffset var8 = this.baseModel.getTextureOffset(par1Str); this.setTextureOffset(var8.textureOffsetX, var8.textureOffsetY); this.cubeList.add((new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).setBoxName(par1Str)); return this; }
public ModelRendererTFC addBox(String partName, float offX, float offY, float offZ, float width, float height, float depth) { partName = this.boxName + "." + partName; TextureOffset textureoffset = this.baseModel.getTextureOffset(partName); this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY); this.cubeList.add((new ModelBoxTFC(this, textureoffset.textureOffsetX, textureoffset.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F, false)).setBoxName(partName)); return this; }
public ModelRenderer func_78786_a(String p_78786_1_, float p_78786_2_, float p_78786_3_, float p_78786_4_, int p_78786_5_, int p_78786_6_, int p_78786_7_) { p_78786_1_ = this.field_78802_n + "." + p_78786_1_; TextureOffset var8 = this.field_78810_s.func_78084_a(p_78786_1_); this.func_78784_a(var8.field_78783_a, var8.field_78782_b); this.field_78804_l.add((new ModelBox(this, this.field_78803_o, this.field_78813_p, p_78786_2_, p_78786_3_, p_78786_4_, p_78786_5_, p_78786_6_, p_78786_7_, 0.0F)).func_78244_a(p_78786_1_)); return this; }
/** * Get texture offset of the model based on its box */ private int[] getModelOffset(ModelBox box, ModelRenderer renderer, ModelBase model) { TextureOffset offset = model.getTextureOffset(box.boxName); if (offset != null) { return new int[] {offset.textureOffsetX, offset.textureOffsetY}; } int[] zero = new int[] {0, 0}; Field field = this.getFieldByType(TexturedQuad[].class, ModelBox.class); TexturedQuad[] quads; field.setAccessible(true); try { quads = (TexturedQuad[]) field.get(box); } catch (Exception e) { e.printStackTrace(); return zero; } /* Getting the minimum */ float minX = 1.0F; float minY = 1.0F; for (TexturedQuad quad : quads) { for (PositionTextureVertex vertex : quad.vertexPositions) { minX = Math.min(vertex.texturePositionX, minX); minY = Math.min(vertex.texturePositionY, minY); } } minX *= renderer.textureWidth; minY *= renderer.textureHeight; return new int[] {(int) minX, (int) minY}; }
@Override public TextureOffset getTextureOffset(String partName) { return lastUsedModel.getTextureOffset(partName); }
@Override public TextureOffset getTextureOffset(String boxName) { return new TextureOffset(0, 0); }
protected void func_78085_a(String p_78085_1_, int p_78085_2_, int p_78085_3_) { this.field_78094_a.put(p_78085_1_, new TextureOffset(p_78085_2_, p_78085_3_)); }
public TextureOffset func_78084_a(String p_78084_1_) { return (TextureOffset)this.field_78094_a.get(p_78084_1_); }
@SideOnly(Side.CLIENT) public void createChildren(String name, ModelRenderer rend, CubeInfo info) { if(rend.childModels == null) { return; } for(int i = 0; i < rend.childModels.size(); i++) { CubeInfo firstCreated = null; ModelRenderer rend1 = (ModelRenderer)rend.childModels.get(i); for(int j = 0; j < rend1.cubeList.size(); j++) { String fullName = name + (rend1.cubeList.size() == 1 ? "Child" : ("Child - " + j)); ModelBox box = (ModelBox)rend1.cubeList.get(j); if(box.boxName != null) { fullName = box.boxName.substring(box.boxName.lastIndexOf(".") + 1); } CubeInfo info1 = new CubeInfo(fullName); info1.dimensions[0] = (int)Math.abs(box.posX2 - box.posX1); info1.dimensions[1] = (int)Math.abs(box.posY2 - box.posY1); info1.dimensions[2] = (int)Math.abs(box.posZ2 - box.posZ1); info1.position[0] = rend1.rotationPointX; info1.position[1] = rend1.rotationPointY; info1.position[2] = rend1.rotationPointZ; info1.offset[0] = box.posX1; info1.offset[1] = box.posY1; info1.offset[2] = box.posZ1; info1.rotation[0] = Math.toDegrees(rend1.rotateAngleX); info1.rotation[1] = Math.toDegrees(rend1.rotateAngleY); info1.rotation[2] = Math.toDegrees(rend1.rotateAngleZ); info1.scale[0] = info1.scale[1] = info1.scale[2] = 1.0F; info1.txOffset[0] = rend1.textureOffsetX; info1.txOffset[1] = rend1.textureOffsetY; if(box.boxName != null) { TextureOffset textureoffset = rend1.baseModel.getTextureOffset(box.boxName); if(textureoffset != null) { info1.txOffset[0] = textureoffset.textureOffsetX; info1.txOffset[1] = textureoffset.textureOffsetY; } } PositionTextureVertex[] vertices = box.quadList[1].vertexPositions;// left Quad, txOffsetX, txOffsetY + sizeZ info1.txMirror = (((vertices[info1.txMirror ? 1 : 2].vector3D.y - vertices[info1.txMirror ? 3 : 0].vector3D.y) - info1.dimensions[1]) / 2 < 0.0D);//silly techne check to see if the model is really mirrored or not cubeCount++; info.addChild(info1); if(firstCreated == null) { firstCreated = info1; } } if(firstCreated != null) { createChildren(name + "Child", rend1, firstCreated); } } }