GuiBarrel.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:Bewitchment 作者:
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    this.drawDefaultBackground();
    if (te != null) {
        FluidStack fstack = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(1000, false);
        Minecraft.getMinecraft().renderEngine.bindTexture(texture);
        drawTexturedModalRect(guiLeft + 62, guiTop + 17, 176, 32, 52, 16);
        if (fstack == null) {
            drawTexturedModalRect(guiLeft + 80, guiTop + 17, xSize, 0, 16, 16);
        } else {
            TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
            TextureAtlasSprite sprite = map.getTextureExtry(fstack.getFluid().getStill().toString());
            Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            for (int i = 0; i < 4; i++) drawTexturedModalRect(guiLeft + 62 + (16 * i), guiTop + 17, sprite, 16, 16);
        }
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    if (te != null) {

        int[] data = ((ContainerBarrel) inventorySlots).data_a;
        if (data[2] > 0) {
            double progress = (double) data[0] / (double) data[2];
            if (progress > 1) progress = 1;
            int dy = (int) Math.ceil(31 * progress);
            drawTexturedModalRect(guiLeft + 29, guiTop + 27 + 31 - dy, 0, ySize + 31 - dy, 11, dy);
        }
        float absorption = 1;
        if (data[3] > 0) absorption = (float) data[1] / (float) data[3];
        GlStateManager.pushMatrix();
        {
            GlStateManager.color(2 * (1f - absorption), 2 * absorption, 0f);
            drawTexturedModalRect(guiLeft + 134, guiTop + 20, xSize, 16, 16, 16);
            GlStateManager.color(1f, 1f, 1f);
        }
        GlStateManager.popMatrix();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号