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

Include locked recipe information in WAILA tooltip #3855

Merged
merged 8 commits into from
Feb 3, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,19 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat
int tAverageTime = tag.getInteger("averageNS");
currentTip.add("Average CPU load of ~" + formatNumbers(tAverageTime) + " ns");
}
// Always show locked recipe information if the machine is locked to a recipe
if (tag.getBoolean("isLockedToRecipe")) {
String lockedRecipe = tag.getString("lockedRecipeName");
if (!lockedRecipe.isEmpty()) {
// Split the string on "\n" and add each line separately.
String[] lines = lockedRecipe.split("\n");
currentTip.add("Locked Recipe:");
for (String line : lines) {
currentTip.add(line);
}
}
}

super.getWailaBody(itemStack, currentTip, accessor, config);
}

Expand All @@ -2095,6 +2108,11 @@ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompou
tag.setInteger("progress", mProgresstime);
tag.setInteger("maxProgress", mMaxProgresstime);
tag.setBoolean("incompleteStructure", (getErrorDisplayID() & 64) != 0);
tag.setBoolean("isLockedToRecipe", isRecipeLockingEnabled());
SingleRecipeCheck lockedRecipe = getSingleRecipeCheck();
tag.setString(
"lockedRecipeName",
lockedRecipe != null ? lockedRecipe.getDisplayString(false, true, false, true) : "");

if (mOutputItems != null) {
int index = 0;
Expand Down
Loading