package info.u_team.u_team_core.gui.render;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;

public class FluidInventoryRender {
	
	private static final ResourceLocation ATLAS = PlayerContainer.LOCATION_BLOCKS_TEXTURE;
	
	private static TextureAtlasSprite getFluidSprite(FluidStack fluidStack) {
		return Minecraft.getInstance().getAtlasSpriteGetter(ATLAS).apply(fluidStack.getFluid().getAttributes().getStillTexture(fluidStack));
	}
	
}

@@ -49,103 +49,380 @@
 ort 
-net.minecraft.client.Minecraft;%0Aimport net.minecraft.client.renderer.texture.TextureAtlasSprite
+com.mojang.blaze3d.systems.RenderSystem;%0A%0Aimport info.u_team.u_team_core.util.RGBA;%0Aimport net.minecraft.client.Minecraft;%0Aimport net.minecraft.client.gui.AbstractGui;%0Aimport net.minecraft.client.renderer.*;%0Aimport net.minecraft.client.renderer.texture.TextureAtlasSprite;%0Aimport net.minecraft.client.renderer.vertex.DefaultVertexFormats;%0Aimport net.minecraft.fluid.Fluids
 ;%0Aim
@@ -601,16 +601,36 @@
 yRender 
+extends AbstractGui 
 %7B%0A%09%0A%09pri
@@ -717,29 +717,174 @@
 RE;%0A%09%0A%09p
-rivate static
+ublic void drawFluid(int x, int y, FluidStack stack) %7B%0A%09%09if (stack == null %7C%7C stack.isEmpty() %7C%7C stack.getFluid() == Fluids.EMPTY) %7B%0A%09%09%09return;%0A%09%09%7D%0A%09%09%0A%09%09final
  Texture
@@ -894,16 +894,25 @@
 asSprite
+ sprite =
  getFlui
@@ -923,165 +923,1611 @@
 ite(
-FluidStack fluidStack) %7B%0A%09%09return Minecraft.getInstance().getAtlasSpriteGetter(ATLAS).apply(fluidStack.getFluid().getAttributes().getStillTexture(fluidStack)
+stack);%0A%09%09Minecraft.getInstance().getTextureManager().bindTexture(ATLAS);%0A%09%09%0A%09%09final RGBA rgba = new RGBA(stack.getFluid().getAttributes().getColor(stack));%0A%09%09%0A%09%09RenderSystem.color4f(rgba.getRedComponent(), rgba.getGreenComponent(), rgba.getBlueComponent(), rgba.getAlphaComponent());%0A%09%09%0A%09%09drawTextureWithMasking(x, y, sprite, 0, 0, 100);%0A%09%09%0A%09%09RenderSystem.color4f(1, 1, 1, 1);%0A%09%7D%0A%09%0A%09private TextureAtlasSprite getFluidSprite(FluidStack stack) %7B%0A%09%09return Minecraft.getInstance().getAtlasSpriteGetter(ATLAS).apply(stack.getFluid().getAttributes().getStillTexture(stack));%0A%09%7D%0A%09%0A%09private void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) %7B%0A%09%09double uMin = textureSprite.getMinU();%0A%09%09double uMax = textureSprite.getMaxU();%0A%09%09double vMin = textureSprite.getMinV();%0A%09%09double vMax = textureSprite.getMaxV();%0A%09%09uMax = uMax - (maskRight / 16.0 * (uMax - uMin));%0A%09%09vMax = vMax - (maskTop / 16.0 * (vMax - vMin));%0A%09%09%0A%09%09Tessellator tessellator = Tessellator.getInstance();%0A%09%09BufferBuilder bufferBuilder = tessellator.getBuffer();%0A%09%09bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);%0A%09%09bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex((float) uMin, (float) vMax).endVertex();%0A%09%09bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex((float) uMax, (float) vMax).endVertex();%0A%09%09bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex((float) uMax, (float) vMin).endVertex();%0A%09%09bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex((float) uMin, (float) vMin).endVertex();%0A%09%09tessellator.draw(
 );%0A%09

Add some methods to draw the fluid