mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Always use StringUtil's renderSplitString
This commit is contained in:
parent
c7a1a5965f
commit
2ea19830fa
10 changed files with 23 additions and 21 deletions
|
@ -72,10 +72,10 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
|
|||
if(factory != null){
|
||||
int state = factory.isMultiblock();
|
||||
if(state == TileEntityLavaFactoryController.NOT_MULTI){
|
||||
StringUtil.drawSplitStringWithShadow(minecraft.fontRenderer, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
else if(state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA){
|
||||
StringUtil.drawSplitStringWithShadow(minecraft.fontRenderer, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,13 +128,13 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
|||
int distance = (int)Vec3.createVectorHelper(posHit.blockX, posHit.blockY, posHit.blockZ).distanceTo(Vec3.createVectorHelper(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()));
|
||||
Item item = phantom.getBoundPosition().getItemBlock(minecraft.theWorld);
|
||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(phantom.getBoundPosition().getBlock(minecraft.theWorld), 1, phantom.getBoundPosition().getMetadata(minecraft.theWorld)));
|
||||
StringUtil.drawSplitStringWithShadow(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
|
||||
if(phantom.isBoundThingInRange()){
|
||||
StringUtil.drawSplitStringWithShadow(minecraft.fontRenderer, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
else{
|
||||
StringUtil.drawSplitStringWithShadow(minecraft.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -18,6 +18,7 @@ import ellpeck.actuallyadditions.items.ItemCoffee;
|
|||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import ellpeck.actuallyadditions.util.Util;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -46,7 +47,7 @@ public class PageCoffeeRecipe extends BookletPage{
|
|||
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+100, 115, 0, false);
|
||||
}
|
||||
|
||||
if(this.ingredient.maxAmplifier > 0){
|
||||
|
|
|
@ -85,7 +85,7 @@ public class PageCrafting extends BookletPage{
|
|||
IRecipe recipe = this.recipes[this.recipePos];
|
||||
|
||||
if(recipe == null){
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0, false);
|
||||
}
|
||||
else{
|
||||
String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe"))));
|
||||
|
@ -94,7 +94,7 @@ public class PageCrafting extends BookletPage{
|
|||
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+90, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+90, 115, 0, false);
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
|
|
|
@ -56,7 +56,7 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
if(recipe == null){
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0, false);
|
||||
}
|
||||
else{
|
||||
String strg = "Crusher Recipe";
|
||||
|
@ -65,7 +65,7 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+100, 115, 0, false);
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
|
|
|
@ -60,7 +60,7 @@ public class PageFurnace extends BookletPage{
|
|||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
|
||||
if(input == null){
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0, false);
|
||||
}
|
||||
else{
|
||||
String strg = "Furnace Recipe";
|
||||
|
@ -69,7 +69,7 @@ public class PageFurnace extends BookletPage{
|
|||
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+100, 115, 0, false);
|
||||
}
|
||||
|
||||
if(input != null){
|
||||
|
|
|
@ -14,6 +14,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class PagePicture extends PageTextOnly{
|
||||
|
@ -35,7 +36,7 @@ public class PagePicture extends PageTextOnly{
|
|||
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+textStartY, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+textStartY, 115, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class PageReconstructor extends BookletPage{
|
|||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
LensNoneRecipeHandler.Recipe recipe = this.recipes[this.recipePos];
|
||||
if(recipe == null){
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0, false);
|
||||
}
|
||||
else{
|
||||
String strg = "Atomic Reconstructor";
|
||||
|
@ -79,7 +79,7 @@ public class PageReconstructor extends BookletPage{
|
|||
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+100, 115, 0, false);
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
|
|
|
@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.booklet.page;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PageTextOnly extends BookletPage{
|
||||
|
@ -39,7 +40,7 @@ public class PageTextOnly extends BookletPage{
|
|||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
String text = gui.currentEntrySet.page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0);
|
||||
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+9, 115, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ package ellpeck.actuallyadditions.util;
|
|||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
@ -52,11 +51,11 @@ public class StringUtil{
|
|||
}
|
||||
}
|
||||
|
||||
public static void drawSplitStringWithShadow(FontRenderer renderer, String strg, int x, int y, int width, int color){
|
||||
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
||||
List list = renderer.listFormattedStringToWidth(strg, width);
|
||||
for(Iterator iterator = list.iterator(); iterator.hasNext(); y += renderer.FONT_HEIGHT){
|
||||
String s1 = (String)iterator.next();
|
||||
renderer.drawString(s1, x, y, color, true);
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
String s1 = (String)list.get(i);
|
||||
renderer.drawString(s1, x, y+(i*renderer.FONT_HEIGHT), color, shadow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue