package info.u_team.u_team_core.gui;

import info.u_team.u_team_core.container.*;
import info.u_team.u_team_core.gui.render.FluidInventoryRender;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.*;
import net.minecraftforge.fluids.FluidStack;

@OnlyIn(Dist.CLIENT)
public abstract class FluidContainerScreen<T extends Container> extends ContainerScreen<T> {
	
	private static final FluidInventoryRender FLUID_RENDERER = new FluidInventoryRender();
	
	public FluidContainerScreen(T container, PlayerInventory playerInventory, ITextComponent title) {
		super(container, playerInventory, title);
	}
	
	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
		if (container instanceof FluidContainer) {
			final FluidContainer fluidContainer = (FluidContainer) container;
			for (int index = 0; index < fluidContainer.fluidSlots.size(); index++) {
				// drawFluidSlot(fluidContainer.fluidSlots.get(index));
			}
		}
		
		FLUID_RENDERER.drawFluid(8, 18, new FluidStack(Fluids.WATER, 10));
	}
	
	protected void drawFluidSlot(FluidSlot slot) {
		final int x = slot.getX();
		final int y = slot.getY();
		final FluidStack stack = slot.getStack();
		
		FLUID_RENDERER.drawFluid(x, y, stack);
	}
	
}

@@ -31,16 +31,65 @@
 e.gui;%0A%0A
+import com.mojang.blaze3d.systems.RenderSystem;%0A%0A
 import i
@@ -736,16 +736,57 @@
 er();%0A%09%0A
+%09protected FluidSlot hoveredFluidSlot;%0A%09%0A
 %09public 
@@ -1055,16 +1055,48 @@
 iner) %7B%0A
+%09%09%09hoveredFluidSlot = null;%0A%09%09%09%0A
 %09%09%09final
@@ -1240,40 +1240,333 @@
 %09%09%09%09
-// drawFluidSlot(fluidContainer.
+%0A%09%09%09%09final FluidSlot fluidSlot = fluidContainer.fluidSlots.get(index);%0A%09%09%09%09%0A%09%09%09%09if (fluidSlot.isEnabled()) %7B%0A%09%09%09%09%09drawFluidSlot(fluidSlot);%0A%09%09%09%09%7D%0A%09%09%09%09%0A%09%09%09%09if (isFluidSlotSelected(fluidSlot, mouseX, mouseY) && fluidSlot.isEnabled()) %7B%0A%09%09%09%09%09hoveredFluidSlot = fluidSlot;%0A%09%09%09%09%09final int x = fluidSlot.getX();%0A%09%09%09%09%09final int y = 
 flui
@@ -1574,22 +1574,339 @@
 Slot
-s
 .get
-(index));
+Y();%0A%09%09%09%09%09RenderSystem.disableDepthTest();%0A%09%09%09%09%09RenderSystem.colorMask(true, true, true, false);%0A%09%09%09%09%09final int slotColor = 0x80FFFFFF; // TODO basic slot color for now%0A%09%09%09%09%09fillGradient(x, y, x + 16, y + 16, slotColor, slotColor);%0A%09%09%09%09%09RenderSystem.colorMask(true, true, true, true);%0A%09%09%09%09%09RenderSystem.enableDepthTest();%0A%09%09%09%09%7D
 %0A%09%09%09
@@ -2028,17 +2028,22 @@
 uidSlot 
-s
+fluidS
 lot) %7B%0A%09
@@ -2057,17 +2057,22 @@
 int x = 
-s
+fluidS
 lot.getX
@@ -2091,17 +2091,22 @@
 int y = 
-s
+fluidS
 lot.getY
@@ -2136,17 +2136,22 @@
 stack = 
-s
+fluidS
 lot.getS
@@ -2207,10 +2207,191 @@
 );%0A%09%7D%0A%09%0A
+%09private boolean isFluidSlotSelected(FluidSlot fluidSlot, double mouseX, double mouseY) %7B%0A%09%09return isPointInRegion(fluidSlot.getX(), fluidSlot.getY(), 16, 16, mouseX, mouseY);%0A%09%7D%0A%09%0A
 %7D%0A

Add method to draw the hovered slot and set a hoveredFluidSlot variable