diff options
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
47 files changed, 2794 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java b/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java new file mode 100644 index 0000000000..ad3aa3c908 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java @@ -0,0 +1,5 @@ +package gregtech.api.interfaces; + +public interface IColorModulationContainer { + public short[] getRGBA(); +} diff --git a/src/main/java/gregtech/api/interfaces/ICondition.java b/src/main/java/gregtech/api/interfaces/ICondition.java new file mode 100644 index 0000000000..9e31da7338 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/ICondition.java @@ -0,0 +1,104 @@ +package gregtech.api.interfaces; + +public interface ICondition<O> { + public boolean isTrue(O aObject); + + // Utility Classes for adding relations between Conditions. + + public static class Not<O> implements ICondition<O> { + private final ICondition<O> mCondition; + + public Not(ICondition<O> aCondition) { + mCondition = aCondition; + } + + @Override + public boolean isTrue(O aObject) { + return !mCondition.isTrue(aObject); + } + } + + public static class Or<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; + + public Or(ICondition<O>... aConditions) { + mConditions = aConditions; + } + + @Override + public boolean isTrue(O aObject) { + for (ICondition<O> tCondition : mConditions) if (tCondition.isTrue(aObject)) return true; + return false; + } + } + + public static class Nor<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; + + public Nor(ICondition<O>... aConditions) { + mConditions = aConditions; + } + + @Override + public boolean isTrue(O aObject) { + for (ICondition<O> tCondition : mConditions) if (tCondition.isTrue(aObject)) return false; + return true; + } + } + + public static class And<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; + + public And(ICondition<O>... aConditions) { + mConditions = aConditions; + } + + @Override + public boolean isTrue(O aObject) { + for (ICondition<O> tCondition : mConditions) if (!tCondition.isTrue(aObject)) return false; + return true; + } + } + + public static class Nand<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; + + public Nand(ICondition<O>... aConditions) { + mConditions = aConditions; + } + + @Override + public boolean isTrue(O aObject) { + for (ICondition<O> tCondition : mConditions) if (!tCondition.isTrue(aObject)) return true; + return false; + } + } + + public static class Xor<O> implements ICondition<O> { + private final ICondition<O> mCondition1, mCondition2; + + public Xor(ICondition<O> aCondition1, ICondition<O> aCondition2) { + mCondition1 = aCondition1; + mCondition2 = aCondition2; + } + + @Override + public boolean isTrue(O aObject) { + return mCondition1.isTrue(aObject) != mCondition2.isTrue(aObject); + } + } + + public static class Equal<O> implements ICondition<O> { + private final ICondition<O> mCondition1, mCondition2; + + public Equal(ICondition<O> aCondition1, ICondition<O> aCondition2) { + mCondition1 = aCondition1; + mCondition2 = aCondition2; + } + + @Override + public boolean isTrue(O aObject) { + return mCondition1.isTrue(aObject) == mCondition2.isTrue(aObject); + } + } +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IDamagableItem.java b/src/main/java/gregtech/api/interfaces/IDamagableItem.java new file mode 100644 index 0000000000..b7ebd6690d --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IDamagableItem.java @@ -0,0 +1,7 @@ +package gregtech.api.interfaces; + +import net.minecraft.item.ItemStack; + +public interface IDamagableItem { + public boolean doDamageToItem(ItemStack aStack, int aVanillaDamage); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java new file mode 100644 index 0000000000..bdb550ff53 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java @@ -0,0 +1,27 @@ +package gregtech.api.interfaces; + +import net.minecraft.entity.player.EntityPlayer; + +import java.util.ArrayList; + +/** + * You are allowed to include this File in your Download, as i will not change it. + */ +public interface IDebugableBlock { + /** + * Returns a Debug Message, for a generic DebugItem + * Blocks have to implement this interface NOT TileEntities! + * + * @param aPlayer the Player, who rightclicked with his Debug Item + * @param aX Block-Coordinate + * @param aY Block-Coordinate + * @param aZ Block-Coordinate + * @param aLogLevel the Log Level of the Debug Item. + * 0 = Obvious + * 1 = Visible for the regular Scanner + * 2 = Only visible to more advanced Scanners + * 3 = Debug ONLY + * @return a String-Array containing the DebugInfo, every Index is a separate line (0 = first Line) + */ + public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IDescribable.java b/src/main/java/gregtech/api/interfaces/IDescribable.java new file mode 100644 index 0000000000..d4bcf58de8 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IDescribable.java @@ -0,0 +1,11 @@ +package gregtech.api.interfaces; + +/** + * To get simple things like a ToolTip Description + */ +public interface IDescribable { + /** + * The Tooltip Text + */ + public String[] getDescription(); +} diff --git a/src/main/java/gregtech/api/interfaces/IFoodStat.java b/src/main/java/gregtech/api/interfaces/IFoodStat.java new file mode 100644 index 0000000000..b6773e9d65 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IFoodStat.java @@ -0,0 +1,35 @@ +package gregtech.api.interfaces; + +import gregtech.api.items.GT_MetaBase_Item; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; + +public interface IFoodStat { + /** + * Warning the "aPlayer" Parameter may be null! + */ + public int getFoodLevel(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + + /** + * Warning the "aPlayer" Parameter may be null! + */ + public float getSaturation(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + + /** + * Warning the "aPlayer" Parameter may be null! + */ + public boolean alwaysEdible(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + + /** + * Warning the "aPlayer" Parameter may be null! + */ + public boolean isRotten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + + /** + * Warning the "aPlayer" Parameter may be null! + */ + public EnumAction getFoodAction(GT_MetaBase_Item aItem, ItemStack aStack); + + public void onEaten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IIconContainer.java b/src/main/java/gregtech/api/interfaces/IIconContainer.java new file mode 100644 index 0000000000..c8b995e9a7 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IIconContainer.java @@ -0,0 +1,21 @@ +package gregtech.api.interfaces; + +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; + +public interface IIconContainer { + /** + * @return A regular Icon. + */ + public IIcon getIcon(); + + /** + * @return Icon of the Overlay (or null if there is no Icon) + */ + public IIcon getOverlayIcon(); + + /** + * @return the Default Texture File for this Icon. + */ + public ResourceLocation getTextureFile(); +} diff --git a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java new file mode 100644 index 0000000000..1d75f41e17 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java @@ -0,0 +1,40 @@ +package gregtech.api.interfaces; + +import gregtech.api.enums.SubTag; +import gregtech.api.items.GT_MetaBase_Item; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import java.util.List; + +public interface IItemBehaviour<E extends Item> { + public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); + + public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + + public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + + public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); + + public List<String> getAdditionalToolTips(E aItem, List<String> aList, ItemStack aStack); + + public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); + + public boolean isItemStackUsable(E aItem, ItemStack aStack); + + public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); + + public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); + + public boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack); + + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IItemContainer.java b/src/main/java/gregtech/api/interfaces/IItemContainer.java new file mode 100644 index 0000000000..3c1bd87543 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IItemContainer.java @@ -0,0 +1,39 @@ +package gregtech.api.interfaces; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public interface IItemContainer { + public Item getItem(); + + public Block getBlock(); + + public boolean isStackEqual(Object aStack); + + public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT); + + public ItemStack get(long aAmount, Object... aReplacements); + + public ItemStack getWildcard(long aAmount, Object... aReplacements); + + public ItemStack getUndamaged(long aAmount, Object... aReplacements); + + public ItemStack getAlmostBroken(long aAmount, Object... aReplacements); + + public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements); + + public IItemContainer set(Item aItem); + + public IItemContainer set(ItemStack aStack); + + public IItemContainer registerOre(Object... aOreNames); + + public IItemContainer registerWildcardAsOre(Object... aOreNames); + + public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements); + + public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements); + + public boolean hasBeenSet(); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java b/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java new file mode 100644 index 0000000000..1f0ec91bba --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java @@ -0,0 +1,16 @@ +package gregtech.api.interfaces; + +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraft.item.ItemStack; + +public interface IOreRecipeRegistrator { + /** + * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did before. + * + * @param aPrefix always != null + * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! + * @param aStack always != null + */ + public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IProjectileItem.java b/src/main/java/gregtech/api/interfaces/IProjectileItem.java new file mode 100644 index 0000000000..22211a6f0c --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IProjectileItem.java @@ -0,0 +1,24 @@ +package gregtech.api.interfaces; + +import gregtech.api.enums.SubTag; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IProjectileItem { + /** + * @return if this Item has an Arrow Entity + */ + public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack); + + /** + * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow + */ + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + + /** + * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow + */ + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java new file mode 100644 index 0000000000..8838992c62 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java @@ -0,0 +1,66 @@ +package gregtech.api.interfaces; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.util.GT_CoverBehavior; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; + +/** + * Implemented by the MetaTileEntity of the Redstone Circuit Block + */ +public interface IRedstoneCircuitBlock { + /** + * The Output Direction the Circuit Block is Facing + */ + public byte getOutputFacing(); + + /** + * sets Output Redstone State at Side + */ + public boolean setRedstone(byte aStrength, byte aSide); + + /** + * returns Output Redstone State at Side + * Note that setRedstone checks if there is a Difference between the old and the new Setting before consuming any Energy + */ + public byte getOutputRedstone(byte aSide); + + /** + * returns Input Redstone Signal at Side + */ + public byte getInputRedstone(byte aSide); + + /** + * If this Side is Covered up and therefor not doing any Redstone + */ + public GT_CoverBehavior getCover(byte aSide); + + public int getCoverID(byte aSide); + + public int getCoverVariable(byte aSide); + + /** + * returns whatever Block-ID is adjacent to the Redstone Circuit Block + */ + public Block getBlockAtSide(byte aSide); + + /** + * returns whatever Meta-Value is adjacent to the Redstone Circuit Block + */ + public byte getMetaIDAtSide(byte aSide); + + /** + * returns whatever TileEntity is adjacent to the Redstone Circuit Block + */ + public TileEntity getTileEntityAtSide(byte aSide); + + /** + * returns whatever TileEntity is used by the Redstone Circuit Block + */ + public ICoverable getOwnTileEntity(); + + /** + * returns worldObj.rand.nextInt(aRange) + */ + public int getRandom(int aRange); +} diff --git a/src/main/java/gregtech/api/interfaces/ISubTagContainer.java b/src/main/java/gregtech/api/interfaces/ISubTagContainer.java new file mode 100644 index 0000000000..c7ccc45e96 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/ISubTagContainer.java @@ -0,0 +1,20 @@ +package gregtech.api.interfaces; + +import gregtech.api.enums.SubTag; + +public interface ISubTagContainer { + /** + * @return if the Tag is inside the List. + */ + public boolean contains(SubTag aTag); + + /** + * @return The ISubTagContainer you called this Function on, for convenience. + */ + public ISubTagContainer add(SubTag... aTags); + + /** + * @return if the Tag was there before it has been removed. + */ + public boolean remove(SubTag aTag); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java new file mode 100644 index 0000000000..43efeac7c4 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/ITexture.java @@ -0,0 +1,20 @@ +package gregtech.api.interfaces; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; + +public interface ITexture { + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + + public boolean isValidTexture(); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IToolStats.java b/src/main/java/gregtech/api/interfaces/IToolStats.java new file mode 100644 index 0000000000..3c03bb8563 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IToolStats.java @@ -0,0 +1,159 @@ +package gregtech.api.interfaces; + +import gregtech.api.items.GT_MetaGenerated_Tool; +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraftforge.event.world.BlockEvent; + +import java.util.List; + +/** + * The Stats for GT Tools. Not including any Material Modifiers. + * <p/> + * And this is supposed to not have any ItemStack Parameters as these are generic Stats. + */ +public interface IToolStats { + /** + * Called when aPlayer crafts this Tool + */ + public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); |
