mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-27 15:33:19 +00:00
Move shared button and scrollbar textures to UIWidgetTexture (#1158)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
09e3846bea
commit
bf957e4642
12 files changed
+184
-24
No files matched your search
@@ -59,6 +59,7 @@ import codechicken.nei.scroll.ScrollBar.OverflowType;
|
||||
import codechicken.nei.scroll.ScrollBar.ScrollPlace;
|
||||
import codechicken.nei.scroll.ScrollContainer;
|
||||
import codechicken.nei.search.SearchExpressionUtils;
|
||||
import codechicken.nei.theme.UIWidgetTexture;
|
||||
import codechicken.nei.util.EmptyContainer;
|
||||
import codechicken.nei.util.SlotInaccessible;
|
||||
|
||||
@@ -533,7 +534,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
if (!this.handlerInfo.isAllowOverflowX() && this.handlerInfo.getWidth() > this.xSize - 6) {
|
||||
this.container.setPaddingInline(0, 2);
|
||||
this.container.setHorizontalScroll(ScrollBar.defaultHorizontalBar().setTrackPadding(1, 0, 1, 0));
|
||||
this.container.setHorizontalScroll(UIWidgetTexture.horizontalScrollBar().setTrackPadding(1, 0, 1, 0));
|
||||
} else {
|
||||
this.container.setPaddingInline(0, 0);
|
||||
this.container.setHorizontalScroll(null);
|
||||
@@ -545,7 +546,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
this.container.setVerticalScroll(VERTICAL_SCROLLBAR);
|
||||
} else {
|
||||
this.container.setVerticalScroll(
|
||||
ScrollBar.defaultVerticalBar().setOverflowType(OverflowType.OVERLAY)
|
||||
UIWidgetTexture.verticalScrollBar().setOverflowType(OverflowType.OVERLAY)
|
||||
.setTrackPadding(-8, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.GuiNEIButton;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.theme.ButtonSkin;
|
||||
import codechicken.nei.theme.UIWidgetTexture;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
public abstract class GuiRecipeButton extends GuiNEIButton {
|
||||
@@ -58,6 +62,26 @@ public abstract class GuiRecipeButton extends GuiNEIButton {
|
||||
this.handlerRef = point;
|
||||
}
|
||||
|
||||
protected DrawableResource getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DrawableResource getBackground(int mouseX, int mouseY, boolean mouseOver) {
|
||||
return UIWidgetTexture.BUTTON.background(this.enabled, false, mouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawContent(Minecraft minecraft, int mouseX, int mouseY, boolean mouseOver) {
|
||||
final DrawableResource icon = getIcon();
|
||||
|
||||
if (icon != null) {
|
||||
ButtonSkin.drawIcon(this.xPosition, this.yPosition, this.width, this.height, icon, this.enabled);
|
||||
} else {
|
||||
super.drawContent(minecraft, mouseX, mouseY, mouseOver);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract List<String> handleTooltip(List<String> currenttip);
|
||||
|
||||
public abstract Map<String, String> handleHotkeys(int mousex, int mousey, Map<String, String> hotkeys);
|
||||
|
||||
@@ -18,6 +18,7 @@ import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.scroll.ScrollBar;
|
||||
import codechicken.nei.scroll.ScrollContainer;
|
||||
import codechicken.nei.theme.UIWidgetTexture;
|
||||
|
||||
public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
|
||||
@@ -68,7 +69,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
private static final DrawableResource FG_TEXTURE = new DrawableBuilder("nei:textures/slot.png", 0, 0, 18, 18)
|
||||
.setTextureSize(18, 18).setSlices(1, 1, 1, 1).build();
|
||||
|
||||
private static final ScrollBar VERTICAL_SCROLLBAR = ScrollBar.defaultVerticalBar()
|
||||
private static final ScrollBar VERTICAL_SCROLLBAR = UIWidgetTexture.verticalScrollBar()
|
||||
.setOverflowType(ScrollBar.OverflowType.AUTO).setTrackPadding(0, BORDER_PADDING, -13, BORDER_PADDING)
|
||||
.setScrollPlace(ScrollBar.ScrollPlace.START);
|
||||
|
||||
|
||||
Reference in new issue
Block a user