Проблема с рендером стекла и корпуса

Версия Minecraft
1.7.10
Господа, приветствую. Надеюсь на вашу помощь. Так вот, у меня случился один неприятный конфуз при добавлении моделей, в формате OBJ в игру. Вроде, сначала, все было замечательно, но потом я заметил, что при просмотре в окно автомобиля, пропадает салон самого автомобиля. К сожалению, из-за моих скудных знаний в OpenGL я не могу решить данную проблему.
2021-01-07_20.16.15.png
2021-01-07_20.16.24.png
К моему большому сожалению, появилась еще одна неприятная проблема, но при добавлении уже другой модели. Прошу заметить, в программе данной проблемы нет, и модель, и ее текстура отображается корректно.
2021-01-07_20.25.24.png
Java:
public class RenderTileEntityBMW extends TileEntitySpecialRenderer {

public static final ResourceLocation BodyT = new ResourceLocation("decor", "textures/volumetric/car/bmw/body_black.png");
public static final ResourceLocation GlassT = new ResourceLocation("decor", "textures/volumetric/car/bmw/glass.png");
public static final ResourceLocation SalonT = new ResourceLocation("decor", "textures/volumetric/car/bmw/salon.png");
public static final ResourceLocation WheelsT = new ResourceLocation("decor", "textures/volumetric/car/bmw/wheels.png");
 
    public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float pt) {      
        GL11.glPushMatrix();
        Minecraft.getMinecraft().renderEngine.bindTexture(BodyT);
        GL11.glDisable(GL11.GL_CULL_FACE);
       GL11.glTranslated(x, y, z);
        GL11.glTranslatef(0.5F, 0.0F, 0.5F);
        if (tile != null) {
            switch(((TileEntityBMW) tile).getSide()) {
            case 0:
                GL11.glTranslatef(0F, 1F, 0F);
                GL11.glRotatef(180F, 1F, 0F, 0F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 1:
                GL11.glRotatef(180F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 2:
                GL11.glTranslatef(0F, 0.5F, 0.5F);
                GL11.glRotatef(-90F, 1F, 0F, 0F);
                GL11.glRotatef(90F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 3:
                GL11.glTranslatef(0F, 0.5F, -0.5F);
                GL11.glRotatef(90F, 1F, 0F, 0F);
                GL11.glRotatef(90F + ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 4:
                GL11.glTranslatef(0.5F, 0.5F, 0F);
                GL11.glRotatef(90F, 0F, 0F, 1F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 5:
                GL11.glTranslatef(-0.5F, 0.5F, 0F);
                GL11.glRotatef(-90F, 0F, 0F, 1F);
                GL11.glRotatef((180F - ((TileEntityBMW) tile).getRotate()) + 180F, 0F, 1F, 0F);
                break;
            }
        }
        GL11.glCallList(EncryptionBMW.getRenderBMW("bmw", "bmw"));
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
       
        GL11.glPushMatrix();
        Minecraft.getMinecraft().renderEngine.bindTexture(GlassT);
        GL11.glClearColor(1.0F, 1.0F, 1.0F, 1.0F);
           GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.68F);
        GL11.glDisable(GL11.GL_CULL_FACE);
           GL11.glEnable(GL11.GL_BLEND);
       GL11.glTranslated(x, y, z);
        GL11.glTranslatef(0.5F, 0.0F, 0.5F);
        if (tile != null) {
            switch(((TileEntityBMW) tile).getSide()) {
            case 0:
                GL11.glTranslatef(0F, 1F, 0F);
                GL11.glRotatef(180F, 1F, 0F, 0F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 1:
                GL11.glRotatef(180F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 2:
                GL11.glTranslatef(0F, 0.5F, 0.5F);
                GL11.glRotatef(-90F, 1F, 0F, 0F);
                GL11.glRotatef(90F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 3:
                GL11.glTranslatef(0F, 0.5F, -0.5F);
                GL11.glRotatef(90F, 1F, 0F, 0F);
                GL11.glRotatef(90F + ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 4:
                GL11.glTranslatef(0.5F, 0.5F, 0F);
                GL11.glRotatef(90F, 0F, 0F, 1F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 5:
                GL11.glTranslatef(-0.5F, 0.5F, 0F);
                GL11.glRotatef(-90F, 0F, 0F, 1F);
                GL11.glRotatef((180F - ((TileEntityBMW) tile).getRotate()) + 180F, 0F, 1F, 0F);
                break;
            }
        }
        GL11.glCallList(EncryptionBMW.getRenderGlass("bmw", "bmw"));
        GL11.glEnable(GL11.GL_CULL_FACE);
           GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopMatrix();
       
        GL11.glPushMatrix();
        Minecraft.getMinecraft().renderEngine.bindTexture(SalonT);
        GL11.glDisable(GL11.GL_CULL_FACE);
       GL11.glTranslated(x, y, z);
        GL11.glTranslatef(0.5F, 0.0F, 0.5F);
        if (tile != null) {
            switch(((TileEntityBMW) tile).getSide()) {
            case 0:
                GL11.glTranslatef(0F, 1F, 0F);
                GL11.glRotatef(180F, 1F, 0F, 0F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 1:
                GL11.glRotatef(180F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 2:
                GL11.glTranslatef(0F, 0.5F, 0.5F);
                GL11.glRotatef(-90F, 1F, 0F, 0F);
                GL11.glRotatef(90F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 3:
                GL11.glTranslatef(0F, 0.5F, -0.5F);
                GL11.glRotatef(90F, 1F, 0F, 0F);
                GL11.glRotatef(90F + ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 4:
                GL11.glTranslatef(0.5F, 0.5F, 0F);
                GL11.glRotatef(90F, 0F, 0F, 1F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 5:
                GL11.glTranslatef(-0.5F, 0.5F, 0F);
                GL11.glRotatef(-90F, 0F, 0F, 1F);
                GL11.glRotatef((180F - ((TileEntityBMW) tile).getRotate()) + 180F, 0F, 1F, 0F);
                break;
            }
        }
        GL11.glCallList(EncryptionBMW.getRenderSalon("bmw", "bmw"));
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
       
        GL11.glPushMatrix();
        Minecraft.getMinecraft().renderEngine.bindTexture(WheelsT);
        GL11.glDisable(GL11.GL_CULL_FACE);
       GL11.glTranslated(x, y, z);
        GL11.glTranslatef(0.5F, 0.0F, 0.5F);
        if (tile != null) {
            switch(((TileEntityBMW) tile).getSide()) {
            case 0:
                GL11.glTranslatef(0F, 1F, 0F);
                GL11.glRotatef(180F, 1F, 0F, 0F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 1:
                GL11.glRotatef(180F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 2:
                GL11.glTranslatef(0F, 0.5F, 0.5F);
                GL11.glRotatef(-90F, 1F, 0F, 0F);
                GL11.glRotatef(90F - ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 3:
                GL11.glTranslatef(0F, 0.5F, -0.5F);
                GL11.glRotatef(90F, 1F, 0F, 0F);
                GL11.glRotatef(90F + ((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 4:
                GL11.glTranslatef(0.5F, 0.5F, 0F);
                GL11.glRotatef(90F, 0F, 0F, 1F);
                GL11.glRotatef(((TileEntityBMW) tile).getRotate(), 0F, 1F, 0F);
                break;
            case 5:
                GL11.glTranslatef(-0.5F, 0.5F, 0F);
                GL11.glRotatef(-90F, 0F, 0F, 1F);
                GL11.glRotatef((180F - ((TileEntityBMW) tile).getRotate()) + 180F, 0F, 1F, 0F);
                break;
            }
        }
        GL11.glCallList(EncryptionBMW.getRenderWheels("bmw", "bmw"));
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
           
            if(Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
              {
                 GL11.glPushMatrix();
                 GL11.glTranslated(x, y, z);
                 GL11.glEnable(3042);
                 GL11.glColor4f(0.0F, 1.0F, 0.0F, 0.4F);
                 GL11.glDisable(3553);
                 Vec3 min = Vec3.createVectorHelper(((TileEntityBMW) tile).minX, ((TileEntityBMW) tile).minY, ((TileEntityBMW) tile).minZ);
                 Vec3 max = Vec3.createVectorHelper(((TileEntityBMW) tile).maxX - 1.0D, ((TileEntityBMW) tile).maxY - 1.0D, ((TileEntityBMW) tile).maxZ - 1.0D);
                 Util.drawWorldBounds(Tessellator.instance, min, max, false);
                 GL11.glDisable(3042);
                 GL11.glEnable(3553);
                 GL11.glPopMatrix();
    }
    }
}
Java:
public class RenderTileEntityHazzel extends TileEntitySpecialRenderer {
   
      public static final ResourceLocation BodyT = new ResourceLocation("decor", "textures/volumetric/car/hazell/body.png");
      public static final ResourceLocation WindowsT = new ResourceLocation("decor", "textures/volumetric/car/hazell/windows.png");
      public static final ResourceLocation WheelsT = new ResourceLocation("decor", "textures/volumetric/car/hazell/wheels.png");
     
        public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float pt) {      
            GL11.glPushMatrix();
            Minecraft.getMinecraft().renderEngine.bindTexture(BodyT);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glTranslated(x, y, z);
            GL11.glTranslatef(0.5F, 0.0F, 0.5F);
            if (tile != null) {
                switch(((TileEntityHazzel) tile).getSide()) {
                case 0:
                    GL11.glTranslatef(0F, 1F, 0F);
                    GL11.glRotatef(180F, 1F, 0F, 0F);
                    GL11.glRotatef(((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 1:
                    GL11.glRotatef(180F - ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 2:
                    GL11.glTranslatef(0F, 0.5F, 0.5F);
                    GL11.glRotatef(-90F, 1F, 0F, 0F);
                    GL11.glRotatef(90F - ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 3:
                    GL11.glTranslatef(0F, 0.5F, -0.5F);
                    GL11.glRotatef(90F, 1F, 0F, 0F);
                    GL11.glRotatef(90F + ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 4:
                    GL11.glTranslatef(0.5F, 0.5F, 0F);
                    GL11.glRotatef(90F, 0F, 0F, 1F);
                    GL11.glRotatef(((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 5:
                    GL11.glTranslatef(-0.5F, 0.5F, 0F);
                    GL11.glRotatef(-90F, 0F, 0F, 1F);
                    GL11.glRotatef((180F - ((TileEntityHazzel) tile).getRotate()) + 180F, 0F, 1F, 0F);
                    break;
                }
            }
            GL11.glCallList(EncryptionHazzel.getRenderHazzel("hazell", "hazell"));
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glPopMatrix();
           
            GL11.glPushMatrix();
            Minecraft.getMinecraft().renderEngine.bindTexture(WindowsT);
            GL11.glClearColor(1.0F, 1.0F, 1.0F, 1.0F);
               GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.68F);
            GL11.glDisable(GL11.GL_CULL_FACE);
               GL11.glEnable(GL11.GL_BLEND);
            GL11.glTranslated(x, y, z);
            GL11.glTranslatef(0.5F, 0.0F, 0.5F);
            if (tile != null) {
                switch(((TileEntityHazzel) tile).getSide()) {
                case 0:
                    GL11.glTranslatef(0F, 1F, 0F);
                    GL11.glRotatef(180F, 1F, 0F, 0F);
                    GL11.glRotatef(((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 1:
                    GL11.glRotatef(180F - ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 2:
                    GL11.glTranslatef(0F, 0.5F, 0.5F);
                    GL11.glRotatef(-90F, 1F, 0F, 0F);
                    GL11.glRotatef(90F - ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 3:
                    GL11.glTranslatef(0F, 0.5F, -0.5F);
                    GL11.glRotatef(90F, 1F, 0F, 0F);
                    GL11.glRotatef(90F + ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 4:
                    GL11.glTranslatef(0.5F, 0.5F, 0F);
                    GL11.glRotatef(90F, 0F, 0F, 1F);
                    GL11.glRotatef(((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 5:
                    GL11.glTranslatef(-0.5F, 0.5F, 0F);
                    GL11.glRotatef(-90F, 0F, 0F, 1F);
                    GL11.glRotatef((180F - ((TileEntityHazzel) tile).getRotate()) + 180F, 0F, 1F, 0F);
                    break;
                }
            }
            GL11.glCallList(EncryptionHazzel.getRenderHazzel_Windows("hazell", "hazell"));
            GL11.glEnable(GL11.GL_CULL_FACE);
               GL11.glDisable(GL11.GL_BLEND);
            GL11.glPopMatrix();
           
            GL11.glPushMatrix();
            Minecraft.getMinecraft().renderEngine.bindTexture(WheelsT);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glTranslated(x, y, z);
            GL11.glTranslatef(0.5F, 0.0F, 0.5F);
            if (tile != null) {
                switch(((TileEntityHazzel) tile).getSide()) {
                case 0:
                    GL11.glTranslatef(0F, 1F, 0F);
                    GL11.glRotatef(180F, 1F, 0F, 0F);
                    GL11.glRotatef(((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 1:
                    GL11.glRotatef(180F - ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 2:
                    GL11.glTranslatef(0F, 0.5F, 0.5F);
                    GL11.glRotatef(-90F, 1F, 0F, 0F);
                    GL11.glRotatef(90F - ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 3:
                    GL11.glTranslatef(0F, 0.5F, -0.5F);
                    GL11.glRotatef(90F, 1F, 0F, 0F);
                    GL11.glRotatef(90F + ((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 4:
                    GL11.glTranslatef(0.5F, 0.5F, 0F);
                    GL11.glRotatef(90F, 0F, 0F, 1F);
                    GL11.glRotatef(((TileEntityHazzel) tile).getRotate(), 0F, 1F, 0F);
                    break;
                case 5:
                    GL11.glTranslatef(-0.5F, 0.5F, 0F);
                    GL11.glRotatef(-90F, 0F, 0F, 1F);
                    GL11.glRotatef((180F - ((TileEntityHazzel) tile).getRotate()) + 180F, 0F, 1F, 0F);
                    break;
                }
            }
            GL11.glCallList(EncryptionHazzel.getRenderHazzel_Wheels("hazell", "hazell"));
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glPopMatrix();
               
                if(Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
                  {
                     GL11.glPushMatrix();
                     GL11.glTranslated(x, y, z);
                     GL11.glEnable(3042);
                     GL11.glColor4f(0.0F, 1.0F, 0.0F, 0.4F);
                     GL11.glDisable(3553);
                     Vec3 min = Vec3.createVectorHelper(((TileEntityHazzel) tile).minX, ((TileEntityHazzel) tile).minY, ((TileEntityHazzel) tile).minZ);
                     Vec3 max = Vec3.createVectorHelper(((TileEntityHazzel) tile).maxX - 1.0D, ((TileEntityHazzel) tile).maxY - 1.0D, ((TileEntityHazzel) tile).maxZ - 1.0D);
                     Util.drawWorldBounds(Tessellator.instance, min, max, false);
                     GL11.glDisable(3042);
                     GL11.glEnable(3553);
                     GL11.glPopMatrix();
        }
        }
}
 
167
10
69
На счет первой проблемы тебе нужно стекло рендерить отдельно и добавить ему прозрачность
Java:
public static void renderHelmet(RenderPlayer renderModel, ItemStack stack) {
    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    renderModel.modelBipedMain.bipedHead.postRender(0.0625F);
    GL11.glRotatef(180.0f, 1F, 0F, 0F);
    GL11.glScalef(1.0f, 1.0f, 1.0f);
    GL11.glTranslatef(0f, -1.5f, 0f);
    GL11.glCallList(ClientProxy.getRenderPart(model, "head"));
    GL11.glPopMatrix();
   
    //примерно так делал стекло в шлеме прозрачное
    if(stack.getUnlocalizedName().contains("tarzan")) {
        GL11.glDepthMask(false);
        GL11.glClearColor(1.0f, 1.0f, 1.0f, 0.8f);          
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.7f);

        GL11.glEnable(3042);
        GL11.glPushMatrix();
        GL11.glBlendFunc(770, 771);
        Minecraft.getMinecraft().renderEngine.bindTexture(texture);
        renderModel.modelBipedMain.bipedHead.postRender(0.0625F);
        GL11.glRotatef(180.0f, 1F, 0F, 0F);
        GL11.glScalef(1.0f, 1.0f, 1.0f);
        GL11.glTranslatef(0f, -1.5f, 0f);  
        GL11.glCallList(ClientProxy.getRenderPart(model, "visor"));
        GL11.glDisable(3042);
        GL11.glDepthMask(true);
        GL11.glPopMatrix();
    }
}

На счет второй проблемы попробуй
 
Последнее редактирование:
Сверху