Skip to content

Commit

Permalink
fix log warning about missing recipe property
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Aug 20, 2021
1 parent d76afa3 commit 312c188
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/gregtech/api/recipes/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ public Set<String> getPropertyKeys() {
return recipePropertyStorage.getRecipePropertyKeys();
}

public boolean hasProperty(RecipeProperty<?> property) {
return recipePropertyStorage.hasRecipeProperty(property);
}

public int getPropertyCount() {
return recipePropertyStorage.getSize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public <T> T getRecipePropertyValue(RecipeProperty<T> recipeProperty, T defaultV
return recipeProperty.castValue(value);
}

public boolean hasRecipeProperty(RecipeProperty<?> recipeProperty) {
return recipeProperties.containsKey(recipeProperty);
}

/**
* Provides keys of all stored {@link RecipeProperty}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List<Str
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
int yPosition = recipeHeight - getPropertyListHeight();
if (recipe.getProperty(PrimitiveProperty.getInstance(), null) == null) {
if (!recipe.hasProperty(PrimitiveProperty.getInstance())) {
minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total", Math.abs((long) recipe.getEUt()) * recipe.getDuration()), 0, yPosition, 0x111111);
minecraft.fontRenderer.drawString(I18n.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), JEIHelpers.getMinTierForVoltage(recipe.getEUt())), 0, yPosition += LINE_HEIGHT, 0x111111);
}
Expand Down

0 comments on commit 312c188

Please sign in to comment.