mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-19 20:00:05 +00:00
Update WAILA API (internal dev use, it doesn't get packed).
This commit is contained in:
1 parent
5c479f7a72
commit
b5c4b8a294
18 files changed
+417
-85
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public interface ITaggedList<E, T> extends List<E> {
|
||||
public boolean add(E e, T tag);
|
||||
public boolean add(E e, Collection<? extends T> taglst);
|
||||
public Set<T> getTags(E e);
|
||||
public Set<T> getTags(int index);
|
||||
public void addTag(E e, T tag);
|
||||
public void addTag(int index, T tag);
|
||||
public void removeTag(E e, T tag);
|
||||
public void removeTag(int index, T tag);
|
||||
public Set<E> getEntries(T tag);
|
||||
public void removeEntries(T tag);
|
||||
public String getTagsAsString(E e);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
public interface IWailaBlock {
|
||||
/*
|
||||
* Use this method to return an item stack in case the default lookup system fails.
|
||||
* Return null if you want to use the default lookup system.
|
||||
* You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities
|
||||
*/
|
||||
ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/* Waila HUD is divided into 3 zones. The head corresponds to the item name,
|
||||
* body to where you mostly want to put informations, and I reserve the tail for modname display
|
||||
*/
|
||||
|
||||
/* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD.
|
||||
* You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack().
|
||||
* ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info.
|
||||
* currenttip represents the current list of text lines in the tooltip zone.
|
||||
* For example, getWailaHead() will have the current item name as currenttip.
|
||||
* You can modify the tips, add more, remove some, etc.
|
||||
* When you are done, just returns the currenttip and it will display in Waila.
|
||||
*
|
||||
* Always return the currenttip is you don't want to modify the current zone.
|
||||
*/
|
||||
|
||||
List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
}
|
||||
@@ -2,8 +2,23 @@ package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Callback class interface used to provide Block/TileEntity decorator.<br>
|
||||
* All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be
|
||||
* registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method
|
||||
* (cf. {@link IWailaRegistrar} documentation for more information).
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaBlockDecorator {
|
||||
|
||||
/**
|
||||
* Callback for the decorator. It provides a standard GL stack positioned on the block.</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerDecorator}.</br>
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
*/
|
||||
void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.<br>
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).<br>
|
||||
* Common accessor for both Entity and Block/TileEntity.<br>
|
||||
* Available data depends on what it is called upon (ie : getEntity() will return null if looking at a block, etc).<br>
|
||||
*
|
||||
*/
|
||||
public interface IWailaCommonAccessor {
|
||||
World getWorld();
|
||||
EntityPlayer getPlayer();
|
||||
Block getBlock();
|
||||
int getBlockID();
|
||||
String getBlockQualifiedName();
|
||||
int getMetadata();
|
||||
TileEntity getTileEntity();
|
||||
Entity getEntity();
|
||||
MovingObjectPosition getPosition();
|
||||
Vec3 getRenderingPosition();
|
||||
NBTTagCompound getNBTData();
|
||||
int getNBTInteger(NBTTagCompound tag, String keyname);
|
||||
double getPartialFrame();
|
||||
ForgeDirection getSide();
|
||||
ItemStack getStack();
|
||||
}
|
||||
@@ -3,26 +3,42 @@ package mcp.mobius.waila.api;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Read-only interface for Waila internal config storage.<br>
|
||||
* An instance of this interface is passed to most of Waila callbacks as a way to change the behavior depending on client settings.
|
||||
*
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaConfigHandler {
|
||||
/* Returns a set of all the currently loaded modules in the config handler */
|
||||
/** Returns a set of all the currently loaded modules in the config handler.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Set<String> getModuleNames();
|
||||
|
||||
/* Returns all the currently available options for a given module */
|
||||
/**
|
||||
* Returns all the currently available options for a given module
|
||||
*
|
||||
* @param modName Module name
|
||||
* @return
|
||||
*/
|
||||
public HashMap<String, String> getConfigKeys(String modName);
|
||||
|
||||
/* Add a new option to a given module
|
||||
/**
|
||||
* Returns the current value of an option (true/false) with a default value if not set.
|
||||
*
|
||||
* modName is the name of the module to add the option to (ie : Buildcraft, IndustrialCraft2, etc)
|
||||
* key is the config key (ie : bc.tankcontent, ic2.inputvalue)
|
||||
* name is the human readable name of the option (ie : "Tank content", "Max EU Input")
|
||||
* */
|
||||
//public void addConfig(String modName, String key, String name);
|
||||
|
||||
/* Returns the current value of an option (true/false) with a default value defvalue if not set*/
|
||||
* @param key Option to lookup
|
||||
* @param defvalue Default values
|
||||
* @return Value of the option or defvalue if not set.
|
||||
*/
|
||||
public boolean getConfig(String key, boolean defvalue);
|
||||
|
||||
/* Returns the current value of an option (true/false) with a default value true if not set*/
|
||||
/**
|
||||
* Returns the current value of an option (true/false) with a default value true if not set
|
||||
*
|
||||
* @param key Option to lookup
|
||||
* @return Value of the option or true if not set.
|
||||
*/
|
||||
public boolean getConfig(String key);
|
||||
|
||||
//public void setConfig(String key, boolean value);
|
||||
}
|
||||
@@ -10,17 +10,21 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/* The Accessor is used to get some basic data out of the game without having to request
|
||||
* direct access to the game engine.
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).
|
||||
/**
|
||||
* The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.<br>
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).<br>
|
||||
* An instance of this interface is passed to most of Waila Block/TileEntity callbacks.
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IWailaDataAccessor {
|
||||
public interface IWailaDataAccessor{
|
||||
|
||||
World getWorld();
|
||||
EntityPlayer getPlayer();
|
||||
Block getBlock();
|
||||
int getBlockID();
|
||||
String getBlockQualifiedName();
|
||||
int getMetadata();
|
||||
TileEntity getTileEntity();
|
||||
MovingObjectPosition getPosition();
|
||||
|
||||
@@ -2,32 +2,82 @@ package mcp.mobius.waila.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Callback class interface used to provide Block/TileEntity tooltip informations to Waila.<br>
|
||||
* All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be
|
||||
* registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method
|
||||
* (cf. {@link IWailaRegistrar} documentation for more information).
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaDataProvider{
|
||||
/*
|
||||
* Use this method to return an item stack in case the default lookup system fails.
|
||||
* Return null if you want to use the default lookup system.
|
||||
* You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities
|
||||
|
||||
/**
|
||||
* Callback used to override the default Waila lookup system.</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerStackProvider}.</br>
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return null if override is not required, an ItemStack otherwise.
|
||||
*/
|
||||
ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/* Waila HUD is divided into 3 zones. The head corresponds to the item name,
|
||||
* body to where you mostly want to put informations, and I reserve the tail for modname display
|
||||
*/
|
||||
|
||||
/* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD.
|
||||
* You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack().
|
||||
* ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info.
|
||||
* currenttip represents the current list of text lines in the tooltip zone.
|
||||
* For example, getWailaHead() will have the current item name as currenttip.
|
||||
* You can modify the tips, add more, remove some, etc.
|
||||
* When you are done, just returns the currenttip and it will display in Waila.
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* Always return the currenttip is you don't want to modify the current zone.
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
|
||||
List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used server side to return a custom synchronization NBTTagCompound.</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerNBTProvider} server and client side.</br>
|
||||
* You are supposed to always return the modified input NBTTagCompound tag.</br>
|
||||
* @param player The player requesting data synchronization (The owner of the current connection).
|
||||
* @param te The TileEntity targeted for synchronization.
|
||||
* @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers).
|
||||
* @param world TileEntity's World.
|
||||
* @param x X position of the TileEntity.
|
||||
* @param y Y position of the TileEntity.
|
||||
* @param z Z position of the TileEntity.
|
||||
* @return Modified input NBTTagCompound tag.
|
||||
*/
|
||||
NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z);
|
||||
}
|
||||
@@ -7,9 +7,12 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/* The Accessor is used to get some basic data out of the game without having to request
|
||||
* direct access to the game engine.
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).
|
||||
/**
|
||||
* The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.<br>
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).<br>
|
||||
* An instance of this interface is passed to most of Waila Entity callbacks.
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IWailaEntityAccessor {
|
||||
|
||||
@@ -3,14 +3,77 @@ package mcp.mobius.waila.api;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Callback class interface used to provide Entity tooltip informations to Waila.<br>
|
||||
* All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be
|
||||
* registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method
|
||||
* (cf. {@link IWailaRegistrar} documentation for more information).
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaEntityProvider {
|
||||
|
||||
/* A way to get an override on the entity returned by the raytracing */
|
||||
/**
|
||||
* Callback used to override the default Waila lookup system.</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerOverrideEntityProvider}.</br>
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return null if override is not required, an Entity otherwise.
|
||||
*/
|
||||
Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/* The classical HEAD/BODY/TAIL text getters */
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param entity Current Entity scanned.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaHead(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param entity Current Entity scanned.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaBody(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param entity Current Entity scanned.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaTail(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used server side to return a custom synchronization NBTTagCompound.</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerNBTProvider} server and client side.</br>
|
||||
* You are supposed to always return the modified input NBTTagCompound tag.</br>
|
||||
* @param player The player requesting data synchronization (The owner of the current connection).
|
||||
* @param ent The Entity targeted for synchronization.
|
||||
* @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers).
|
||||
* @param world TileEntity's World.
|
||||
* @return Modified input NBTTagCompound tag.
|
||||
*/
|
||||
NBTTagCompound getNBTData(EntityPlayerMP player, Entity ent, NBTTagCompound tag, World world);
|
||||
}
|
||||
@@ -7,9 +7,12 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/* The Accessor is used to get some basic data out of the game without having to request
|
||||
* direct access to the game engine.
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).
|
||||
/**
|
||||
* The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.<br>
|
||||
* It will also return things that are unmodified by the overriding systems (like getWailaStack).<br>
|
||||
* An instance of this interface is passed to most of Waila FMP callbacks.
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IWailaFMPAccessor {
|
||||
|
||||
@@ -2,6 +2,22 @@ package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Callback class interface used to provide FMP decorator.<br>
|
||||
* All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be
|
||||
* registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method
|
||||
* (cf. {@link IWailaRegistrar} documentation for more information).
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaFMPDecorator {
|
||||
|
||||
/**
|
||||
* Callback for the decorator. It provides a standard GL stack positioned on the block.</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerDecorator}.</br>
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
*/
|
||||
void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config);
|
||||
}
|
||||
@@ -1,12 +1,54 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Callback class interface used to provide FMP tooltip informations to Waila.<br>
|
||||
* All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be
|
||||
* registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method
|
||||
* (cf. {@link IWailaRegistrar} documentation for more information).
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaFMPProvider {
|
||||
/* The classical HEAD/BODY/TAIL text getters */
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.</br>
|
||||
* You are supposed to always return the modified input currenttip.</br>
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers).
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip
|
||||
*/
|
||||
List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config);
|
||||
}
|
||||
@@ -1,11 +1,32 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
/**
|
||||
* Main registration interface. An instance will be provided to a method specified in an IMC msg formatted as follow<br>
|
||||
* FMLInterModComms.sendMessage("Waila", "register", "fully.qualified.path.to.registration.method");<br>
|
||||
* The registration method need to follow this signature<br>
|
||||
* public static void callbackRegister({@link IWailaRegistrar} registrar)<p>
|
||||
* If not specified otherwise, all the registration methods taking a class can take classes as well as interfaces.
|
||||
* Waila will do a lookup using instanceof on the registered classes, meaning that if all your targets inherit one interface, you only need
|
||||
* to specify it to cover the whole hierarchy.<br>
|
||||
* For the registration of blocks, both Blocks and TileEntities are accepted.<p>
|
||||
* For the configuration keys :<br>
|
||||
* modname refers to a String used for display in Waila's config panel.<br>
|
||||
* keyname refers to an unique key used internally for config query (cf {@link IWailaConfigHandler}). Those keys are shared across Waila, keep them unique !<br>
|
||||
*
|
||||
*
|
||||
* @author ProfMobius
|
||||
*
|
||||
*/
|
||||
public interface IWailaRegistrar {
|
||||
/* Add a config option in the section modname with displayed text configtext and access key keyname */
|
||||
public void addConfig(String modname, String keyname, String configtext);
|
||||
public void addConfig(String modname, String keyname, String configtext, boolean defvalue);
|
||||
public void addConfigRemote(String modname, String keyname, String configtext);
|
||||
public void addConfigRemote(String modname, String keyname, String configtext, boolean defvalue);
|
||||
public void addConfig(String modname, String keyname);
|
||||
public void addConfig(String modname, String keyname, boolean defvalue);
|
||||
public void addConfigRemote(String modname, String keyname);
|
||||
public void addConfigRemote(String modname, String keyname, boolean defvalue);
|
||||
|
||||
/* Register a stack overrider for the given blockID */
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, Class block);
|
||||
@@ -15,11 +36,17 @@ public interface IWailaRegistrar {
|
||||
public void registerBodyProvider (IWailaDataProvider dataProvider, Class block);
|
||||
public void registerTailProvider (IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */
|
||||
public void registerNBTProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* Entity text registration methods */
|
||||
public void registerHeadProvider (IWailaEntityProvider dataProvider, Class entity);
|
||||
public void registerBodyProvider (IWailaEntityProvider dataProvider, Class entity);
|
||||
public void registerTailProvider (IWailaEntityProvider dataProvider, Class entity);
|
||||
public void registerOverrideEntityProvider (IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
/* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */
|
||||
public void registerNBTProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
/* FMP Providers */
|
||||
public void registerHeadProvider(IWailaFMPProvider dataProvider, String name);
|
||||
@@ -35,10 +62,16 @@ public interface IWailaRegistrar {
|
||||
* registerNBTKey("bob.*", MyBlock.class)
|
||||
* registerNBTKey("data.life", MyEntity.class)
|
||||
* registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5
|
||||
*
|
||||
* This registration method is deprecated in favor to registerNBTProvider.
|
||||
* It will be removed in MC 1.8 !!!
|
||||
* */
|
||||
@Deprecated
|
||||
public void registerSyncedNBTKey(String key, Class target);
|
||||
|
||||
|
||||
public void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer);
|
||||
|
||||
/* UNUSED FOR NOW (Will be used for the ingame wiki */
|
||||
public void registerDocTextFile (String filename);
|
||||
public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item);
|
||||
//public void registerDocTextFile (String filename);
|
||||
//public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWailaSummaryProvider {
|
||||
/* This interface is used to control the display data in the description screen */
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
|
||||
|
||||
public interface IWailaTooltipRenderer {
|
||||
/**
|
||||
*
|
||||
* @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...})
|
||||
* @param accessor A global accessor for TileEntities and Entities
|
||||
* @return Dimension of the reserved area
|
||||
*/
|
||||
Dimension getSize(String[] params, IWailaCommonAccessor accessor);
|
||||
|
||||
/**
|
||||
* Draw method for the renderer. The GL matrice is automatically moved to the top left of the reserved zone.<br>
|
||||
* All calls should be relative to (0,0)
|
||||
*
|
||||
* @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...})
|
||||
* @param accessor A global accessor for TileEntities and Entities
|
||||
*/
|
||||
void draw (String[] params, IWailaCommonAccessor accessor);
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.RENDER;
|
||||
import static mcp.mobius.waila.api.SpecialChars.WailaStyle;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SpecialChars {
|
||||
|
||||
public static String MCStyle = "\u00A7";
|
||||
@@ -30,11 +35,36 @@ public class SpecialChars {
|
||||
|
||||
public static String WailaStyle = "\u00A4";
|
||||
public static String WailaIcon = "\u00A5";
|
||||
public static String WailaRenderer = "\u00A6";
|
||||
public static String TAB = WailaStyle + WailaStyle +"a";
|
||||
public static String ALIGNRIGHT = WailaStyle + WailaStyle +"b";
|
||||
public static String ALIGNCENTER = WailaStyle + WailaStyle +"c";
|
||||
public static String HEART = WailaStyle + WailaIcon +"a";
|
||||
public static String HHEART = WailaStyle + WailaIcon +"b";
|
||||
public static String EHEART = WailaStyle + WailaIcon +"c";
|
||||
public static String RENDER = WailaStyle + WailaRenderer +"a";
|
||||
|
||||
public static final Pattern patternMinecraft = Pattern.compile("(?i)" + MCStyle + "[0-9A-FK-OR]");
|
||||
public static final Pattern patternWaila = Pattern.compile("(?i)(" + WailaStyle + "(?<type>..))");
|
||||
public static final Pattern patternRender = Pattern.compile("(?i)(" + RENDER + "\\{(?<name>[^,}]*),?(?<args>[^}]*)\\})");
|
||||
public static final Pattern patternTab = Pattern.compile("(?i)" + TAB);
|
||||
public static final Pattern patternRight = Pattern.compile("(?i)" + ALIGNRIGHT);
|
||||
public static final Pattern patternCenter = Pattern.compile("(?i)" + ALIGNCENTER);
|
||||
public static final Pattern patternIcon = Pattern.compile("(?i)(" + WailaStyle + WailaIcon + "(?<type>[0-9a-z]))");
|
||||
public static final Pattern patternLineSplit = Pattern.compile("(?i)(" + WailaStyle + WailaStyle + "[^" + WailaStyle + "]+|" + WailaStyle + WailaIcon + "[0-9A-Z]|" + WailaStyle + WailaRenderer + "a\\{([^,}]*),?([^}]*)\\}|[^" + WailaStyle + "]+)");
|
||||
|
||||
/**
|
||||
* Helper method to get a proper RENDER string. Just put the name of the renderer and the params in, and it will give back a directly usable String for the tooltip.
|
||||
* @param name
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public static String getRenderString(String name, String... params){
|
||||
String result = RENDER + "{" + name;
|
||||
for (String s : params){
|
||||
result += "," + s;
|
||||
}
|
||||
result += "}";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
@API(apiVersion="1.0",owner="Waila",provides="WailaAPI")
|
||||
@API(apiVersion="1.2",owner="Waila",provides="WailaAPI")
|
||||
package mcp.mobius.waila.api;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -10,8 +10,12 @@ import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -78,5 +82,10 @@ public class Waila extends IntegrationModule
|
||||
public List<String> getWailaTail (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData (EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user