Replace some things with textcomponents in Patchouli integration

This commit is contained in:
Vincent Lee committed 2020-07-15 14:09:40 -05:00
1 parent 4bd4a05fee
commit 8141c37897
5 files changed
+9 -10

No files matched your search

@@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TranslationTextComponent;
import vazkii.botania.api.recipe.IBrewRecipe;
import vazkii.botania.common.Botania;
import vazkii.botania.common.crafting.ModRecipeTypes;
@@ -45,7 +46,7 @@ public class BrewRecipeProcessor implements IComponentProcessor {
if (recipe == null) {
return null;
} else if (key.equals("heading")) {
return IVariable.wrap(I18n.format("botaniamisc.brewOf", I18n.format(recipe.getBrew().getTranslationKey())));
return IVariable.from(new TranslationTextComponent("botaniamisc.brewOf", new TranslationTextComponent(recipe.getBrew().getTranslationKey())));
} else if (key.equals("vial")) {
return IVariable.from(recipe.getOutput(new ItemStack(ModItems.vial)));
} else if (key.equals("flask")) {
@@ -66,7 +66,7 @@ public class ElvenTradeProcessor implements IComponentProcessor {
return null;
}
if (key.equals("heading")) {
return IVariable.wrap(recipes.get(0).getOutputs().get(0).getDisplayName().getString());
return IVariable.from(recipes.get(0).getOutputs().get(0).getDisplayName());
} else if (key.startsWith("input")) {
int index = Integer.parseInt(key.substring(5)) - 1;
if (index < mostInputs) {
@@ -15,11 +15,8 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.KeybindTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.*;
import net.minecraft.util.text.TranslationTextComponent;
import vazkii.botania.api.recipe.IManaInfusionRecipe;
import vazkii.botania.client.patchouli.PatchouliUtils;
import vazkii.botania.common.Botania;
@@ -71,7 +68,7 @@ public class ManaInfusionProcessor implements IComponentProcessor {
switch (key) {
case "heading":
if (!hasCustomHeading) {
return IVariable.wrap(recipes.get(0).getRecipeOutput().getDisplayName().getString());
return IVariable.from(recipes.get(0).getRecipeOutput().getDisplayName());
}
return null;
case "input":
@@ -91,7 +88,8 @@ public class ManaInfusionProcessor implements IComponentProcessor {
case "mana":
return IVariable.wrapList(recipes.stream().mapToInt(IManaInfusionRecipe::getManaToConsume).mapToObj(IVariable::wrap).collect(Collectors.toList()));
case "drop":
return IVariable.wrap(I18n.format("botaniamisc.drop") + TextFormatting.BOLD + " (?)");
ITextComponent q = new StringTextComponent("(?)").func_240699_a_(TextFormatting.BOLD);
return IVariable.from(new TranslationTextComponent("botaniamisc.drop").func_240702_b_(" ").func_230529_a_(q));
case "dropTip0":
case "dropTip1":
ITextComponent drop = new KeybindTextComponent("key.drop").func_240699_a_(TextFormatting.GREEN);
@@ -68,7 +68,7 @@ public class MultiCraftingProcessor implements IComponentProcessor {
}
if (key.equals("heading")) {
if (!hasCustomHeading) {
return IVariable.wrap(recipes.get(0).getRecipeOutput().getDisplayName().getString());
return IVariable.from(recipes.get(0).getRecipeOutput().getDisplayName());
}
return null;
}
@@ -41,7 +41,7 @@ public class PetalApothecaryProcessor implements IComponentProcessor {
case "output":
return IVariable.from(recipe.getRecipeOutput());
case "heading":
return IVariable.wrap(recipe.getRecipeOutput().getDisplayName().getString());
return IVariable.from(recipe.getRecipeOutput().getDisplayName());
}
return null;
}