Files
AE2FluidCraft-Rework/src/main/java/com/glodblock/github/util/FluidPrimaryGui.java
T
f6b5ab03f1 Universal GUI (#340)
Co-authored-by: Kogepan229 <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2025-12-11 16:09:32 +00:00

40 lines
1.3 KiB
Java

package com.glodblock.github.util;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import appeng.container.PrimaryGui;
public class FluidPrimaryGui extends PrimaryGui {
public FluidPrimaryGui(Object gui, ItemStack guiIcon, TileEntity te, ForgeDirection side) {
super(gui, guiIcon, te, side);
}
@Override
public void open(EntityPlayer p) {
if (gui instanceof GuiType gt) {
if (te != null) {
InventoryHandler.openGui(p, te.getWorldObj(), new BlockPos(te), Objects.requireNonNull(side), gt);
} else {
InventoryHandler.openGui(
p,
p.worldObj,
new BlockPos(
this.slotIndex == Integer.MIN_VALUE ? p.inventory.currentItem : this.slotIndex,
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
0),
Objects.requireNonNull(side),
gt);
}
}
}
}