From 6fe19c568683c5f7f43b2f988323e34a3fc9c3d6 Mon Sep 17 00:00:00 2001 From: Robert S Date: Sat, 26 Apr 2014 14:55:46 -0400 Subject: [PATCH] Added waila to each sub mod src folder in attempt to fix build server, need a better way to handle this --- .../mcp/mobius/waila/api/IWailaBlock.java | 0 .../waila/api/IWailaBlockDecorator.java | 0 .../mobius/waila/api/IWailaConfigHandler.java | 0 .../mobius/waila/api/IWailaDataAccessor.java | 0 .../mobius/waila/api/IWailaDataProvider.java | 0 .../waila/api/IWailaEntityAccessor.java | 0 .../waila/api/IWailaEntityProvider.java | 0 .../mobius/waila/api/IWailaFMPAccessor.java | 0 .../mobius/waila/api/IWailaFMPDecorator.java | 0 .../mobius/waila/api/IWailaFMPProvider.java | 0 .../mcp/mobius/waila/api/IWailaRegistrar.java | 0 .../waila/api/IWailaSummaryProvider.java | 0 .../mcp/mobius/waila/api/SpecialChars.java | 0 .../mcp/mobius/waila/api/package-info.java | 0 .../mcp/mobius/waila/api/IWailaBlock.java | 34 +++++++++++ .../waila/api/IWailaBlockDecorator.java | 9 +++ .../mobius/waila/api/IWailaConfigHandler.java | 28 ++++++++++ .../mobius/waila/api/IWailaDataAccessor.java | 33 +++++++++++ .../mobius/waila/api/IWailaDataProvider.java | 33 +++++++++++ .../waila/api/IWailaEntityAccessor.java | 24 ++++++++ .../waila/api/IWailaEntityProvider.java | 16 ++++++ .../mobius/waila/api/IWailaFMPAccessor.java | 28 ++++++++++ .../mobius/waila/api/IWailaFMPDecorator.java | 7 +++ .../mobius/waila/api/IWailaFMPProvider.java | 12 ++++ .../mcp/mobius/waila/api/IWailaRegistrar.java | 56 +++++++++++++++++++ .../waila/api/IWailaSummaryProvider.java | 21 +++++++ .../mcp/mobius/waila/api/SpecialChars.java | 40 +++++++++++++ .../mcp/mobius/waila/api/package-info.java | 3 + .../mcp/mobius/waila/api/IWailaBlock.java | 34 +++++++++++ .../waila/api/IWailaBlockDecorator.java | 9 +++ .../mobius/waila/api/IWailaConfigHandler.java | 28 ++++++++++ .../mobius/waila/api/IWailaDataAccessor.java | 33 +++++++++++ .../mobius/waila/api/IWailaDataProvider.java | 33 +++++++++++ .../waila/api/IWailaEntityAccessor.java | 24 ++++++++ .../waila/api/IWailaEntityProvider.java | 16 ++++++ .../mobius/waila/api/IWailaFMPAccessor.java | 28 ++++++++++ .../mobius/waila/api/IWailaFMPDecorator.java | 7 +++ .../mobius/waila/api/IWailaFMPProvider.java | 12 ++++ .../mcp/mobius/waila/api/IWailaRegistrar.java | 56 +++++++++++++++++++ .../waila/api/IWailaSummaryProvider.java | 21 +++++++ .../mcp/mobius/waila/api/SpecialChars.java | 40 +++++++++++++ .../mcp/mobius/waila/api/package-info.java | 3 + .../mcp/mobius/waila/api/IWailaBlock.java | 34 +++++++++++ .../waila/api/IWailaBlockDecorator.java | 9 +++ .../mobius/waila/api/IWailaConfigHandler.java | 28 ++++++++++ .../mobius/waila/api/IWailaDataAccessor.java | 33 +++++++++++ .../mobius/waila/api/IWailaDataProvider.java | 33 +++++++++++ .../waila/api/IWailaEntityAccessor.java | 24 ++++++++ .../waila/api/IWailaEntityProvider.java | 16 ++++++ .../mobius/waila/api/IWailaFMPAccessor.java | 28 ++++++++++ .../mobius/waila/api/IWailaFMPDecorator.java | 7 +++ .../mobius/waila/api/IWailaFMPProvider.java | 12 ++++ .../mcp/mobius/waila/api/IWailaRegistrar.java | 56 +++++++++++++++++++ .../waila/api/IWailaSummaryProvider.java | 21 +++++++ .../mcp/mobius/waila/api/SpecialChars.java | 40 +++++++++++++ .../mcp/mobius/waila/api/package-info.java | 3 + 56 files changed, 1032 insertions(+) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaBlock.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaBlockDecorator.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaConfigHandler.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaDataAccessor.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaDataProvider.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaEntityAccessor.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaEntityProvider.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaFMPAccessor.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaFMPDecorator.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaFMPProvider.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaRegistrar.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/IWailaSummaryProvider.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/SpecialChars.java (100%) rename {src/api/scala => archaic/api/java}/mcp/mobius/waila/api/package-info.java (100%) create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaBlock.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/SpecialChars.java create mode 100644 electrical/api/java/mcp/mobius/waila/api/package-info.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaBlock.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/SpecialChars.java create mode 100644 mechanical/api/java/mcp/mobius/waila/api/package-info.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaBlock.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/SpecialChars.java create mode 100644 src/api/java/mcp/mobius/waila/api/package-info.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaBlock.java b/archaic/api/java/mcp/mobius/waila/api/IWailaBlock.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaBlock.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaBlock.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaBlockDecorator.java b/archaic/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaBlockDecorator.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaConfigHandler.java b/archaic/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaConfigHandler.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaDataAccessor.java b/archaic/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaDataAccessor.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaDataProvider.java b/archaic/api/java/mcp/mobius/waila/api/IWailaDataProvider.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaDataProvider.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaDataProvider.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaEntityAccessor.java b/archaic/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaEntityAccessor.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaEntityProvider.java b/archaic/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaEntityProvider.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaFMPAccessor.java b/archaic/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaFMPAccessor.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaFMPDecorator.java b/archaic/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaFMPDecorator.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaFMPProvider.java b/archaic/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaFMPProvider.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaRegistrar.java b/archaic/api/java/mcp/mobius/waila/api/IWailaRegistrar.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaRegistrar.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaRegistrar.java diff --git a/src/api/scala/mcp/mobius/waila/api/IWailaSummaryProvider.java b/archaic/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/IWailaSummaryProvider.java rename to archaic/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java diff --git a/src/api/scala/mcp/mobius/waila/api/SpecialChars.java b/archaic/api/java/mcp/mobius/waila/api/SpecialChars.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/SpecialChars.java rename to archaic/api/java/mcp/mobius/waila/api/SpecialChars.java diff --git a/src/api/scala/mcp/mobius/waila/api/package-info.java b/archaic/api/java/mcp/mobius/waila/api/package-info.java similarity index 100% rename from src/api/scala/mcp/mobius/waila/api/package-info.java rename to archaic/api/java/mcp/mobius/waila/api/package-info.java diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaBlock.java b/electrical/api/java/mcp/mobius/waila/api/IWailaBlock.java new file mode 100644 index 00000000..8b4dd131 --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaBlock.java @@ -0,0 +1,34 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +@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 getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/electrical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java new file mode 100644 index 00000000..935d475f --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java @@ -0,0 +1,9 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaBlockDecorator { + + void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); + +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/electrical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java new file mode 100644 index 00000000..faede63f --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +import java.util.HashMap; +import java.util.Set; + +public interface IWailaConfigHandler { + /* Returns a set of all the currently loaded modules in the config handler */ + public Set getModuleNames(); + + /* Returns all the currently available options for a given module */ + public HashMap getConfigKeys(String modName); + + /* Add a new option to a given module + * + * 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*/ + public boolean getConfig(String key, boolean defvalue); + + /* Returns the current value of an option (true/false) with a default value true if not set*/ + public boolean getConfig(String key); + + //public void setConfig(String key, boolean value); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/electrical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java new file mode 100644 index 00000000..5eade35f --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import net.minecraft.block.Block; +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.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). + */ + +public interface IWailaDataAccessor { + + World getWorld(); + EntityPlayer getPlayer(); + Block getBlock(); + int getBlockID(); + int getMetadata(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + ForgeDirection getSide(); + ItemStack getStack(); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/electrical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java new file mode 100644 index 00000000..4859d9cd --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +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 + */ + 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 getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/electrical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java new file mode 100644 index 00000000..788067af --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java @@ -0,0 +1,24 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +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). + */ + +public interface IWailaEntityAccessor { + World getWorld(); + EntityPlayer getPlayer(); + Entity getEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/electrical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java new file mode 100644 index 00000000..9548289a --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java @@ -0,0 +1,16 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.entity.Entity; + +public interface IWailaEntityProvider { + + /* A way to get an override on the entity returned by the raytracing */ + Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); + + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/electrical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java new file mode 100644 index 00000000..e30afc43 --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +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.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). + */ + +public interface IWailaFMPAccessor { + World getWorld(); + EntityPlayer getPlayer(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + NBTTagCompound getNBTData(); + NBTTagCompound getFullNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + Vec3 getRenderingPosition(); + String getID(); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/electrical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java new file mode 100644 index 00000000..839af31f --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java @@ -0,0 +1,7 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPDecorator { + void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/electrical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java new file mode 100644 index 00000000..232c83ef --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java @@ -0,0 +1,12 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPProvider { + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/electrical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java new file mode 100644 index 00000000..833f7715 --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java @@ -0,0 +1,56 @@ +package mcp.mobius.waila.api; + +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 addConfigRemote(String modname, String keyname, String configtext); + public void addConfig(String modname, String keyname); + public void addConfigRemote(String modname, String keyname); + + /* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */ + @Deprecated + public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID); + @Deprecated + public void registerBodyProvider (IWailaDataProvider dataProvider, int blockID); + @Deprecated + public void registerTailProvider (IWailaDataProvider dataProvider, int blockID); + + /* Register a stack overrider for the given blockID */ + @Deprecated + public void registerStackProvider(IWailaDataProvider dataProvider, int blockID); + public void registerStackProvider(IWailaDataProvider dataProvider, Class block); + + /* Same thing, but works on a class hierarchy instead */ + public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); + public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); + public void registerTailProvider (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); + + /* FMP Providers */ + public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); + public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); + public void registerTailProvider(IWailaFMPProvider dataProvider, String name); + + /* The block decorators */ + @Deprecated + public void registerDecorator (IWailaBlockDecorator decorator, int blockID); + public void registerDecorator (IWailaBlockDecorator decorator, Class block); + public void registerDecorator (IWailaFMPDecorator decorator, String name); + + /* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent). + * Accept * as a ending wildcard + * registerNBTKey("bob.*", MyBlock.class) + * registerNBTKey("data.life", MyEntity.class) + * registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5 + * */ + public void registerSyncedNBTKey(String key, Class target); + + /* UNUSED FOR NOW (Will be used for the ingame wiki */ + public void registerDocTextFile (String filename); + public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/electrical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java new file mode 100644 index 00000000..f7906498 --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java @@ -0,0 +1,21 @@ +package mcp.mobius.waila.api; + +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 */ + + /* BASIC TOOLS & ITEMS DATA */ + //EnumToolMaterial getMaterial(ItemStack stack); + //String getMaterialName(ItemStack stack); + //String getEffectiveBlock(ItemStack stack); + //int getHarvestLevel(ItemStack stack); + //float getEfficiencyOnProperMaterial(ItemStack stack); + //int getEnchantability(ItemStack stack); + //int getDamageVsEntity(ItemStack stack); + //int getDurability(ItemStack stack); + + LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); +} diff --git a/electrical/api/java/mcp/mobius/waila/api/SpecialChars.java b/electrical/api/java/mcp/mobius/waila/api/SpecialChars.java new file mode 100644 index 00000000..5bd92a82 --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/SpecialChars.java @@ -0,0 +1,40 @@ +package mcp.mobius.waila.api; + +public class SpecialChars { + + public static String MCStyle = "\u00A7"; + + public static String BLACK = MCStyle + "0"; + public static String DBLUE = MCStyle + "1"; + public static String DGREEN = MCStyle + "2"; + public static String DAQUA = MCStyle + "3"; + public static String DRED = MCStyle + "4"; + public static String DPURPLE = MCStyle + "5"; + public static String GOLD = MCStyle + "6"; + public static String GRAY = MCStyle + "7"; + public static String DGRAY = MCStyle + "8"; + public static String BLUE = MCStyle + "9"; + public static String GREEN = MCStyle + "a"; + public static String AQUA = MCStyle + "b"; + public static String RED = MCStyle + "c"; + public static String LPURPLE = MCStyle + "d"; + public static String YELLOW = MCStyle + "e"; + public static String WHITE = MCStyle + "f"; + + public static String OBF = MCStyle + "k"; + public static String BOLD = MCStyle + "l"; + public static String STRIKE = MCStyle + "m"; + public static String UNDER = MCStyle + "n"; + public static String ITALIC = MCStyle + "o"; + public static String RESET = MCStyle + "r"; + + public static String WailaStyle = "\u00A4"; + public static String WailaIcon = "\u00A5"; + 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"; + +} diff --git a/electrical/api/java/mcp/mobius/waila/api/package-info.java b/electrical/api/java/mcp/mobius/waila/api/package-info.java new file mode 100644 index 00000000..9b5e663b --- /dev/null +++ b/electrical/api/java/mcp/mobius/waila/api/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="Waila",provides="WailaAPI") +package mcp.mobius.waila.api; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaBlock.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaBlock.java new file mode 100644 index 00000000..8b4dd131 --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaBlock.java @@ -0,0 +1,34 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +@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 getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java new file mode 100644 index 00000000..935d475f --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java @@ -0,0 +1,9 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaBlockDecorator { + + void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); + +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java new file mode 100644 index 00000000..faede63f --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +import java.util.HashMap; +import java.util.Set; + +public interface IWailaConfigHandler { + /* Returns a set of all the currently loaded modules in the config handler */ + public Set getModuleNames(); + + /* Returns all the currently available options for a given module */ + public HashMap getConfigKeys(String modName); + + /* Add a new option to a given module + * + * 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*/ + public boolean getConfig(String key, boolean defvalue); + + /* Returns the current value of an option (true/false) with a default value true if not set*/ + public boolean getConfig(String key); + + //public void setConfig(String key, boolean value); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java new file mode 100644 index 00000000..5eade35f --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import net.minecraft.block.Block; +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.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). + */ + +public interface IWailaDataAccessor { + + World getWorld(); + EntityPlayer getPlayer(); + Block getBlock(); + int getBlockID(); + int getMetadata(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + ForgeDirection getSide(); + ItemStack getStack(); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java new file mode 100644 index 00000000..4859d9cd --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaDataProvider.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +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 + */ + 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 getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java new file mode 100644 index 00000000..788067af --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java @@ -0,0 +1,24 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +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). + */ + +public interface IWailaEntityAccessor { + World getWorld(); + EntityPlayer getPlayer(); + Entity getEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java new file mode 100644 index 00000000..9548289a --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java @@ -0,0 +1,16 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.entity.Entity; + +public interface IWailaEntityProvider { + + /* A way to get an override on the entity returned by the raytracing */ + Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); + + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java new file mode 100644 index 00000000..e30afc43 --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +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.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). + */ + +public interface IWailaFMPAccessor { + World getWorld(); + EntityPlayer getPlayer(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + NBTTagCompound getNBTData(); + NBTTagCompound getFullNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + Vec3 getRenderingPosition(); + String getID(); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java new file mode 100644 index 00000000..839af31f --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java @@ -0,0 +1,7 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPDecorator { + void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java new file mode 100644 index 00000000..232c83ef --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java @@ -0,0 +1,12 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPProvider { + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java new file mode 100644 index 00000000..833f7715 --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaRegistrar.java @@ -0,0 +1,56 @@ +package mcp.mobius.waila.api; + +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 addConfigRemote(String modname, String keyname, String configtext); + public void addConfig(String modname, String keyname); + public void addConfigRemote(String modname, String keyname); + + /* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */ + @Deprecated + public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID); + @Deprecated + public void registerBodyProvider (IWailaDataProvider dataProvider, int blockID); + @Deprecated + public void registerTailProvider (IWailaDataProvider dataProvider, int blockID); + + /* Register a stack overrider for the given blockID */ + @Deprecated + public void registerStackProvider(IWailaDataProvider dataProvider, int blockID); + public void registerStackProvider(IWailaDataProvider dataProvider, Class block); + + /* Same thing, but works on a class hierarchy instead */ + public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); + public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); + public void registerTailProvider (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); + + /* FMP Providers */ + public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); + public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); + public void registerTailProvider(IWailaFMPProvider dataProvider, String name); + + /* The block decorators */ + @Deprecated + public void registerDecorator (IWailaBlockDecorator decorator, int blockID); + public void registerDecorator (IWailaBlockDecorator decorator, Class block); + public void registerDecorator (IWailaFMPDecorator decorator, String name); + + /* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent). + * Accept * as a ending wildcard + * registerNBTKey("bob.*", MyBlock.class) + * registerNBTKey("data.life", MyEntity.class) + * registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5 + * */ + public void registerSyncedNBTKey(String key, Class target); + + /* UNUSED FOR NOW (Will be used for the ingame wiki */ + public void registerDocTextFile (String filename); + public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/mechanical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java new file mode 100644 index 00000000..f7906498 --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java @@ -0,0 +1,21 @@ +package mcp.mobius.waila.api; + +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 */ + + /* BASIC TOOLS & ITEMS DATA */ + //EnumToolMaterial getMaterial(ItemStack stack); + //String getMaterialName(ItemStack stack); + //String getEffectiveBlock(ItemStack stack); + //int getHarvestLevel(ItemStack stack); + //float getEfficiencyOnProperMaterial(ItemStack stack); + //int getEnchantability(ItemStack stack); + //int getDamageVsEntity(ItemStack stack); + //int getDurability(ItemStack stack); + + LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/SpecialChars.java b/mechanical/api/java/mcp/mobius/waila/api/SpecialChars.java new file mode 100644 index 00000000..5bd92a82 --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/SpecialChars.java @@ -0,0 +1,40 @@ +package mcp.mobius.waila.api; + +public class SpecialChars { + + public static String MCStyle = "\u00A7"; + + public static String BLACK = MCStyle + "0"; + public static String DBLUE = MCStyle + "1"; + public static String DGREEN = MCStyle + "2"; + public static String DAQUA = MCStyle + "3"; + public static String DRED = MCStyle + "4"; + public static String DPURPLE = MCStyle + "5"; + public static String GOLD = MCStyle + "6"; + public static String GRAY = MCStyle + "7"; + public static String DGRAY = MCStyle + "8"; + public static String BLUE = MCStyle + "9"; + public static String GREEN = MCStyle + "a"; + public static String AQUA = MCStyle + "b"; + public static String RED = MCStyle + "c"; + public static String LPURPLE = MCStyle + "d"; + public static String YELLOW = MCStyle + "e"; + public static String WHITE = MCStyle + "f"; + + public static String OBF = MCStyle + "k"; + public static String BOLD = MCStyle + "l"; + public static String STRIKE = MCStyle + "m"; + public static String UNDER = MCStyle + "n"; + public static String ITALIC = MCStyle + "o"; + public static String RESET = MCStyle + "r"; + + public static String WailaStyle = "\u00A4"; + public static String WailaIcon = "\u00A5"; + 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"; + +} diff --git a/mechanical/api/java/mcp/mobius/waila/api/package-info.java b/mechanical/api/java/mcp/mobius/waila/api/package-info.java new file mode 100644 index 00000000..9b5e663b --- /dev/null +++ b/mechanical/api/java/mcp/mobius/waila/api/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="Waila",provides="WailaAPI") +package mcp.mobius.waila.api; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlock.java b/src/api/java/mcp/mobius/waila/api/IWailaBlock.java new file mode 100644 index 00000000..8b4dd131 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaBlock.java @@ -0,0 +1,34 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +@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 getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java new file mode 100644 index 00000000..935d475f --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java @@ -0,0 +1,9 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaBlockDecorator { + + void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); + +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java new file mode 100644 index 00000000..faede63f --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +import java.util.HashMap; +import java.util.Set; + +public interface IWailaConfigHandler { + /* Returns a set of all the currently loaded modules in the config handler */ + public Set getModuleNames(); + + /* Returns all the currently available options for a given module */ + public HashMap getConfigKeys(String modName); + + /* Add a new option to a given module + * + * 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*/ + public boolean getConfig(String key, boolean defvalue); + + /* Returns the current value of an option (true/false) with a default value true if not set*/ + public boolean getConfig(String key); + + //public void setConfig(String key, boolean value); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java new file mode 100644 index 00000000..5eade35f --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import net.minecraft.block.Block; +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.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). + */ + +public interface IWailaDataAccessor { + + World getWorld(); + EntityPlayer getPlayer(); + Block getBlock(); + int getBlockID(); + int getMetadata(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + ForgeDirection getSide(); + ItemStack getStack(); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java new file mode 100644 index 00000000..4859d9cd --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +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 + */ + 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 getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java new file mode 100644 index 00000000..788067af --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java @@ -0,0 +1,24 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +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). + */ + +public interface IWailaEntityAccessor { + World getWorld(); + EntityPlayer getPlayer(); + Entity getEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java new file mode 100644 index 00000000..9548289a --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java @@ -0,0 +1,16 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.entity.Entity; + +public interface IWailaEntityProvider { + + /* A way to get an override on the entity returned by the raytracing */ + Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); + + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java new file mode 100644 index 00000000..e30afc43 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +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.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). + */ + +public interface IWailaFMPAccessor { + World getWorld(); + EntityPlayer getPlayer(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + NBTTagCompound getNBTData(); + NBTTagCompound getFullNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + Vec3 getRenderingPosition(); + String getID(); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java new file mode 100644 index 00000000..839af31f --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java @@ -0,0 +1,7 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPDecorator { + void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java new file mode 100644 index 00000000..232c83ef --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java @@ -0,0 +1,12 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPProvider { + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java new file mode 100644 index 00000000..833f7715 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java @@ -0,0 +1,56 @@ +package mcp.mobius.waila.api; + +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 addConfigRemote(String modname, String keyname, String configtext); + public void addConfig(String modname, String keyname); + public void addConfigRemote(String modname, String keyname); + + /* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */ + @Deprecated + public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID); + @Deprecated + public void registerBodyProvider (IWailaDataProvider dataProvider, int blockID); + @Deprecated + public void registerTailProvider (IWailaDataProvider dataProvider, int blockID); + + /* Register a stack overrider for the given blockID */ + @Deprecated + public void registerStackProvider(IWailaDataProvider dataProvider, int blockID); + public void registerStackProvider(IWailaDataProvider dataProvider, Class block); + + /* Same thing, but works on a class hierarchy instead */ + public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); + public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); + public void registerTailProvider (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); + + /* FMP Providers */ + public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); + public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); + public void registerTailProvider(IWailaFMPProvider dataProvider, String name); + + /* The block decorators */ + @Deprecated + public void registerDecorator (IWailaBlockDecorator decorator, int blockID); + public void registerDecorator (IWailaBlockDecorator decorator, Class block); + public void registerDecorator (IWailaFMPDecorator decorator, String name); + + /* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent). + * Accept * as a ending wildcard + * registerNBTKey("bob.*", MyBlock.class) + * registerNBTKey("data.life", MyEntity.class) + * registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5 + * */ + public void registerSyncedNBTKey(String key, Class target); + + /* UNUSED FOR NOW (Will be used for the ingame wiki */ + public void registerDocTextFile (String filename); + public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java new file mode 100644 index 00000000..f7906498 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java @@ -0,0 +1,21 @@ +package mcp.mobius.waila.api; + +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 */ + + /* BASIC TOOLS & ITEMS DATA */ + //EnumToolMaterial getMaterial(ItemStack stack); + //String getMaterialName(ItemStack stack); + //String getEffectiveBlock(ItemStack stack); + //int getHarvestLevel(ItemStack stack); + //float getEfficiencyOnProperMaterial(ItemStack stack); + //int getEnchantability(ItemStack stack); + //int getDamageVsEntity(ItemStack stack); + //int getDurability(ItemStack stack); + + LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/SpecialChars.java b/src/api/java/mcp/mobius/waila/api/SpecialChars.java new file mode 100644 index 00000000..5bd92a82 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/SpecialChars.java @@ -0,0 +1,40 @@ +package mcp.mobius.waila.api; + +public class SpecialChars { + + public static String MCStyle = "\u00A7"; + + public static String BLACK = MCStyle + "0"; + public static String DBLUE = MCStyle + "1"; + public static String DGREEN = MCStyle + "2"; + public static String DAQUA = MCStyle + "3"; + public static String DRED = MCStyle + "4"; + public static String DPURPLE = MCStyle + "5"; + public static String GOLD = MCStyle + "6"; + public static String GRAY = MCStyle + "7"; + public static String DGRAY = MCStyle + "8"; + public static String BLUE = MCStyle + "9"; + public static String GREEN = MCStyle + "a"; + public static String AQUA = MCStyle + "b"; + public static String RED = MCStyle + "c"; + public static String LPURPLE = MCStyle + "d"; + public static String YELLOW = MCStyle + "e"; + public static String WHITE = MCStyle + "f"; + + public static String OBF = MCStyle + "k"; + public static String BOLD = MCStyle + "l"; + public static String STRIKE = MCStyle + "m"; + public static String UNDER = MCStyle + "n"; + public static String ITALIC = MCStyle + "o"; + public static String RESET = MCStyle + "r"; + + public static String WailaStyle = "\u00A4"; + public static String WailaIcon = "\u00A5"; + 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"; + +} diff --git a/src/api/java/mcp/mobius/waila/api/package-info.java b/src/api/java/mcp/mobius/waila/api/package-info.java new file mode 100644 index 00000000..9b5e663b --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="Waila",provides="WailaAPI") +package mcp.mobius.waila.api; +import cpw.mods.fml.common.API; \ No newline at end of file