Skip to content

Commit

Permalink
correct location for tabs, fixes way2muchnoise#18
Browse files Browse the repository at this point in the history
  • Loading branch information
way2muchnoise committed Nov 27, 2017
1 parent 978409e commit ebcc962
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version_forge=14.23.0.2501
version_forge=14.23.0.2529
version_minecraft=1.12.2
version_major=0
version_minor=0
version_revis=4
version_revis=5
version_mappings=snapshot_20170918
version_jei=4.8.0.111
version_jei=4.8.0.114
curse_project_id=272515
repo=way2muchnoise/BetterAdvancements
19 changes: 11 additions & 8 deletions src/main/java/betteradvancements/gui/BetterAdvancementTabType.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,23 @@ private BetterAdvancementTabType(int textureX, int textureY, int width, int heig

public void draw(Gui gui, int x, int y, int width, int height, boolean selected, int index) {
int i = this.textureX;
index %= getMax(width, height);

if (index > 0) {
i += this.width;
}

if (index == getMax(width, height) - 1) {
if (x + this.width == width) {
i += this.width;
}

int j = selected ? this.textureY + this.height : this.textureY;
gui.drawTexturedModalRect(x + this.getX(index, width), y + this.getY(index, height), i, j, this.width, this.height);
gui.drawTexturedModalRect(x + this.getX(index, width, height), y + this.getY(index, width, height), i, j, this.width, this.height);
}

public void drawIcon(int left, int top, int width, int height, int index, RenderItem renderItem, ItemStack stack) {
int i = left + this.getX(index, width);
int j = top + this.getY(index, height);
int i = left + this.getX(index, width, height);
int j = top + this.getY(index, width, height);

switch (tabType)
{
Expand All @@ -83,7 +84,8 @@ public void drawIcon(int left, int top, int width, int height, int index, Render
renderItem.renderItemAndEffectIntoGUI(null, stack, i, j);
}

public int getX(int index, int width) {
public int getX(int index, int width, int height) {
index %= getMax(width, height);
switch (tabType)
{
case ABOVE:
Expand All @@ -99,7 +101,8 @@ public int getX(int index, int width) {
}
}

public int getY(int index, int height) {
public int getY(int index, int width, int height) {
index %= getMax(width, height);
switch (tabType)
{
case ABOVE:
Expand All @@ -116,8 +119,8 @@ public int getY(int index, int height) {
}

public boolean isMouseOver(int left, int top, int width, int height, int index, int mouseX, int mouseY) {
int i = left + this.getX(index, width);
int j = top + this.getY(index, height);
int i = left + this.getX(index, width, height);
int j = top + this.getY(index, width, height);
return mouseX > i && mouseX < i + this.width && mouseY > j && mouseY < j + this.height;
}

Expand Down

0 comments on commit ebcc962

Please sign in to comment.