GuiContainerFluidHatch.java 文件源码

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

项目:ModularMachinery 作者:
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    super.drawGuiContainerForegroundLayer(mouseX, mouseY);

    FluidStack content = tank.getTank().getFluid();
    if(content != null && content.amount > 0) {
        int fluidColor = content.getFluid().getColor(content);
        float red   = (fluidColor >> 16 & 0xFF) / 255F;
        float green = (fluidColor >>  8 & 0xFF) / 255F;
        float blue  = (fluidColor       & 0xFF) / 255F;

        float percFilled = ((float) content.amount) / ((float) tank.getTank().getCapacity());
        percFilled = MathHelper.clamp(percFilled, 0F, 1F);
        int pxFilled = MathHelper.ceil(percFilled * 61F);
        GlStateManager.color(red, green, blue, 1.0F);
        ResourceLocation rl = content.getFluid().getStill(content);
        TextureAtlasSprite tas = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(rl.toString());
        if(tas == null) {
            tas = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
        }
        this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        drawTexturedModalRect(15, 10 + 61 - pxFilled, tas, 20, pxFilled);
    } else if (ModularMachinery.isMekanismLoaded){
        drawMekGasContent();
    }
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(TEXTURES_FLUID_HATCH);
    this.drawTexturedModalRect(15, 10, 176, 0, 20, 61);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号