apply JEI extra areas to missing GUIs

This commit is contained in:
PrototypeTrousers
2022-08-19 11:32:41 -03:00
parent 2e98ec015c
commit 430ee8430d
2 changed files with 42 additions and 52 deletions
@@ -61,7 +61,7 @@ import appeng.parts.automation.PartImportBus;
public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
{
private final Map<Target<?>,Object> mapTargetSlot = new HashMap<>();
private final Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
protected final ContainerUpgradeable cvb;
protected final IUpgradeableHost bc;
@@ -97,6 +97,20 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
this.addButtons();
}
@Override
public List<Rectangle> getJEIExclusionArea()
{
List<Rectangle> exclusionArea = new ArrayList<>();
int yOffset = guiTop + 8;
int visibleButtons = (int) this.buttonList.stream().filter( v -> v.enabled && v.x < guiLeft ).count();
Rectangle sortDir = new Rectangle( guiLeft - 18, yOffset, 18, visibleButtons * 18 + visibleButtons - 2 );
exclusionArea.add( sortDir );
return exclusionArea;
}
protected void addButtons()
{
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
@@ -218,7 +232,7 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
}
@Override
public List<Target<?>> getPhantomTargets(Object ingredient)
public List<Target<?>> getPhantomTargets( Object ingredient )
{
mapTargetSlot.clear();
@@ -236,7 +250,9 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
}
if( !( ingredient instanceof ItemStack ) && !( ingredient instanceof FluidStack ) )
{
return Collections.emptyList();
}
List<Target<?>> targets = new ArrayList<>();
@@ -300,7 +316,10 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
}
else
{
if( finalFluidStack == null ) return;
if( finalFluidStack == null )
{
return;
}
p = new PacketInventoryAction( InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack( AEFluidStack.fromFluidStack( finalFluidStack ).asItemStackRepresentation() ) );
}
NetworkHandler.instance().sendToServer( p );