mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 19:15:13 +00:00
Create Recipe Widget; Recipe GUI: Infinity Scroll; Recipe GUI: Max Height Settings (#701)
Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
1 parent
2ea9ae1eb9
commit
fe0c5d4e50
50 files changed
+4150
-2107
No files matched your search
@@ -106,17 +106,17 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip) {
|
||||
public List<String> handleTooltip(List<String> currenttip) {
|
||||
currenttip.add(NEIClientUtils.translate("recipe.overlay"));
|
||||
|
||||
if (!this.enabled && this.requireShiftForOverlayRecipe && this.canFillCraftingGrid) {
|
||||
if (!this.enabled && requireShiftForOverlayRecipe() && canFillCraftingGrid()) {
|
||||
currenttip.set(currenttip.size() - 1, currenttip.get(currenttip.size() - 1) + GuiDraw.TOOLTIP_LINESPACE);
|
||||
currenttip.add(
|
||||
EnumChatFormatting.RED + NEIClientUtils.translate("recipe.overlay.mismatch")
|
||||
+ EnumChatFormatting.RESET);
|
||||
} else if (this.missedMaterialsTooltipLineHandler != null) {
|
||||
|
||||
if ((!this.requireShiftForOverlayRecipe || NEIClientUtils.shiftKey()) && this.canFillCraftingGrid) {
|
||||
if ((!requireShiftForOverlayRecipe() || NEIClientUtils.shiftKey()) && canFillCraftingGrid()) {
|
||||
this.missedMaterialsTooltipLineHandler.setLabelColor(EnumChatFormatting.RED);
|
||||
} else {
|
||||
this.missedMaterialsTooltipLineHandler.setLabelColor(EnumChatFormatting.GRAY);
|
||||
@@ -129,7 +129,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> handleHotkeys(GuiContainer gui, int mousex, int mousey, Map<String, String> hotkeys) {
|
||||
public Map<String, String> handleHotkeys(int mousex, int mousey, Map<String, String> hotkeys) {
|
||||
|
||||
if (requireShiftForOverlayRecipe()) {
|
||||
|
||||
@@ -174,7 +174,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
protected void drawContent(Minecraft minecraft, int y, int x, boolean mouseOver) {
|
||||
DrawableResource icon = ICON_OVERLAY;
|
||||
|
||||
if (this.hasOverlay && (!this.requireShiftForOverlayRecipe || NEIClientUtils.shiftKey())) {
|
||||
if (hasOverlay() && (!requireShiftForOverlayRecipe() || NEIClientUtils.shiftKey())) {
|
||||
icon = this.missedMaterialsTooltipLineHandler == null ? ICON_FILL : ICON_FILL_ERROR;
|
||||
}
|
||||
|
||||
@@ -206,18 +206,19 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
protected List<ItemOverlayState> ingredientsOverlay() {
|
||||
List<PositionedStack> ingredients = this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex);
|
||||
final List<PositionedStack> ingredients = this.handlerRef.handler
|
||||
.getIngredientStacks(this.handlerRef.recipeIndex);
|
||||
|
||||
if (this.itemPresenceCache.size() != ingredients.size()) {
|
||||
this.itemPresenceCache.clear();
|
||||
|
||||
if (this.canFillCraftingGrid) {
|
||||
if (canFillCraftingGrid()) {
|
||||
this.itemPresenceCache.addAll(this.handlerRef.getPresenceOverlay(this.firstGui));
|
||||
} else if (this.firstGui != null) {
|
||||
this.itemPresenceCache.addAll(presenceOverlay(ingredients));
|
||||
}
|
||||
|
||||
List<ItemStack> items = this.itemPresenceCache.stream().filter(state -> !state.isPresent())
|
||||
final List<ItemStack> items = this.itemPresenceCache.stream().filter(state -> !state.isPresent())
|
||||
.map(state -> state.getSlot().item).collect(Collectors.toList());
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
@@ -236,7 +237,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
|
||||
public void setRequireShiftForOverlayRecipe(boolean require) {
|
||||
this.requireShiftForOverlayRecipe = require;
|
||||
this.enabled = this.hasOverlay && (this.requireShiftForOverlayRecipe || this.canFillCraftingGrid);
|
||||
this.enabled = hasOverlay() && (this.requireShiftForOverlayRecipe || canFillCraftingGrid());
|
||||
}
|
||||
|
||||
public void setCanUseOverlayRenderer(boolean use) {
|
||||
@@ -263,7 +264,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
return Recipe.of(this.handlerRef);
|
||||
}
|
||||
|
||||
private List<ItemOverlayState> presenceOverlay(List<PositionedStack> ingredients) {
|
||||
protected List<ItemOverlayState> presenceOverlay(List<PositionedStack> ingredients) {
|
||||
final List<ItemOverlayState> itemPresenceSlots = new ArrayList<>();
|
||||
final List<ItemStack> invStacks = this.firstGui.inventorySlots.inventorySlots.stream()
|
||||
.filter(
|
||||
@@ -289,9 +290,9 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
public void overlayRecipe(boolean shift) {
|
||||
if (!this.hasOverlay) return;
|
||||
if (!hasOverlay()) return;
|
||||
|
||||
if (!this.requireShiftForOverlayRecipe || shift) {
|
||||
if (!requireShiftForOverlayRecipe() || shift) {
|
||||
if (canFillCraftingGrid()) {
|
||||
this.handlerRef.fillCraftingGrid(this.firstGui, 0);
|
||||
}
|
||||
@@ -302,8 +303,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lastKeyTyped(GuiRecipe<?> gui, char keyChar, int keyID) {
|
||||
|
||||
public void lastKeyTyped(char keyChar, int keyID) {
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark") && NEIClientUtils.shiftKey()) {
|
||||
saveRecipeInBookmark();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user