Skip to content

Commit 8bb56f8

Browse files
committed
Fix structure pattern check; Fix custom tooltips not displaying properly in some cases of JEI.
1 parent ff4670e commit 8bb56f8

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

src/main/java/hellfirepvp/modularmachinery/common/integration/recipe/CategoryDynamicRecipe.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,30 @@ private Point buildRecipeComponents() {
101101

102102
int tipLength = 0;
103103
//Custom TooltipList
104-
tipLength += RequirementTip.LINE_HEIGHT * recipe.getTooltipList().size();
105104
for (RequirementTip tip : RegistriesMM.REQUIREMENT_TIPS_REGISTRY) {
106105
Collection<ComponentRequirement<?, ?>> requirements = tip.filterRequirements(recipe, recipe.getCraftingRequirements());
107-
if (!requirements.isEmpty()) {
108-
List<String> tooltip = tip.buildTooltip(recipe, requirements);
109-
if (!tooltip.isEmpty()) {
110-
for (String tipString : tooltip) {
111-
int length = fr.getStringWidth(tipString);
112-
if (length > widestTooltip) {
113-
widestTooltip = length;
114-
}
115-
}
116-
tipLength += RequirementTip.LINE_HEIGHT * tooltip.size();
117-
tipLength += RequirementTip.SPLIT_HEIGHT;
106+
if (requirements.isEmpty()) {
107+
continue;
108+
}
109+
List<String> tooltip = tip.buildTooltip(recipe, requirements);
110+
if (tooltip.isEmpty()) {
111+
continue;
112+
}
113+
for (String tipString : tooltip) {
114+
int length = fr.getStringWidth(tipString);
115+
if (length > widestTooltip) {
116+
widestTooltip = length;
118117
}
119118
}
119+
tipLength += RequirementTip.LINE_HEIGHT * tooltip.size();
120+
tipLength += RequirementTip.SPLIT_HEIGHT;
121+
}
122+
for (String tipString : recipe.getTooltipList()) {
123+
int length = fr.getStringWidth(tipString);
124+
if (length > widestTooltip) {
125+
widestTooltip = length;
126+
}
127+
tipLength += RequirementTip.LINE_HEIGHT;
120128
}
121129
if (tipLength > longestTooltip) {
122130
longestTooltip = tipLength;

src/main/java/hellfirepvp/modularmachinery/common/util/BlockArray.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public List<ItemStack> getAsDescriptiveStacks(Optional<Long> snapSample) {
182182
}
183183

184184
public boolean matches(World world, BlockPos center, boolean oldState, @Nullable Map<BlockPos, List<BlockInformation>> modifierReplacementPattern) {
185+
patternCheck:
185186
for (Map.Entry<BlockPos, BlockInformation> entry : pattern.entrySet()) {
186187
BlockPos at = center.add(entry.getKey());
187188
// Block is matched, continue.
@@ -197,7 +198,7 @@ public boolean matches(World world, BlockPos center, boolean oldState, @Nullable
197198
// Check if the replacement block match.
198199
for (BlockInformation info : modifierReplacementPattern.get(entry.getKey())) {
199200
if (info.matches(world, at, oldState)) {
200-
break;
201+
continue patternCheck;
201202
}
202203
}
203204

0 commit comments

Comments
 (0)