use of net.silentchaos512.gear.crafting.ingredient.IGearIngredient in project Silent-Gear by SilentChaos512.
the class GearHelper method getExamplePartsFromRecipe.
public static Collection<IPartData> getExamplePartsFromRecipe(GearType gearType, Iterable<Ingredient> ingredients) {
Map<PartType, IPartData> map = new LinkedHashMap<>();
PartType.MAIN.makeCompoundPart(gearType, Const.Materials.EXAMPLE).ifPresent(p -> map.put(PartType.MAIN, p));
for (Ingredient ingredient : ingredients) {
if (ingredient instanceof IGearIngredient) {
PartType type = ((IGearIngredient) ingredient).getPartType();
type.makeCompoundPart(gearType, Const.Materials.EXAMPLE).ifPresent(p -> map.put(type, p));
}
}
return map.values();
}
use of net.silentchaos512.gear.crafting.ingredient.IGearIngredient in project Silent-Gear by SilentChaos512.
the class GearCraftingRecipeCategoryJei method draw.
@Override
public void draw(CraftingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
Collection<Component> lines = new ArrayList<>();
NonNullList<Ingredient> ingredients = recipe.getIngredients();
for (int i = 0; i < ingredients.size(); i++) {
Ingredient ingredient = ingredients.get(i);
if (ingredient instanceof IGearIngredient) {
Component text = ((IGearIngredient) ingredient).getJeiHint().orElse(null);
if (text != null) {
String prefix = (i + 1) + ": ";
lines.add(new TextComponent(prefix).append(text));
}
}
}
matrixStack.pushPose();
float scale = lines.size() > 5 ? 0.75f : 1f;
matrixStack.scale(scale, scale, 1f);
Font font = Minecraft.getInstance().font;
int y = (int) (56 / scale);
for (Component line : lines) {
font.drawShadow(matrixStack, line.getVisualOrderText(), 0, y, -1);
y += 10;
}
matrixStack.popPose();
}
Aggregations