Faster scrollbar
This commit is contained in:
@@ -31,6 +31,13 @@ public class GuiController extends GuiBase {
|
|||||||
addSideButton(new SideButtonRedstoneMode(controller));
|
addSideButton(new SideButtonRedstoneMode(controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
|
scrollbar.update(this, mouseX - guiLeft, mouseY - guiTop);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y) {
|
public void update(int x, int y) {
|
||||||
scrollbar.setCanScroll(getRows() > VISIBLE_ROWS);
|
scrollbar.setCanScroll(getRows() > VISIBLE_ROWS);
|
||||||
@@ -57,8 +64,6 @@ public class GuiController extends GuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY) {
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
scrollbar.update(this, mouseX, mouseY);
|
|
||||||
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:controller." + controller.getType().getId()));
|
drawString(7, 7, t("gui.refinedstorage:controller." + controller.getType().getId()));
|
||||||
drawString(7, 87, t("container.inventory"));
|
drawString(7, 87, t("container.inventory"));
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,13 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
cancelAllButton = addButton(x + 7 + cancelButtonWidth + 4, y + 113, cancelAllButtonWidth, 20, cancelAll, false);
|
cancelAllButton = addButton(x + 7 + cancelButtonWidth + 4, y + 113, cancelAllButtonWidth, 20, cancelAll, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
|
scrollbar.update(this, mouseX - guiLeft, mouseY - guiTop);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y) {
|
public void update(int x, int y) {
|
||||||
scrollbar.setCanScroll(getRows() > VISIBLE_ROWS);
|
scrollbar.setCanScroll(getRows() > VISIBLE_ROWS);
|
||||||
@@ -85,8 +92,6 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY) {
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
scrollbar.update(this, mouseX, mouseY);
|
|
||||||
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:crafting_monitor"));
|
drawString(7, 7, t("gui.refinedstorage:crafting_monitor"));
|
||||||
drawString(7, 137, t("container.inventory"));
|
drawString(7, 137, t("container.inventory"));
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,13 @@ public class GuiGrid extends GuiBase {
|
|||||||
addSideButton(new SideButtonGridSearchBoxMode(grid));
|
addSideButton(new SideButtonGridSearchBoxMode(grid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
|
scrollbar.update(this, mouseX - guiLeft, mouseY - guiTop);
|
||||||
|
}
|
||||||
|
|
||||||
public IGrid getGrid() {
|
public IGrid getGrid() {
|
||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
@@ -193,9 +200,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY) {
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
scrollbar.update(this, mouseX, mouseY);
|
drawString(7, 8, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
|
||||||
|
|
||||||
drawString(7, 7, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
|
|
||||||
|
|
||||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||||
drawString(7, 94, t("container.crafting"));
|
drawString(7, 94, t("container.crafting"));
|
||||||
@@ -203,12 +208,12 @@ public class GuiGrid extends GuiBase {
|
|||||||
drawString(7, 94, t("gui.refinedstorage:grid.pattern"));
|
drawString(7, 94, t("gui.refinedstorage:grid.pattern"));
|
||||||
}
|
}
|
||||||
|
|
||||||
drawString(7, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 163 : 113, t("container.inventory"));
|
drawString(7, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 163 : 114, t("container.inventory"));
|
||||||
|
|
||||||
int x = 8;
|
int x = 8;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
|
|
||||||
hoveringSlot = -1;
|
this.hoveringSlot = -1;
|
||||||
|
|
||||||
int slot = getOffset() * 9;
|
int slot = getOffset() * 9;
|
||||||
|
|
||||||
@@ -216,12 +221,12 @@ public class GuiGrid extends GuiBase {
|
|||||||
|
|
||||||
for (int i = 0; i < 9 * getVisibleRows(); ++i) {
|
for (int i = 0; i < 9 * getVisibleRows(); ++i) {
|
||||||
if (inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isConnected()) {
|
if (inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isConnected()) {
|
||||||
hoveringSlot = slot;
|
this.hoveringSlot = slot;
|
||||||
|
|
||||||
if (slot < items.size()) {
|
if (slot < items.size()) {
|
||||||
// we need to use the ID, because if we filter, the client-side index will change
|
// we need to use the ID, because if we filter, the client-side index will change
|
||||||
// while the server-side's index will still be the same.
|
// while the server-side's index will still be the same.
|
||||||
hoveringItemId = items.get(slot).getId();
|
this.hoveringItemId = items.get(slot).getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +247,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
text = String.valueOf(qty);
|
text = String.valueOf(qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hoveringSlot == slot && GuiScreen.isShiftKeyDown() && qty > 1) {
|
if (this.hoveringSlot == slot && GuiScreen.isShiftKeyDown() && qty > 1) {
|
||||||
text = String.valueOf(qty);
|
text = String.valueOf(qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -237,12 +237,12 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
|
|||||||
|
|
||||||
Collections.sort(storages, new Comparator<IStorage>() {
|
Collections.sort(storages, new Comparator<IStorage>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(IStorage s1, IStorage s2) {
|
public int compare(IStorage left, IStorage right) {
|
||||||
if (s1.getPriority() == s2.getPriority()) {
|
if (left.getPriority() == right.getPriority()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (s1.getPriority() > s2.getPriority()) ? -1 : 1;
|
return (left.getPriority() > right.getPriority()) ? -1 : 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user