Skip to content

Commit

Permalink
fixes #72
Browse files Browse the repository at this point in the history
  • Loading branch information
way2muchnoise committed Oct 19, 2019
1 parent 84c34c2 commit 8e3c3a2
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 89 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version_forge=28.0.2
version_forge=28.1.10
version_minecraft=1.14.4
version_major=0
version_minor=1
version_revis=0
version_mappings=20190720-1.14.3
version_mappings=20190817-1.14.3
curse_project_id=272515
repo=way2muchnoise/BetterAdvancements
org.gradle.daemon=false
12 changes: 6 additions & 6 deletions src/main/java/betteradvancements/config/ConfigValues.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package betteradvancements.config;

import betteradvancements.advancements.BetterDisplayInfo;
import betteradvancements.gui.GuiBetterAdvancementTab;
import betteradvancements.gui.BetterAdvancementsScreen;
import betteradvancements.gui.BetterAdvancementTabGui;
import betteradvancements.gui.BetterAdvancementsScreenButtonWidget;
import betteradvancements.gui.GuiScreenBetterAdvancements;
import betteradvancements.util.ColorHelper;
import betteradvancements.util.CriteriaDetail;
import betteradvancements.util.CriterionGrid;
Expand Down Expand Up @@ -61,10 +61,10 @@ public static void pushChanges() {
BetterDisplayInfo.defaultCompletedIconColor = ColorHelper.RGB(defaultCompletedIconColor.get());
BetterDisplayInfo.defaultCompletedTitleColor = ColorHelper.RGB(defaultCompletedTitleColor.get());

GuiBetterAdvancementTab.doFade = doFade.get();
GuiScreenBetterAdvancements.showDebugCoordinates = showDebugCoordinates.get();
GuiScreenBetterAdvancements.orderTabsAlphabetically = orderTabsAlphabetically.get();
GuiScreenBetterAdvancements.uiScaling = uiScaling.get();
BetterAdvancementTabGui.doFade = doFade.get();
BetterAdvancementsScreen.showDebugCoordinates = showDebugCoordinates.get();
BetterAdvancementsScreen.orderTabsAlphabetically = orderTabsAlphabetically.get();
BetterAdvancementsScreen.uiScaling = uiScaling.get();

CriterionGrid.detailLevel = CriteriaDetail.fromName(detailLevel.get());
CriterionGrid.requiresShift = requiresShift.get();
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/betteradvancements/gui/BetterAdvancementEntryGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class BetterAdvancementEntryGui extends AbstractGui {
private static final int CORNER_SIZE = 10;
private static final int WIDGET_WIDTH = 256, WIDGET_HEIGHT = 26, TITLE_SIZE = 32, ICON_OFFSET = 128, ICON_SIZE = 26;

private final GuiBetterAdvancementTab guiBetterAdvancementTab;
private final BetterAdvancementTabGui betterAdvancementTabGui;
private final Advancement advancement;
protected final BetterDisplayInfo betterDisplayInfo;
private final DisplayInfo displayInfo;
Expand All @@ -46,10 +46,10 @@ public class BetterAdvancementEntryGui extends AbstractGui {
protected int x, y;
private final int screenScale;

public BetterAdvancementEntryGui(GuiBetterAdvancementTab guiBetterAdvancementTab, Minecraft mc, Advancement advancement, DisplayInfo displayInfo) {
this.guiBetterAdvancementTab = guiBetterAdvancementTab;
public BetterAdvancementEntryGui(BetterAdvancementTabGui betterAdvancementTabGui, Minecraft mc, Advancement advancement, DisplayInfo displayInfo) {
this.betterAdvancementTabGui = betterAdvancementTabGui;
this.advancement = advancement;
this.betterDisplayInfo = guiBetterAdvancementTab.getBetterDisplayInfo(advancement);
this.betterDisplayInfo = betterAdvancementTabGui.getBetterDisplayInfo(advancement);
this.displayInfo = displayInfo;
this.minecraft = mc;
this.title = mc.fontRenderer.trimStringToWidth(displayInfo.getTitle().getFormattedText(), 163);
Expand All @@ -69,7 +69,7 @@ private void refreshHover() {
k = mc.fontRenderer.getStringWidth(" ") + mc.fontRenderer.getStringWidth("0") * strLengthRequirementCount * 2 + mc.fontRenderer.getStringWidth("/");
}
int titleWidth = 29 + mc.fontRenderer.getStringWidth(this.title) + k;
GuiScreenBetterAdvancements screen = guiBetterAdvancementTab.getScreen();
BetterAdvancementsScreen screen = betterAdvancementTabGui.getScreen();
this.criterionGrid = CriterionGrid.findOptimalCriterionGrid(advancement, advancementProgress, screen.width / 2, mc.fontRenderer);
int maxWidth;

Expand All @@ -95,10 +95,10 @@ private List<String> findOptimalLines(String line, int width) {
} else {
List<String> list = this.minecraft.fontRenderer.listFormattedStringToWidth(line, width);
if (list.size() > 1) {
width = Math.max(width, guiBetterAdvancementTab.getScreen().internalWidth / 4);
width = Math.max(width, betterAdvancementTabGui.getScreen().internalWidth / 4);
list = this.minecraft.fontRenderer.listFormattedStringToWidth(line, width);
}
while (list.size() > 5 && width < WIDGET_WIDTH * 1.5 && width < guiBetterAdvancementTab.getScreen().internalWidth / 2.5) {
while (list.size() > 5 && width < WIDGET_WIDTH * 1.5 && width < betterAdvancementTabGui.getScreen().internalWidth / 2.5) {
width += width / 4;
list = this.minecraft.fontRenderer.listFormattedStringToWidth(line, width);
}
Expand All @@ -117,7 +117,7 @@ private BetterAdvancementEntryGui getFirstVisibleParent(Advancement advancementI
}

if (advancementIn != null && advancementIn.getDisplay() != null) {
return this.guiBetterAdvancementTab.getAdvancementGui(advancementIn);
return this.betterAdvancementTabGui.getAdvancementGui(advancementIn);
} else {
return null;
}
Expand All @@ -138,7 +138,7 @@ public void drawConnectivity(int scrollX, int scrollY, boolean drawInside) {

//Draw extra connections from event
for (Advancement parent : event.getExtraConnections()) {
final BetterAdvancementEntryGui parentGui = this.guiBetterAdvancementTab.getAdvancementGui(parent);
final BetterAdvancementEntryGui parentGui = this.betterAdvancementTabGui.getAdvancementGui(parent);

if (parentGui != null) {
this.drawConnection(parentGui, scrollX, scrollY, drawInside);
Expand Down Expand Up @@ -267,21 +267,21 @@ public void addGuiAdvancement(BetterAdvancementEntryGui betterAdvancementEntryGu

public void drawHover(int scrollX, int scrollY, float fade, int left, int top) {
this.refreshHover();
boolean drawLeft = left + scrollX + this.x + this.width + ADVANCEMENT_SIZE >= this.guiBetterAdvancementTab.getScreen().internalWidth;
boolean drawLeft = left + scrollX + this.x + this.width + ADVANCEMENT_SIZE >= this.betterAdvancementTabGui.getScreen().internalWidth;
String s = this.advancementProgress == null ? null : this.advancementProgress.getProgressText();
int i = s == null ? 0 : this.minecraft.fontRenderer.getStringWidth(s);
boolean drawTop;

if (!CriterionGrid.requiresShift || Screen.hasShiftDown()) {
if (this.criterionGrid.height < this.guiBetterAdvancementTab.getScreen().height) {
drawTop = top + scrollY + this.y + this.description.size() * this.minecraft.fontRenderer.FONT_HEIGHT + this.criterionGrid.height + 50 >= this.guiBetterAdvancementTab.getScreen().height;
if (this.criterionGrid.height < this.betterAdvancementTabGui.getScreen().height) {
drawTop = top + scrollY + this.y + this.description.size() * this.minecraft.fontRenderer.FONT_HEIGHT + this.criterionGrid.height + 50 >= this.betterAdvancementTabGui.getScreen().height;
} else {
// Always draw on the bottom if the grid is larger than the screen
drawTop = false;
}
}
else {
drawTop = top + scrollY + this.y + this.description.size() * this.minecraft.fontRenderer.FONT_HEIGHT + 50 >= this.guiBetterAdvancementTab.getScreen().height;
drawTop = top + scrollY + this.y + this.description.size() * this.minecraft.fontRenderer.FONT_HEIGHT + 50 >= this.betterAdvancementTabGui.getScreen().height;
}

float percentageObtained = this.advancementProgress == null ? 0.0F : this.advancementProgress.getPercent();
Expand Down Expand Up @@ -418,12 +418,12 @@ protected void render9Sprite(int x, int y, int width, int height, int textureHei
RenderUtil.renderRepeating(this,x + width - textureHeight, y + textureHeight, textureHeight, height - textureHeight - textureHeight, textureX + textureWidth - textureHeight, textureY + textureHeight, textureWidth, textureDistance - textureHeight - textureHeight);
}

public boolean isMouseOver(int scrollX, int scrollY, int mouseX, int mouseY) {
public boolean isMouseOver(double scrollX, double scrollY, double mouseX, double mouseY) {
if (!this.displayInfo.isHidden() || this.advancementProgress != null && this.advancementProgress.isDone()) {
int left = scrollX + this.x;
int right = left + ADVANCEMENT_SIZE;
int top = scrollY + this.y;
int bottom = top + ADVANCEMENT_SIZE;
double left = scrollX + this.x;
double right = left + ADVANCEMENT_SIZE;
double top = scrollY + this.y;
double bottom = top + ADVANCEMENT_SIZE;
return mouseX >= left && mouseX <= right && mouseY >= top && mouseY <= bottom;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import java.util.Map;

@OnlyIn(Dist.CLIENT)
public class GuiBetterAdvancementTab extends AbstractGui {
public class BetterAdvancementTabGui extends AbstractGui {
public static boolean doFade = true;

private final Minecraft minecraft;
private final GuiScreenBetterAdvancements screen;
private final BetterAdvancementsScreen screen;
private final BetterAdvancementTabType type;
private final int index;
private final Advancement advancement;
Expand All @@ -41,9 +41,9 @@ public class GuiBetterAdvancementTab extends AbstractGui {
private float fade;
private boolean centered;

public GuiBetterAdvancementTab(Minecraft mc, GuiScreenBetterAdvancements guiScreenBetterAdvancements, BetterAdvancementTabType type, int index, Advancement advancement, DisplayInfo displayInfo) {
public BetterAdvancementTabGui(Minecraft mc, BetterAdvancementsScreen betterAdvancementsScreen, BetterAdvancementTabType type, int index, Advancement advancement, DisplayInfo displayInfo) {
this.minecraft = mc;
this.screen = guiScreenBetterAdvancements;
this.screen = betterAdvancementsScreen;
this.type = type;
this.index = index;
this.advancement = advancement;
Expand Down Expand Up @@ -138,27 +138,27 @@ public boolean isMouseOver(int left, int top, int width, int height, double mous
}

@Nullable
public static GuiBetterAdvancementTab create(Minecraft mc, GuiScreenBetterAdvancements guiScreenBetterAdvancements, int index, Advancement advancement, int width, int height) {
public static BetterAdvancementTabGui create(Minecraft mc, BetterAdvancementsScreen betterAdvancementsScreen, int index, Advancement advancement, int width, int height) {
if (advancement.getDisplay() == null) {
return null;
} else {
BetterAdvancementTabType advancementTabType = BetterAdvancementTabType.getTabType(width,height, index);
if (advancementTabType == null) {
return null;
} else {
return new GuiBetterAdvancementTab(mc, guiScreenBetterAdvancements, advancementTabType, index, advancement, advancement.getDisplay());
return new BetterAdvancementTabGui(mc, betterAdvancementsScreen, advancementTabType, index, advancement, advancement.getDisplay());
}

}
}

public void scroll(int scrollX, int scrollY, int width, int height) {
public void scroll(double scrollX, double scrollY, int width, int height) {
if (this.maxX - this.minX > width) {
this.scrollX = MathHelper.clamp(this.scrollX + scrollX, -(this.maxX - width), -this.minX);
this.scrollX = (int)Math.round(MathHelper.clamp(this.scrollX + scrollX, -(this.maxX - width), -this.minX));
}

if (this.maxY - this.minY > height) {
this.scrollY = MathHelper.clamp(this.scrollY + scrollY, -(this.maxY - height), -this.minY);
this.scrollY = (int)Math.round(MathHelper.clamp(this.scrollY + scrollY, -(this.maxY - height), -this.minY));
}
}

Expand Down Expand Up @@ -190,7 +190,7 @@ public BetterAdvancementEntryGui getAdvancementGui(Advancement advancement) {
return this.guis.get(advancement);
}

public GuiScreenBetterAdvancements getScreen() {
public BetterAdvancementsScreen getScreen() {
return this.screen;
}

Expand Down
Loading

0 comments on commit 8e3c3a2

Please # to comment.