mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-25 20:32:27 +00:00
Merge pull request #25 from GTNewHorizons/cell-partition-tooltip
Add partition tooltip to essentia cells
This commit is contained in:
4 files changed
+36
-7
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ dependencies {
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.4:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.5:dev")
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-86-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-112-GTNH:dev")
|
||||
|
||||
compile("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package thaumicenergistics.common.items;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
@@ -31,6 +34,7 @@ import thaumicenergistics.common.ThaumicEnergistics;
|
||||
import thaumicenergistics.common.inventory.HandlerItemEssentiaCell;
|
||||
import thaumicenergistics.common.inventory.HandlerItemEssentiaCellCreative;
|
||||
import thaumicenergistics.common.registries.ThEStrings;
|
||||
import thaumicenergistics.common.storage.AspectStack;
|
||||
import thaumicenergistics.common.storage.AspectStackComparator;
|
||||
import thaumicenergistics.common.storage.EnumEssentiaStorageTypes;
|
||||
|
||||
@@ -92,8 +96,8 @@ public class ItemEssentiaCell
|
||||
String aspectChatColor = currentStack.getChatColor();
|
||||
|
||||
// Build the display string
|
||||
String aspectInfo = String.format( "%s%s%s x %d", aspectChatColor, currentStack.getAspectName( player ),
|
||||
EnumChatFormatting.WHITE.toString(), currentStack.getStackSize() );
|
||||
String aspectInfo = String.format( " %s%s%s x %d", aspectChatColor, currentStack.getAspectName( player ),
|
||||
EnumChatFormatting.WHITE, currentStack.getStackSize() );
|
||||
|
||||
// Add to the list
|
||||
displayList.add( aspectInfo );
|
||||
@@ -102,6 +106,21 @@ public class ItemEssentiaCell
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the partitions of the cell to the description tooltip.
|
||||
*
|
||||
* @param cellHandler
|
||||
* @param player
|
||||
*/
|
||||
private List<String> addPartitionsToCellDescription(final HandlerItemEssentiaCell cellHandler, final EntityPlayer player) {
|
||||
return cellHandler.getPartitionAspects().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(aspect -> new AspectStack(aspect, 1))
|
||||
.sorted(new AspectStackComparator())
|
||||
.map(aspect -> String.format(" %s%s", aspect.getChatColor(), aspect.getAspectName(player)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the cell tooltip.
|
||||
*/
|
||||
@@ -135,21 +154,29 @@ public class ItemEssentiaCell
|
||||
if( cellHandler.isPartitioned() )
|
||||
{
|
||||
displayList.add( GuiText.Partitioned.getLocal() );
|
||||
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || ( Keyboard.isKeyDown( Keyboard.KEY_RSHIFT ) ) )
|
||||
{
|
||||
// Add information about the partitioned essentia types in the cell
|
||||
displayList.add(GuiText.Filter.getLocal() + ": ");
|
||||
displayList.addAll(addPartitionsToCellDescription(cellHandler, player));
|
||||
}
|
||||
}
|
||||
|
||||
// Does the cell have anything stored?
|
||||
if( cellHandler.getUsedTypes() > 0 )
|
||||
{
|
||||
// Is shift being held?
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || ( Keyboard.isKeyDown( Keyboard.KEY_RSHIFT ) ) )
|
||||
// Is control being held?
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_LCONTROL ) || ( Keyboard.isKeyDown( Keyboard.KEY_RCONTROL ) ) )
|
||||
{
|
||||
displayList.add(ThEStrings.Tooltip_CellContains.getLocalized() + ":");
|
||||
// Add information about the essentia types in the cell
|
||||
this.addContentsToCellDescription( cellHandler, displayList, player );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let the user know they can hold shift
|
||||
displayList.add( EnumChatFormatting.WHITE.toString() + EnumChatFormatting.ITALIC.toString() +
|
||||
displayList.add( EnumChatFormatting.WHITE + EnumChatFormatting.ITALIC.toString() +
|
||||
ThEStrings.Tooltip_ItemStackDetails.getLocalized() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public enum ThEStrings
|
||||
Tooltip_ItemStackDetails ("tooltip.itemstack.details", false),
|
||||
Tooltip_CellBytes ("tooltip.essentia.cell.bytes", false),
|
||||
Tooltip_CellTypes ("tooltip.essentia.cell.types", false),
|
||||
Tooltip_CellContains ("tooltip.essentia.cell.contains", false),
|
||||
Tooltip_ArcaneAssemblerHasVis ("tooltip.arcane.assembler.hasVis", false),
|
||||
|
||||
// Button Tooltips
|
||||
|
||||
@@ -48,7 +48,8 @@ thaumicenergistics.item.focus.aewrench.disabled.name=Wand Focus: AE Wrench - Wre
|
||||
thaumicenergistics.item.golem.wifi.backpack.name=Wireless Golem Backpack
|
||||
|
||||
#Tooltips
|
||||
thaumicenergistics.tooltip.itemstack.details=Hold §eshift§f for details.
|
||||
thaumicenergistics.tooltip.itemstack.details=Hold §eCTRL§f for details.
|
||||
thaumicenergistics.tooltip.essentia.cell.contains=Contains
|
||||
thaumicenergistics.tooltip.essentia.cell.bytes=%d of %d bytes used.
|
||||
thaumicenergistics.tooltip.essentia.cell.types=%d of %d essentia types stored.
|
||||
thaumicenergistics.tooltip.button.void=Allow Void?
|
||||
|
||||
Reference in new issue
Block a user