Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make True Mutation Chance Visible #9

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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