Skip to content

Commit

Permalink
use dimension names for gas collector property
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 committed Aug 11, 2021
1 parent 189f645 commit 292ff21
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package gregtech.api.recipes.recipeproperties;

import gregtech.api.worldgen.config.WorldGenRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;

import java.util.List;
import java.util.Map;

public class GasCollectorDimensionProperty extends RecipeProperty<List> {
public static final String KEY = "dimension";
Expand All @@ -23,13 +25,14 @@ public static GasCollectorDimensionProperty getInstance() {
@Override
public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) {
minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.dimensions",
value, getDimensionsForRecipe(castValue(value))), x, y, color);
getDimensionsForRecipe(castValue(value))), x, y, color);
}

private String getDimensionsForRecipe(List<Integer> value) {
Map<Integer, String> dimNames = WorldGenRegistry.getNamedDimensions();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < value.size(); i++) {
builder.append(value.get(i));
builder.append(dimNames.getOrDefault(value.get(i), "" + value.get(i)));
if (i != value.size() - 1)
builder.append(", ");
}
Expand Down

0 comments on commit 292ff21

Please sign in to comment.