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
@@ -25,12 +25,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import appeng.client.me.SlotME; import appeng.client.me.SlotME;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.features.ColoredItemDefinition;
import mezz.jei.gui.GuiHelper;
import mezz.jei.gui.elements.GuiIconButton;
import mezz.jei.gui.overlay.bookmarks.BookmarkButton;
import net.minecraftforge.fml.common.Loader;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
@@ -306,11 +300,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
int offset = this.guiTop + 8; int offset = this.guiTop + 8;
if(Loader.isModLoaded("jei")) {
// JEI Bookmark Next page button
offset += 16;
}
if( this.customSortOrder ) if( this.customSortOrder )
{ {
this.buttonList this.buttonList
@@ -410,38 +399,20 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
} }
@Override @Override
public List<Rectangle> getJEIExclusionArea() { public List<Rectangle> getJEIExclusionArea()
{
List<Rectangle> exclusionArea = new ArrayList<>(); List<Rectangle> exclusionArea = new ArrayList<>();
int yOffset = guiTop + 8; int yOffset = guiTop + 8;
if(Loader.isModLoaded("jei")) { int visibleButtons = (int) this.buttonList.stream().filter( v -> v.enabled && v.x < guiLeft ).count();
yOffset += 16; Rectangle sortDir = new Rectangle( guiLeft - 18, yOffset, 20, visibleButtons * 20 + visibleButtons - 2 );
}
if(this.customSortOrder) {
Rectangle sortOrder = new Rectangle(guiLeft - 18, yOffset, 18, 18);
exclusionArea.add(sortOrder);
yOffset += 20;
}
if(this.viewCell || this instanceof GuiWirelessTerm) {
Rectangle viewMode = new Rectangle(guiLeft - 18, yOffset, 18, 18);
exclusionArea.add(viewMode);
yOffset += 20;
}
Rectangle sortDir = new Rectangle(guiLeft - 18, yOffset, 18, 18);
exclusionArea.add( sortDir ); exclusionArea.add( sortDir );
yOffset += 20;
Rectangle searchSettings = new Rectangle(guiLeft - 18, yOffset, 18, 18); if( this.viewCell )
exclusionArea.add(searchSettings); {
yOffset += 20; Rectangle viewMode = new Rectangle( guiLeft + 205, yOffset, 24, 19 * monitorableContainer.getViewCells().length );
exclusionArea.add( viewMode );
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm ) {
Rectangle terminalStyle = new Rectangle(guiLeft - 18, yOffset, 18, 18);
exclusionArea.add(terminalStyle);
} }
return exclusionArea; return exclusionArea;
@@ -97,6 +97,20 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
this.addButtons(); 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() protected void addButtons()
{ {
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE ); this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
@@ -236,7 +250,9 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
} }
if( !( ingredient instanceof ItemStack ) && !( ingredient instanceof FluidStack ) ) if( !( ingredient instanceof ItemStack ) && !( ingredient instanceof FluidStack ) )
{
return Collections.emptyList(); return Collections.emptyList();
}
List<Target<?>> targets = new ArrayList<>(); List<Target<?>> targets = new ArrayList<>();
@@ -300,7 +316,10 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
} }
else 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() ) ); p = new PacketInventoryAction( InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack( AEFluidStack.fromFluidStack( finalFluidStack ).asItemStackRepresentation() ) );
} }
NetworkHandler.instance().sendToServer( p ); NetworkHandler.instance().sendToServer( p );