apply JEI extra areas to missing GUIs
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
@@ -258,9 +252,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
|
|
||||||
this.maxRows = this.getMaxRows();
|
this.maxRows = this.getMaxRows();
|
||||||
this.perRow = AEConfig.instance()
|
this.perRow = AEConfig.instance()
|
||||||
.getConfigManager()
|
.getConfigManager()
|
||||||
.getSetting(
|
.getSetting(
|
||||||
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||||
|
|
||||||
final int magicNumber = 114 + 1;
|
final int magicNumber = 114 + 1;
|
||||||
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
||||||
@@ -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
|
||||||
@@ -326,22 +315,22 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.buttonList.add( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc
|
this.buttonList.add( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc
|
||||||
.getSetting( Settings.SORT_DIRECTION ) ) );
|
.getSetting( Settings.SORT_DIRECTION ) ) );
|
||||||
offset += 20;
|
offset += 20;
|
||||||
|
|
||||||
this.buttonList.add(
|
this.buttonList.add(
|
||||||
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
|
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
|
||||||
.getConfigManager()
|
.getConfigManager()
|
||||||
.getSetting(
|
.getSetting(
|
||||||
Settings.SEARCH_MODE ) ) );
|
Settings.SEARCH_MODE ) ) );
|
||||||
|
|
||||||
offset += 20;
|
offset += 20;
|
||||||
|
|
||||||
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
|
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
|
||||||
{
|
{
|
||||||
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance()
|
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance()
|
||||||
.getConfigManager()
|
.getConfigManager()
|
||||||
.getSetting( Settings.TERMINAL_STYLE ) ) );
|
.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.searchField = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
|
this.searchField = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
|
||||||
@@ -354,7 +343,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
if( this.viewCell || this instanceof GuiWirelessTerm )
|
if( this.viewCell || this instanceof GuiWirelessTerm )
|
||||||
{
|
{
|
||||||
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus
|
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus
|
||||||
.getLocal(), this.itemRender ) );
|
.getLocal(), this.itemRender ) );
|
||||||
this.craftingStatusBtn.setHideEdge( 13 );
|
this.craftingStatusBtn.setHideEdge( 13 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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 );
|
||||||
}
|
exclusionArea.add( sortDir );
|
||||||
|
|
||||||
if(this.customSortOrder) {
|
if( this.viewCell )
|
||||||
Rectangle sortOrder = new Rectangle(guiLeft - 18, yOffset, 18, 18);
|
{
|
||||||
exclusionArea.add(sortOrder);
|
Rectangle viewMode = new Rectangle( guiLeft + 205, yOffset, 24, 19 * monitorableContainer.getViewCells().length );
|
||||||
yOffset += 20;
|
exclusionArea.add( viewMode );
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
yOffset += 20;
|
|
||||||
|
|
||||||
Rectangle searchSettings = new Rectangle(guiLeft - 18, yOffset, 18, 18);
|
|
||||||
exclusionArea.add(searchSettings);
|
|
||||||
yOffset += 20;
|
|
||||||
|
|
||||||
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm ) {
|
|
||||||
Rectangle terminalStyle = new Rectangle(guiLeft - 18, yOffset, 18, 18);
|
|
||||||
exclusionArea.add(terminalStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return exclusionArea;
|
return exclusionArea;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ import appeng.parts.automation.PartImportBus;
|
|||||||
|
|
||||||
public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
|
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 ContainerUpgradeable cvb;
|
||||||
protected final IUpgradeableHost bc;
|
protected final IUpgradeableHost bc;
|
||||||
|
|
||||||
@@ -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 );
|
||||||
@@ -218,7 +232,7 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Target<?>> getPhantomTargets(Object ingredient)
|
public List<Target<?>> getPhantomTargets( Object ingredient )
|
||||||
{
|
{
|
||||||
mapTargetSlot.clear();
|
mapTargetSlot.clear();
|
||||||
|
|
||||||
@@ -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 );
|
||||||
|
|||||||
Reference in New Issue
Block a user