mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-18 03:25:38 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
294931e89a | ||
|
|
c147d1825f | ||
|
|
5847385043 | ||
|
|
62f7cf2c9f |
No files matched your search
@@ -468,7 +468,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final ItemStack normalizedA = StackInfo.loadFromNBT(nbTagA);
|
||||
BookmarkRecipeId recipeId = null;
|
||||
|
||||
if (handlerName != "" && ingredients != null && !ingredients.isEmpty()) {
|
||||
if (handlerName != "" && ingredients != null) {
|
||||
recipeId = new BookmarkRecipeId(handlerName, ingredients);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
BGrid.removeRecipe(idx, saveIngredients);
|
||||
} else {
|
||||
|
||||
if (saveIngredients && handlerName != "" && ingredients != null && !ingredients.isEmpty()) {
|
||||
if (saveIngredients && handlerName != "" && ingredients != null) {
|
||||
final Map<NBTTagCompound, Integer> unique = new HashMap<>();
|
||||
final ArrayList<NBTTagCompound> sorted = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -340,12 +340,12 @@ public class ItemsGrid {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
final float tooltipYOffset;
|
||||
if (mousey > height / 2) {
|
||||
if (mousey - marginTop > height / 2) {
|
||||
tooltipYOffset = mousey - recipeTooltipGui.getHeightAsWidget() + 8;
|
||||
} else {
|
||||
tooltipYOffset = mousey - 7 + (recipeTooltipLines * 10);
|
||||
tooltipYOffset = mousey + 3 + (recipeTooltipLines * 10);
|
||||
}
|
||||
GL11.glTranslatef(mousex, tooltipYOffset, 100);
|
||||
GL11.glTranslatef(mousex, tooltipYOffset, 500);
|
||||
|
||||
final GuiContainer gui;
|
||||
if (mc.currentScreen instanceof GuiRecipe) {
|
||||
@@ -455,6 +455,9 @@ public class ItemsGrid {
|
||||
drawSlotOutlines(mousex, mousey);
|
||||
drawItems();
|
||||
}
|
||||
}
|
||||
|
||||
public void postDrawTooltips(int mousex, int mousey) {
|
||||
if (NEIClientConfig.showRecipeTooltips() && showRecipeTooltips) {
|
||||
try {
|
||||
drawRecipeTooltip(mousex, mousey);
|
||||
|
||||
@@ -280,6 +280,13 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenderTooltips(GuiContainer gui, int mousex, int mousey) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
for (Widget widget : drawWidgets) widget.postDrawTooltips(mousex, mousey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
||||
|
||||
@@ -190,6 +190,11 @@ public abstract class PanelWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDrawTooltips(int mx, int my) {
|
||||
grid.postDrawTooltips(mx, my);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
|
||||
if (mouseDownSlot >= 0 && draggedStack == null
|
||||
|
||||
@@ -14,6 +14,8 @@ public abstract class Widget {
|
||||
|
||||
public void postDraw(int mx, int my) {}
|
||||
|
||||
public void postDrawTooltips(int mx, int my) {}
|
||||
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -514,6 +514,8 @@ public class GuiContainerManager {
|
||||
if (tooltip.size() > 0) tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE); // add space after 'title'
|
||||
|
||||
drawPagedTooltip(font, mousex + 12, mousey - 12, tooltip);
|
||||
|
||||
for (IContainerDrawHandler drawHandler : drawHandlers) drawHandler.postRenderTooltips(window, mousex, mousey);
|
||||
}
|
||||
|
||||
private static int tooltipPage;
|
||||
|
||||
@@ -30,6 +30,16 @@ public interface IContainerDrawHandler {
|
||||
*/
|
||||
public void postRenderObjects(GuiContainer gui, int mousex, int mousey);
|
||||
|
||||
/**
|
||||
* Use this to draw things that should be drawn just after vanilla slot tooltips, on top of buttons and other
|
||||
* usually always-on-top widgets.
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
* @param mousex The x position of the mouse in pixels from left
|
||||
* @param mousey The y position of the mouse in pixels from top
|
||||
*/
|
||||
default void postRenderTooltips(GuiContainer gui, int mousex, int mousey) {}
|
||||
|
||||
/**
|
||||
* Render something over a slot before the item in the slot.
|
||||
*
|
||||
|
||||
@@ -146,10 +146,12 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
private final int trueHeight;
|
||||
private final int trueGuiTop;
|
||||
private final GuiScreen trueGui;
|
||||
|
||||
private HeightHack() {
|
||||
trueHeight = height;
|
||||
trueGuiTop = guiTop;
|
||||
trueGui = Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
isHeightHackApplied = NEIClientConfig.heightHackHandlerRegex.stream()
|
||||
.map(pattern -> pattern.matcher(handler.getHandlerId())).anyMatch(Matcher::matches);
|
||||
@@ -174,6 +176,12 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
// guiWidth (the x-value of the left edge of the NEI recipe screen). So if we wanted to override width
|
||||
// as well, we'd do this:
|
||||
// width = (2 * guiWidth) + 176;
|
||||
|
||||
// Recipe handlers may assume the current screen is the GuiRecipe object, which is not the case in
|
||||
// recipe tooltips drawn on the bookmarks panel with the main inventory open.
|
||||
if (limitToOneRecipe) {
|
||||
Minecraft.getMinecraft().currentScreen = GuiRecipe.this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +189,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
public void close() {
|
||||
guiTop = trueGuiTop;
|
||||
height = trueHeight;
|
||||
Minecraft.getMinecraft().currentScreen = trueGui;
|
||||
isHeightHackApplied = false;
|
||||
}
|
||||
}
|
||||
@@ -243,15 +252,14 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
overlayButtons = new GuiButton[recipesPerPage];
|
||||
final int xOffset = limitToOneRecipe ? (xSize / 2) : (width / 2);
|
||||
final int yOffset = limitToOneRecipe ? -14 : guiTop;
|
||||
final int xOffset = limitToOneRecipe ? ((xSize / 2) - 2) : (width / 2);
|
||||
final String overlayKeyName = NEIClientConfig
|
||||
.getKeyName(NEIClientConfig.getKeyBinding("gui.overlay_use"), true);
|
||||
for (int i = 0; i < recipesPerPage; i++) {
|
||||
overlayButtons[i] = new GuiNEIButton(
|
||||
OVERLAY_BUTTON_ID_START + i,
|
||||
xOffset + 65,
|
||||
yOffset + 16 + (handlerInfo.getHeight() * (i + 1)) - 2,
|
||||
16 + (handlerInfo.getHeight() * (i + 1)) - 2,
|
||||
buttonWidth,
|
||||
buttonHeight,
|
||||
"?");
|
||||
@@ -740,7 +748,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
public int getHeightAsWidget() {
|
||||
return (handlerInfo == null) ? ySize : (handlerInfo.getHeight() + 40);
|
||||
return (handlerInfo == null) ? ySize : (handlerInfo.getHeight() + 56);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user