mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Added a character limit to the NBT display of the advanced info so that it doesn't crash on really long NBT tags
This commit is contained in:
parent
9b7652e6bc
commit
2eaccba3e3
2 changed files with 15 additions and 2 deletions
|
@ -23,7 +23,8 @@ public enum ConfigIntValues{
|
||||||
BLACK_LOTUS_AMOUNT("Black Lotus: Amount", ConfigCategories.WORLD_GEN, 14, 1, 50, "The Amount of Black Lotus generating"),
|
BLACK_LOTUS_AMOUNT("Black Lotus: Amount", ConfigCategories.WORLD_GEN, 14, 1, 50, "The Amount of Black Lotus generating"),
|
||||||
LUSH_CAVE_CHANCE("Lush Caves: Chance", ConfigCategories.WORLD_GEN, 20, 1, 100, "The chance for lush caves to generate. The lower the number, the likelier."),
|
LUSH_CAVE_CHANCE("Lush Caves: Chance", ConfigCategories.WORLD_GEN, 20, 1, 100, "The chance for lush caves to generate. The lower the number, the likelier."),
|
||||||
|
|
||||||
TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client");
|
TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"),
|
||||||
|
CTRL_INFO_NBT_CHAR_LIMIT("Advanced Info NBT Character Limit", ConfigCategories.OTHER, 1000, 0, 100000000, "The maximum amount of characters that is displayed by the NBT view of the CTRL Advanced Info. Set to a zero to have no limit");
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String category;
|
public final String category;
|
||||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.event;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
|
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
|
@ -99,7 +100,18 @@ public class ClientEvents{
|
||||||
if(compound != null && !compound.hasNoTags()){
|
if(compound != null && !compound.hasNoTags()){
|
||||||
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".nbt.desc")+":");
|
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".nbt.desc")+":");
|
||||||
if(GuiScreen.isShiftKeyDown()){
|
if(GuiScreen.isShiftKeyDown()){
|
||||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+compound.toString());
|
int limit = ConfigIntValues.CTRL_INFO_NBT_CHAR_LIMIT.getValue();
|
||||||
|
String compoundStrg = compound.toString();
|
||||||
|
int compoundStrgLength = compoundStrg.length();
|
||||||
|
|
||||||
|
String compoundDisplay;
|
||||||
|
if(limit > 0 && compoundStrgLength > limit){
|
||||||
|
compoundDisplay = compoundStrg.substring(0, limit)+TextFormatting.GRAY+" ("+(compoundStrgLength-limit)+" more characters...)";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
compoundDisplay = compoundStrg;
|
||||||
|
}
|
||||||
|
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+compoundDisplay);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+TextFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".pressShift.desc")+"]");
|
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+TextFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".pressShift.desc")+"]");
|
||||||
|
|
Loading…
Reference in a new issue