Skip to content

Commit

Permalink
Make True Mutation Chance Visible (#9)
Browse files Browse the repository at this point in the history
* Makes stuff more easily visible.

* spotlessApply

---------

Co-authored-by: GTNH-Colen <[email protected]>
Co-authored-by: GitHub GTNH Actions <>
  • Loading branch information
Connor-Colenso and GTNH-Colen authored Jun 27, 2024
1 parent e0a4ca4 commit 622856d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/main/resources/assets/neiaddons/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bdew.neiaddons.exnihilo=Ex Nihilo

bdew.neiaddons.breeding.beebreeding=Bee Breeding
bdew.neiaddons.produce.beeproduce=Bee Produce
bdew.neiaddons.breeding.mutationchance=Precise Mutation Chance

bdew.neiaddons.breeding.treebreeding=Tree Breeding
bdew.neiaddons.produce.treeproduce=Tree Produce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,20 @@ public void drawExtras(int recipe) {
rec.result.drawLabel();
rec.parrent1.drawLabel();
rec.parrent2.drawLabel();

String chanceText;
if (rec.chance < 1) {
chanceText = "<1%";
} else {
chanceText = String.format("%.0f%%", rec.chance);
}

if (rec.derp) {
Utils.drawCenteredString(EnumChatFormatting.OBFUSCATED + "DERP", 108, 15, 0xFF0000);
} else if (rec.requirements.size() > 0 && AddonForestry.showReqs) {
Utils.drawCenteredString(String.format("[%.0f%%]", rec.chance), 108, 15, 0xFF0000);
Utils.drawCenteredString(EnumChatFormatting.OBFUSCATED + "DERP", 108, 15, 0xFF0000); // RED
} else if (!rec.requirements.isEmpty() && AddonForestry.showReqs) {
Utils.drawCenteredString("[" + chanceText + "]", 108, 15, 0xFF0000); // RED
} else {
Utils.drawCenteredString(String.format("%.0f%%", rec.chance), 108, 15, 0xFFFFFF);
Utils.drawCenteredString(chanceText, 108, 15, 0xFFFFFF);
}
}

Expand All @@ -202,15 +210,16 @@ public String getGuiTexture() {
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipe) {
CachedBreedingRecipe rec = (CachedBreedingRecipe) arecipes.get(recipe);
if (AddonForestry.showReqs && rec.requirements.size() > 0
if (AddonForestry.showReqs && !rec.requirements.isEmpty()
&& GuiContainerManager.shouldShowTooltip(gui)
&& currenttip.size() == 0) {
&& currenttip.isEmpty()) {
Point offset = gui.getRecipePosition(recipe);
Point pos = GuiDraw.getMousePosition();
Point relMouse = new Point(pos.x - gui.guiLeft - offset.x, pos.y - gui.guiTop - offset.y);
Rectangle tiprect = new Rectangle(108 - 24, 15 - 2, 48, 12);
if (tiprect.contains(relMouse)) {
currenttip.addAll(rec.requirements);
currenttip.add(I18n.format("bdew.neiaddons.breeding.mutationchance") + ": " + rec.chance + "%");
return currenttip;
}
}
Expand Down

0 comments on commit 622856d

Please sign in to comment.