From faa40099926ea84f9ce6f2b2805d675acc002204 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 14 Sep 2015 01:58:42 +0200 Subject: [PATCH] Changed tooltips having to be cut off manually --- .../actuallyadditions/booklet/GuiBooklet.java | 2 +- .../actuallyadditions/event/InitEvents.java | 1 - .../actuallyadditions/event/TooltipEvent.java | 7 ++---- .../inventory/gui/GuiInputter.java | 22 ++++++++----------- .../actuallyadditions/proxy/ClientProxy.java | 2 ++ .../assets/actuallyadditions/lang/en_US.lang | 8 +++---- 6 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index eba23750e..a28b12b0c 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -58,7 +58,7 @@ public class GuiBooklet extends GuiScreen{ private static final int CHAPTER_BUTTONS_START = 3; public static final int BUTTONS_PER_PAGE = 13; - private static final int TOOLTIP_SPLIT_LENGTH = 160; + public static final int TOOLTIP_SPLIT_LENGTH = 160; private static final int BUTTON_UPDATE_ID = CHAPTER_BUTTONS_START+BUTTONS_PER_PAGE; private static final int BUTTON_TWITTER_ID = BUTTON_UPDATE_ID+1; diff --git a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java index 6e8dace3f..31103d356 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java +++ b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java @@ -23,7 +23,6 @@ public class InitEvents{ Util.registerEvent(new CraftEvent()); Util.registerEvent(new LivingDropEvent()); Util.registerEvent(new PickupEvent()); - Util.registerEvent(new TooltipEvent()); Util.registerEvent(new EntityLivingEvent()); Util.registerEvent(new BucketFillEvent()); Util.registerEvent(new LogoutEvent()); diff --git a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java index 4ea6ee0eb..d26ad5159 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java @@ -34,13 +34,12 @@ import net.minecraftforge.oredict.OreDictionary; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; -import java.util.regex.Pattern; - public class TooltipEvent{ private static final String ADVANCED_INFO_TEXT_PRE = EnumChatFormatting.DARK_GRAY+" "; private static final String ADVANCED_INFO_HEADER_PRE = EnumChatFormatting.GRAY+" -"; + @SuppressWarnings("unchecked") @SubscribeEvent public void onTooltipEvent(ItemTooltipEvent event){ //Booklet Access @@ -118,9 +117,7 @@ public class TooltipEvent{ } //Disabling Info - for(String str : StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc").split(Pattern.quote("|"))){ - event.toolTip.add(EnumChatFormatting.ITALIC+str); - } + event.toolTip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), GuiBooklet.TOOLTIP_SPLIT_LENGTH)); } else{ if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){ diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java index 9d4f5b710..304f70262 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.inventory.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.booklet.GuiBooklet; import ellpeck.actuallyadditions.inventory.ContainerInputter; import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.network.gui.PacketGuiButton; @@ -34,8 +35,7 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import java.util.ArrayList; -import java.util.Arrays; -import java.util.regex.Pattern; +import java.util.List; @SideOnly(Side.CLIENT) public class GuiInputter extends GuiContainer{ @@ -224,19 +224,19 @@ public class GuiInputter extends GuiContainer{ this.whitelistPut.displayString = this.tileInputter.isPutWhitelist ? "O" : "X"; if(this.isAdvanced){ - String[] strings = StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.whitelistInfo").split(Pattern.quote("|")); + List infoList = this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.whitelistInfo"), GuiBooklet.TOOLTIP_SPLIT_LENGTH); String text1 = this.tileInputter.isPullWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist"); if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){ ArrayList list = new ArrayList(); list.add(EnumChatFormatting.BOLD+text1); - list.addAll(Arrays.asList(strings)); + list.addAll(infoList); this.func_146283_a(list, x, y); } String text2 = this.tileInputter.isPutWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist"); if(x >= guiLeft+157 && y >= guiTop+16 && x <= guiLeft+172 && y <= guiTop+31){ ArrayList list = new ArrayList(); list.add(EnumChatFormatting.BOLD+text2); - list.addAll(Arrays.asList(strings)); + list.addAll(infoList); this.func_146283_a(list, x, y); } } @@ -244,20 +244,16 @@ public class GuiInputter extends GuiContainer{ int newTopOffset = this.guiTop+(this.isAdvanced ? OFFSET_ADVANCED : 0); //Info Mode on! if(x >= guiLeft+11 && y >= newTopOffset+65 && x <= guiLeft+11+31 && y <= newTopOffset+65+12){ - String[] strings = StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.1").replace("[p]", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull")).split(Pattern.quote("|")); - this.func_146283_a(Arrays.asList(strings), x, y); + this.func_146283_a(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.1").replace("

", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull")), GuiBooklet.TOOLTIP_SPLIT_LENGTH), x, y); } if(x >= guiLeft+96 && y >= newTopOffset+65 && x <= guiLeft+96+31 && y <= newTopOffset+65+12){ - String[] strings = StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.1").replace("[p]", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put")).split(Pattern.quote("|")); - this.func_146283_a(Arrays.asList(strings), x, y); + this.func_146283_a(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.1").replace("

", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put")), GuiBooklet.TOOLTIP_SPLIT_LENGTH), x, y); } if(x >= guiLeft+48 && y >= newTopOffset+65 && x <= guiLeft+48+31 && y <= newTopOffset+65+12){ - String[] strings = StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.2").replace("[p]", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull")).split(Pattern.quote("|")); - this.func_146283_a(Arrays.asList(strings), x, y); + this.func_146283_a(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.2").replace("

", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull")), GuiBooklet.TOOLTIP_SPLIT_LENGTH), x, y); } if(x >= guiLeft+133 && y >= newTopOffset+65 && x <= guiLeft+133+31 && y <= newTopOffset+65+12){ - String[] strings = StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.2").replace("[p]", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put")).split(Pattern.quote("|")); - this.func_146283_a(Arrays.asList(strings), x, y); + this.func_146283_a(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.2").replace("

", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put")), GuiBooklet.TOOLTIP_SPLIT_LENGTH), x, y); } } diff --git a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java index 816417528..caf28b219 100644 --- a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java +++ b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java @@ -22,6 +22,7 @@ import ellpeck.actuallyadditions.blocks.render.*; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.event.RenderPlayerEventAA; +import ellpeck.actuallyadditions.event.TooltipEvent; import ellpeck.actuallyadditions.tile.*; import ellpeck.actuallyadditions.update.UpdateCheckerClientNotifier; import ellpeck.actuallyadditions.util.*; @@ -78,6 +79,7 @@ public class ClientProxy implements IProxy{ VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png")); + Util.registerEvent(new TooltipEvent()); Util.registerEvent(new RenderPlayerEventAA()); } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 284e81a3f..b82bf13c2 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -243,7 +243,7 @@ tooltip.actuallyadditions.noOredictNameAvail.desc=None tooltip.actuallyadditions.codeName.desc=Code Name tooltip.actuallyadditions.baseUnlocName.desc=Item's Unlocalized Name tooltip.actuallyadditions.unlocName.desc=Meta's Unlocalized Name -tooltip.actuallyadditions.disablingInfo.desc=If you don't want this Information |to appear, disable it in the |Actually Additions Config! +tooltip.actuallyadditions.disablingInfo.desc=If you don't want this Information to appear, disable it in the Actually Additions Config! tooltip.actuallyadditions.ctrlForMoreInfo.desc=Press CTRL for Advanced Info tooltip.actuallyadditions.extraInfo.desc=Advanced Info tile.actuallyadditions.blockXPSolidifier.name=Experience Solidifier @@ -329,9 +329,9 @@ info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"t info.actuallyadditions.update.download.desc=[{"text":"Download the newest Version "},{"text":"here! (Click me!)","color":"dark_green","underlined":"true","clickEvent":{"action":"open_url","value":"%s"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click here to open your Browser and download the newest Version!"}]}}}] info.actuallyadditions.update.failed.desc=[{"text":"The Update Check for "},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"failed! Check your Internet Connection and the Logs for more Info!","color":"none"}] info.actuallyadditions.update.changelog.desc=Updates: %s -info.actuallyadditions.inputter.info.1=This is the first Slot in the |connected Inventory to [p] at. -info.actuallyadditions.inputter.info.2=This is the slot after the last Slot |in the connected Inventory to [p] at. |What that means: If you, for example, write 2 in |the field to the left and 5 in this one, |it will [p] at Slot 2, 3, and 4. -info.actuallyadditions.inputter.whitelistInfo=This applies for this part |of the white-/blacklist. |The other side applies as well, |so you can have some Items |whitelisted and some blacklisted. |Note that, if you have an empty blacklist |or an item whitelisted on at least one |side, it will always go through. +info.actuallyadditions.inputter.info.1=This is the first Slot in the connected Inventory to

at. +info.actuallyadditions.inputter.info.2=This is the slot after the last Slot in the connected Inventory to

at. What that means: If you, for example, write 2 in the field to the left and 5 in this one, it will

at Slot 2, 3, and 4. +info.actuallyadditions.inputter.whitelistInfo=This applies for this part of the white-/blacklist. The other side applies as well, so you can have some Items whitelisted and some blacklisted. Note that, if you have an empty blacklist or an item whitelisted on at least one side, it will always go through. achievement.actuallyadditions.pickUpSolidXP=Square and yummy! achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience achievement.actuallyadditions.craftKnifeBlade=Sharp! So Sharp!