Compare commits

...
Author SHA1 Message Date
slprime 1eaaac94bc Fix filtered permutations (#893) 2026-03-18 01:25:27 +02:00
slprime e99167dddb Change calculateBounds (#892) 2026-03-15 22:41:31 +02:00
4 changed files with 13 additions and 14 deletions

No files matched your search

@@ -510,8 +510,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
}
@Override
public Rectangle4i calculateBounds() {
final GuiContainer gui = NEIClientUtils.getGuiContainer();
public Rectangle4i calculateBounds(GuiContainer gui) {
final int maxWidth = (gui.width - 176) / 2 - PADDING * 2;
final int maxHeight = gui.height - PADDING * 2;
final int freeSpace = (gui.width - gui.xSize) / 2 - PADDING * 2;
+1 -2
View File
@@ -122,8 +122,7 @@ public class ItemPanel extends PanelWidget<ItemsPanelGrid> {
}
@Override
public Rectangle4i calculateBounds() {
final GuiContainer gui = NEIClientUtils.getGuiContainer();
public Rectangle4i calculateBounds(GuiContainer gui) {
final int maxWidth = (gui.width - 176) / 2 - PADDING * 2;
final int maxHeight = gui.height - PADDING * 2;
final int freeSpace = (gui.width - gui.xSize) / 2 - PADDING * 2;
@@ -82,14 +82,14 @@ public abstract class PanelWidget<T extends ItemsGrid<? extends ItemsGridSlot, ?
public abstract String getLabelText();
public abstract Rectangle4i calculateBounds();
public abstract Rectangle4i calculateBounds(GuiContainer gui);
protected static int snapDownToMultiple(int value, int multiple) {
return (value / multiple) * multiple;
}
public void resize(GuiContainer gui) {
final Rectangle4i bounds = calculateBounds();
final Rectangle4i bounds = calculateBounds(gui);
x = bounds.x;
y = bounds.y;
@@ -127,18 +127,18 @@ public class NEIRecipeWidget extends Widget {
final UpdateRecipeButtonsEvent.Post postEvent = new UpdateRecipeButtonsEvent.Post(
guiRecipe,
this,
getDefatulButtons());
getDefaultButtons());
MinecraftForge.EVENT_BUS.post(postEvent);
return postEvent.buttonList;
}
} else {
return getDefatulButtons();
return getDefaultButtons();
}
}
protected List<GuiRecipeButton> getDefatulButtons() {
protected List<GuiRecipeButton> getDefaultButtons() {
GuiContainer guiContainer = NEIClientUtils.getGuiContainer();
final List<GuiRecipeButton> buttons = new ArrayList<>();
final boolean showFavorites = NEIClientConfig.favoritesEnabled() && handlerInfo.getShowFavoritesButton();
@@ -169,7 +169,7 @@ public class NEIRecipeWidget extends Widget {
if (this.update) {
this.update = false;
if (!NEIClientUtils.shiftKey() && (this.cycleticks++) / 20 != this.lastcycle || this.lastcycle == -1) {
if (!NEIClientUtils.shiftKey() && ((this.cycleticks++) / 20) != this.lastcycle || this.lastcycle == -1) {
this.lastcycle = this.cycleticks / 20;
updatePermutations();
}
@@ -381,15 +381,15 @@ public class NEIRecipeWidget extends Widget {
for (PositionedStack pStack : getCatalysts()) {
if (pStack.contains(mousex - this.x, mousey - this.y - yShift)) {
hovered = pStack;
break;
}
}
}
if (hovered == null || hovered.items.length <= 1) {
if (hovered == null || this.permutations.getOrDefault(hovered, Collections.emptyList()).size() <= 1) {
this.acceptsFollowingTooltipLineHandler = null;
} else if ((this.acceptsFollowingTooltipLineHandler == null
|| this.acceptsFollowingTooltipLineHandler.tooltipGUID != hovered)
&& this.permutations.getOrDefault(hovered, Collections.emptyList()).size() > 1) {
} else if (this.acceptsFollowingTooltipLineHandler == null
|| this.acceptsFollowingTooltipLineHandler.tooltipGUID != hovered) {
this.acceptsFollowingTooltipLineHandler = AcceptsFollowingTooltipLineHandler
.of(hovered, this.permutations.get(hovered), hovered.item);
}
@@ -602,6 +602,7 @@ public class NEIRecipeWidget extends Widget {
this.permutations.put(pStack, perms);
this.favoriteIndexes.put(pStack, favoriteIndex);
pStack.setPermutationToRender(perms.get(0));
}
if (perms.size() > 1) {