mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 16:58:34 +01:00
Added Special Tooltips for every item: OreDict, Unlocalized Name etc.
This commit is contained in:
parent
5760c98220
commit
8189e569bb
4 changed files with 54 additions and 11 deletions
|
@ -41,7 +41,10 @@ public enum ConfigBoolValues{
|
||||||
PREVENT_OIL_OVERRIDE("Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Oil Fluids from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
PREVENT_OIL_OVERRIDE("Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Oil Fluids from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||||
PREVENT_CANOLA_OVERRIDE("Canola Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Fluids from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
PREVENT_CANOLA_OVERRIDE("Canola Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Fluids from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||||
PREVENT_OIL_BLOCK_OVERRIDE("Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Oil Blocks from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
PREVENT_OIL_BLOCK_OVERRIDE("Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Oil Blocks from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||||
PREVENT_CANOLA_BLOCK_OVERRIDE("Canola Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Blocks from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING);
|
PREVENT_CANOLA_BLOCK_OVERRIDE("Canola Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Blocks from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||||
|
|
||||||
|
CTRL_EXTRA_INFO("Advanced Info", ConfigCategories.OTHER, true, "Show Advanced Item Info when holding Control on every Item"),
|
||||||
|
CTRL_INFO_FOR_EXTRA_INFO("Advanced Info Tooltips", ConfigCategories.OTHER, true, "Show the 'Press Control for more Info'-Text on Item Tooltips");
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String category;
|
public final String category;
|
||||||
|
|
|
@ -1,26 +1,62 @@
|
||||||
package ellpeck.actuallyadditions.event;
|
package ellpeck.actuallyadditions.event;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||||
import ellpeck.actuallyadditions.util.KeyUtil;
|
import ellpeck.actuallyadditions.util.KeyUtil;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
public class TooltipEvent{
|
public class TooltipEvent{
|
||||||
|
|
||||||
@SubscribeEvent
|
private static final String TEXT_PRE = StringUtil.GRAY+" ";
|
||||||
|
private static final String HEADER_PRE = StringUtil.LIGHT_GRAY+" -";
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onTooltipEvent(ItemTooltipEvent event){
|
public void onTooltipEvent(ItemTooltipEvent event){
|
||||||
|
if(event.itemStack.getItem() != null){
|
||||||
if(KeyUtil.isControlPressed()){
|
if(KeyUtil.isControlPressed()){
|
||||||
|
if(ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()){
|
||||||
|
event.toolTip.add(StringUtil.GRAY+StringUtil.ITALIC+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".extraInfo.desc")+":");
|
||||||
|
|
||||||
|
//OreDict Names
|
||||||
int[] oreIDs = OreDictionary.getOreIDs(event.itemStack);
|
int[] oreIDs = OreDictionary.getOreIDs(event.itemStack);
|
||||||
|
event.toolTip.add(HEADER_PRE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".oredictName.desc")+":");
|
||||||
if(oreIDs.length > 0){
|
if(oreIDs.length > 0){
|
||||||
event.toolTip.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".oredictName.desc") + ":");
|
|
||||||
for(int oreID : oreIDs){
|
for(int oreID : oreIDs){
|
||||||
event.toolTip.add(StringUtil.GRAY + "-" + OreDictionary.getOreName(oreID));
|
event.toolTip.add(TEXT_PRE+OreDictionary.getOreName(oreID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event.toolTip.add(TEXT_PRE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".noOredictNameAvail.desc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Code Name
|
||||||
|
event.toolTip.add(HEADER_PRE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".codeName.desc")+":");
|
||||||
|
event.toolTip.add(TEXT_PRE+Item.itemRegistry.getNameForObject(event.itemStack.getItem()));
|
||||||
|
|
||||||
|
//Base Item's Unlocalized Name
|
||||||
|
String baseName = event.itemStack.getItem().getUnlocalizedName();
|
||||||
|
event.toolTip.add(HEADER_PRE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".baseUnlocName.desc")+":");
|
||||||
|
event.toolTip.add(TEXT_PRE+baseName);
|
||||||
|
|
||||||
|
//Unlocalized Name
|
||||||
|
String metaName = event.itemStack.getItem().getUnlocalizedName(event.itemStack);
|
||||||
|
if(!metaName.equals(baseName)){
|
||||||
|
event.toolTip.add(HEADER_PRE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".unlocName.desc")+":");
|
||||||
|
event.toolTip.add(TEXT_PRE+metaName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){
|
||||||
|
event.toolTip.add(StringUtil.GRAY+StringUtil.ITALIC+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".ctrlForMoreInfo.desc"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else event.toolTip.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".noOredictNameAvail.desc"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ public class ContainerOreMagnet extends Container{
|
||||||
this.addSlotToContainer(new Slot(this.magnet, TileEntityOreMagnet.SLOT_OIL_INPUT, 98, 74));
|
this.addSlotToContainer(new Slot(this.magnet, TileEntityOreMagnet.SLOT_OIL_INPUT, 98, 74));
|
||||||
this.addSlotToContainer(new SlotOutput(this.magnet, TileEntityOreMagnet.SLOT_OIL_OUTPUT, 98, 43));
|
this.addSlotToContainer(new SlotOutput(this.magnet, TileEntityOreMagnet.SLOT_OIL_OUTPUT, 98, 43));
|
||||||
|
|
||||||
//TODO Change away from SlotOutput when implementing upgrades
|
|
||||||
this.addSlotToContainer(new SlotOutput(this.magnet, TileEntityOreMagnet.SLOT_UPGRADE, 71, 43));
|
this.addSlotToContainer(new SlotOutput(this.magnet, TileEntityOreMagnet.SLOT_UPGRADE, 71, 43));
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++){
|
for (int i = 0; i < 3; i++){
|
||||||
|
|
|
@ -387,13 +387,18 @@ item.actuallyadditions.itemDustCoal.name=Crushed Coal
|
||||||
item.actuallyadditions.itemDustQuartzBlack.name=Crushed Black Quartz
|
item.actuallyadditions.itemDustQuartzBlack.name=Crushed Black Quartz
|
||||||
|
|
||||||
tooltip.actuallyadditions.shiftForInfo.desc=Press Shift for Info
|
tooltip.actuallyadditions.shiftForInfo.desc=Press Shift for Info
|
||||||
|
tooltip.actuallyadditions.ctrlForMoreInfo.desc=<CTRL for Advanced Info>
|
||||||
|
tooltip.actuallyadditions.extraInfo.desc=Advanced Info
|
||||||
tooltip.actuallyadditions.hunger.desc=Hunger Points
|
tooltip.actuallyadditions.hunger.desc=Hunger Points
|
||||||
tooltip.actuallyadditions.saturation.desc=Saturation
|
tooltip.actuallyadditions.saturation.desc=Saturation
|
||||||
tooltip.actuallyadditions.durability.desc=Durability
|
tooltip.actuallyadditions.durability.desc=Durability
|
||||||
tooltip.actuallyadditions.noEffects.desc=No Effects
|
tooltip.actuallyadditions.noEffects.desc=No Effects
|
||||||
|
|
||||||
tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries
|
tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries
|
||||||
tooltip.actuallyadditions.noOredictNameAvail.desc=Has No OreDictionary Entries
|
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
|
||||||
|
|
||||||
tile.actuallyadditions.blockXPSolidifier.name=Experience Solidifier
|
tile.actuallyadditions.blockXPSolidifier.name=Experience Solidifier
|
||||||
tooltip.actuallyadditions.blockXPSolidifier.desc.1=Turns a Player's Experience into Solidified Experience!
|
tooltip.actuallyadditions.blockXPSolidifier.desc.1=Turns a Player's Experience into Solidified Experience!
|
||||||
|
|
Loading…
Reference in a new issue