Fluid cleanup and performance improvements (#3581)

Use custom gui widget with custom synchronization for rendering fake fluid slots.
This commit is contained in:
fscan
2018-07-04 19:12:12 +02:00
committed by GitHub
parent 979531afb7
commit 5d26b98ab8
40 changed files with 1499 additions and 777 deletions
@@ -21,11 +21,14 @@ package appeng.fluids.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.implementations.IUpgradeableHost;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.core.localization.GuiText;
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
import appeng.fluids.client.gui.widgets.GuiOptionalFluidSlot;
import appeng.fluids.container.ContainerFluidIO;
import appeng.fluids.parts.PartFluidImportBus;
import appeng.fluids.parts.PartSharedFluidBus;
import appeng.fluids.util.IAEFluidTank;
/**
@@ -35,10 +38,34 @@ import appeng.fluids.parts.PartFluidImportBus;
*/
public class GuiFluidIO extends GuiUpgradeable
{
private final PartSharedFluidBus bus;
public GuiFluidIO( InventoryPlayer inventoryPlayer, IUpgradeableHost te )
public GuiFluidIO( InventoryPlayer inventoryPlayer, PartSharedFluidBus te )
{
super( new ContainerFluidIO( inventoryPlayer, te ) );
this.bus = te;
}
@Override
public void initGui()
{
super.initGui();
final ContainerFluidIO container = (ContainerFluidIO) this.inventorySlots;
final IAEFluidTank inv = this.bus.getConfig();
final int y = 40;
final int x = 80;
this.guiSlots.add( new GuiFluidSlot( inv, 0, 0, x, y ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 1, 1, 1, x, y, -1, 0 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 2, 2, 1, x, y, 1, 0 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 3, 3, 1, x, y, 0, -1 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 4, 4, 1, x, y, 0, 1 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 5, 5, 2, x, y, -1, -1 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 6, 6, 2, x, y, 1, -1 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 7, 7, 2, x, y, -1, 1 ) );
this.guiSlots.add( new GuiOptionalFluidSlot( inv, container, 8, 8, 2, x, y, 1, 1 ) );
}
@Override