diff options
author | Dream-Master <dream-master@gmx.net> | 2016-06-21 18:50:29 +0200 |
---|---|---|
committer | Dream-Master <dream-master@gmx.net> | 2016-06-21 18:50:29 +0200 |
commit | 09add3e8ac3be54b1e6c068e87d4fb5143c6d785 (patch) | |
tree | 7b02b400788333f9ebf82081736c9c55f8ed48e8 /src/main/java/gregtech/api/interfaces | |
parent | b09b54435f9427332854558c42bd2c902825cbfe (diff) | |
download | GT5-Unofficial-09add3e8ac3be54b1e6c068e87d4fb5143c6d785.tar.gz GT5-Unofficial-09add3e8ac3be54b1e6c068e87d4fb5143c6d785.tar.bz2 GT5-Unofficial-09add3e8ac3be54b1e6c068e87d4fb5143c6d785.zip |
even with Blood asp experimental branch
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); + + /** + * Called when this gets added to a Tool Item + */ + public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID); + + /** + * @return Damage the Tool receives when breaking a Block. 100 is one Damage Point (or 100 EU). + */ + public int getToolDamagePerBlockBreak(); + + /** + * @return Damage the Tool receives when converting the drops of a Block. 100 is one Damage Point (or 100 EU). + */ + public int getToolDamagePerDropConversion(); + + /** + * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times more than normal. + */ + public int getToolDamagePerContainerCraft(); + + /** + * @return Damage the Tool receives when being used as Weapon, 200 is the normal Value, 100 for actual Weapons. + */ + public int getToolDamagePerEntityAttack(); + + /** + * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools of this Type. Decreasing is also possible. + */ + public int getBaseQuality(); + + /** + * @return The Damage Bonus for this Type of Tool against Mobs. 1.0F is normal punch. + */ + public float getBaseDamage(); + + /** + * @return This gets the Hurt Resistance time for Entities getting hit. (always does 1 as minimum) + */ + public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); + + /** + * @return This is a multiplier for the Tool Speed. 1.0F = no special Speed. + */ + public float getSpeedMultiplier(); + + /** + * @return This is a multiplier for the Tool Speed. 1.0F = no special Durability. + */ + public float getMaxDurabilityMultiplier(); + + public DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); + + public String getMiningSound(); + + public String getCraftingSound(); + + public String getEntityHitSound(); + + public String getBreakingSound(); + + public Enchantment[] getEnchantments(ItemStack aStack); + + public int[] getEnchantmentLevels(ItemStack aStack); + + /** + * @return If this Tool can be used for blocking Damage like a Sword. + */ + public boolean canBlock(); + + /** + * @return If this Tool can be used as an RC Crowbar. + */ + public boolean isCrowbar(); + + /** + * @return If this Tool can be used as an FR Grafter. + */ + public boolean isGrafter(); + + public boolean isChainsaw(); + /** + * @return If this Tool can be used as an BC Wrench. + */ + public boolean isWrench(); + + /** + * @return If this Tool can be used as Weapon i.e. if that is the main purpose. + */ + public boolean isWeapon(); + + /** + * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your Bow/Gun or something + */ + public boolean isRangedWeapon(); + + /** + * @return If this Tool can be used as Weapon i.e. if that is the main purpose. + */ + public boolean isMiningTool(); + + /** + * aBlock.getHarvestTool(aMetaData) can return the following Values for example. + * "axe", "pickaxe", "sword", "shovel", "hoe", "grafter", "saw", "wrench", "crowbar", "file", "hammer", "plow", "plunger", "scoop", "screwdriver", "sense", "scythe", "softhammer", "cutter", "plasmatorch" + * + * @return If this is a minable Block. Tool Quality checks (like Diamond Tier or something) are separate from this check. + */ + public boolean isMinableBlock(Block aBlock, byte aMetaData); + + /** + * This lets you modify the Drop List, when this type of Tool has been used. + * + * @return the Amount of modified Items. + */ + public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); + + /** + * @return Returns a broken Version of the Item. + */ + public ItemStack getBrokenItem(ItemStack aStack); + + /** + * @return the Damage actually done to the Mob. + */ + public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + + /** + * @return the Damage actually done to the Mob. + */ + public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java b/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java new file mode 100644 index 0000000000..7eee5ce98f --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java @@ -0,0 +1,8 @@ +package gregtech.api.interfaces.internal; + +/** + * A simple compound Interface for generic BuildCraft Code. + */ +public interface IBCTileEntity /*extends IPowerReceptor*/ { + // +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java new file mode 100644 index 0000000000..4c1aa49c05 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java @@ -0,0 +1,7 @@ +package gregtech.api.interfaces.internal; + +import net.minecraft.item.crafting.IRecipe; + +public interface IGT_CraftingRecipe extends IRecipe { + public boolean isRemovable(); +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java new file mode 100644 index 0000000000..945c988480 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java @@ -0,0 +1,46 @@ +package gregtech.api.interfaces.internal; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Interface used by the Mods Main Class to reference to internals. + * <p/> + * Don't even think about including this File in your Mod. + */ +public interface IGT_Mod { + /** + * This means that Server specific Basefiles are definitely existing! Not if the World is actually server side or not! + */ + public boolean isServerSide(); + + /** + * This means that Client specific Basefiles are definitely existing! Not if the World is actually client side or not! + */ + public boolean isClientSide(); + + /** + * This means that Bukkit specific Basefiles are definitely existing! Not if the World is actually bukkit server or not! + */ + public boolean isBukkitSide(); + + /** + * works only ClientSide otherwise returns null + */ + public EntityPlayer getThePlayer(); + + //---------- Internal Usage Only ---------- + + /** + * works only ClientSide otherwise returns 0 + * + * @return the Index of the added Armor + */ + public int addArmor(String aArmorPrefix); + + /** + * Plays the Sonictron Sound for the ItemStack on the Client Side + */ + public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java new file mode 100644 index 0000000000..92eb801a8e --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -0,0 +1,508 @@ +package gregtech.api.interfaces.internal; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public interface IGT_RecipeAdder { + /** + * Adds a FusionreactorRecipe + * Does not work anymore! + */ + @Deprecated + public boolean addFusionReactorRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + + /** + * Adds a FusionreactorRecipe + * + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param aOutput = Output of the Fusion (can be null, and respects StackSize) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aFusionEnergyPerTick = The EU generated per Tick (can even be negative!) + * @param aEnergyNeededForStartingFusion = EU needed for heating the Reactor up (must be >= 0) + * @return true if the Recipe got added, otherwise false. + */ + public boolean addFusionReactorRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + + /** + * Adds a Centrifuge Recipe + * + * @param aInput1 must be != null + * @param aCellInput this is for the needed Cells, > 0 for Tincellcount, < 0 for negative Fuelcancount, == 0 for nothing + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + * @param aDuration must be > 0 + */ + public boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration); + + /** + * Adds a Centrifuge Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + * @param aDuration must be > 0 + */ + public boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Electrolyzer Recipe + * + * @param aInput1 must be != null + * @param aCellInput this is for the needed Cells, > 0 for Tincellcount, < 0 for negative Fuelcancount, == 0 for nothing + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addElectrolyzerRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); + + /** + * Adds a Electrolyzer Recipe + * + * @param aInput1 must be != null + * @param aCellInput this is for the needed Cells, > 0 for Tincellcount, < 0 for negative Fuelcancount, == 0 for nothing + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addElectrolyzerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Chemical Recipe + * + * @param aInput1 must be != null + * @param aInput2 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + */ + public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int aDuration); + + /** + * Adds a Chemical Recipe + * + * @param aInput1 must be != null + * @param aInput2 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + */ + public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration); + + /** + * Adds a Chemical Recipe + * + * @param aInput1 must be != null + * @param aInput2 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUtick must be > 0 + */ + public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUtick); + + + /** + * Adds a Blast Furnace Recipe + * + * @param aInput1 must be != null + * @param aInput2 can be null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + * @param aLevel should be > 0 is the minimum Heat Level needed for this Recipe + */ + @Deprecated + public boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + + /** + * Adds a Blast Furnace Recipe + * + * @param aInput1 must be != null + * @param aInput2 can be null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + * @param aLevel should be > 0 is the minimum Heat Level needed for this Recipe + */ + public boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + + /** + * Adds a Canning Machine Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0, 100 ticks is standard. + * @param aEUt should be > 0, 1 EU/t is standard. + */ + public boolean addCannerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + + /** + * Adds an Alloy Smelter Recipe + * + * @param aInput1 must be != null + * @param aInput2 can be null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); + + public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden); + + + /** + * Adds a CNC-Machine Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addCNCRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + + /** + * Adds a Circuit Assembler Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); + + /** + * Adds a Circuit Assembler Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + + /** + * Adds a Assemblyline Recipe + * + * @param aInputs must be != null, 4-16 inputs + * @param aFluidInputs 0-4 fluids + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addAssemblylineRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + + /** + * Adds a Forge Hammer Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addForgeHammerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + + /** + * Adds a Wiremill Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addWiremillRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Polariser Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addPolarizerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Plate Bending Machine Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addBenderRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Extruder Machine Recipe + * + * @param aInput1 must be != null + * @param aShape must be != null, Set the stackSize to 0 if you don't want to let it consume this Item. + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Slicer Machine Recipe + * + * @param aInput1 must be != null + * @param aShape must be != null, Set the stackSize to 0 if you don't want to let it consume this Item. + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ + public boolean addSlicerRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds an Implosion Compressor Recipe + * + * @param aInput1 must be != null + * @param aInput2 amount of ITNT, should be > 0 + * @param aOutput1 must be != null + * @param aOutput2 can be null + */ + public boolean addImplosionRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2); + + /** + * Adds a Grinder Recipe + * + * @param aInput1 must be != null + * @param aInput2 id for the Cell needed for this Recipe + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + */ + public boolean addGrinderRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4); + + /** + * Adds a Distillation Tower Recipe + * + * @param aInput1 must be != null + * @param aOutputs must be != null 1-5 Fluids + * @param aOutput2 can be null + */ + public boolean addDistillationTowerRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + + + public boolean addSimpleArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + + public boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + + public boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, FluidStack aFluidPutput, int[] aChances, int aDuration, int aEUt); + + + /** + * Adds a Distillation Tower Recipe + */ + public boolean addDistillationRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aDuration, int aEUt); + + /** + * Adds a Lathe Machine Recipe + */ + public boolean addLatheRecipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + + /** + * Adds a Cutter Recipe + */ + public boolean addCutterRecipe(ItemStack aInput, FluidStack aLubricant, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + + /** + * Adds Cutter Recipes with default Lubricants + */ + public boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + + /** + * Adds a Boxing Recipe + */ + public boolean addBoxingRecipe(ItemStack aContainedItem, ItemStack aEmptyBox, ItemStack aFullBox, int aDuration, int aEUt); + + /** + * Adds an Unboxing Recipe + */ + public boolean addUnboxingRecipe(ItemStack aFullBox, ItemStack aContainedItem, ItemStack aEmptyBox, int aDuration, int aEUt); + + /** + * Adds a Vacuum Freezer Recipe + * + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + */ + public boolean addVacuumFreezerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration); + + /** + * Adds a Fuel for My Generators + * + * @param aInput1 must be != null + * @param aOutput1 can be null + * @param aEU EU per MilliBucket. If no Liquid Form of this Container is available, then it will give you EU*1000 per Item. + * @param aType 0 = Diesel; 1 = Gas Turbine; 2 = Thermal; 3 = Dense Fluid; 4 = Plasma; 5 = Magic; And if something is unclear or missing, then look at the GT_Recipe-Class + */ + public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); + + /** + * Adds an Amplifier Recipe for the Amplifabricator + */ + public boolean addAmplifier(ItemStack aAmplifierItem, int aDuration, int aAmplifierAmountOutputted); + + /** + * Adds a Recipe for the Brewing Machine (intentionally limited to Fluid IDs) + */ + public boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, boolean aHidden); + + /** + * Adds a Recipe for the Fermenter + */ + public boolean addFermentingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, boolean aHidden); + + /** + * Adds a Recipe for the Fluid Heater + */ + public boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Distillery + */ + public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + + /** + * Adds a Recipe for the Fluid Solidifier + */ + public boolean addFluidSolidifierRecipe(ItemStack aMold, FluidStack aInput, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Recipe for Fluid Smelting + */ + public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); + + /** + * Adds a Recipe for Fluid Smelting + */ + public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt, boolean hidden); + + /** + * Adds a Recipe for Fluid Extraction + */ + public boolean addFluidExtractionRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Fluid Canner + */ + public boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput); + + /** + * Adds a Recipe for the Chemical Bath + */ + public boolean addChemicalBathRecipe(ItemStack aInput, FluidStack aBathingFluid, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Electromagnetic Separator + */ + public boolean addElectromagneticSeparatorRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Printer + */ + public boolean addPrinterRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aSpecialSlot, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Autoclave + */ + public boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Mixer + */ + public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Laser Engraver + */ + public boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Forming Press + */ + public boolean addFormingPressRecipe(ItemStack aItemToImprint, ItemStack aForm, ItemStack aImprintedItem, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Sifter. (up to 9 Outputs) + */ + public boolean addSifterRecipe(ItemStack aItemToSift, ItemStack[] aSiftedItems, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Arc Furnace. (up to 4 Outputs) + */ + public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Recipe for the Arc Furnace. (up to 4 Outputs) + */ + public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); + + + /** + * Adds a Recipe for the GT Pulveriser. (up to 4 Outputs) + */ + public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + + /** + * Adds a Recipe for the GT Pulveriser. (up to 4 Outputs) + */ + public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); + + /** + * Adds a Distillation Tower Recipe + * Every Fluid also gets seperate distillation recipes + * + * @param aInput1 must be != null + * @param aOutputs must be != null 1-5 Fluids + * @param aOutput2 can be null + */ + public boolean addUniversalDistillationRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + + /** + * Adds Pyrolyse Recipe + * + * @param aInput + * @param intCircuit + * @param aOutput + * @param aFluidOutput + * @param aDuration + * @param aEUt + */ + public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt); + + /** + * Adds Oil Cracking Recipe + * + * @param aInput + * @param aOutput + * @param aDuration + * @param aEUt + */ + public boolean addCrackingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); + + /** + * Adds a Sound to the Sonictron9001 + * you should NOT call this in the preInit-Phase! + * + * @param aItemStack = The Item you want to display for this Sound + * @param aSoundName = The Name of the Sound in the resources/newsound-folder like Vanillasounds + * @return true if the Sound got added, otherwise false. + */ + public boolean addSonictronSound(ItemStack aItemStack, String aSoundName); +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java b/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java new file mode 100644 index 0000000000..05208d36a4 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java @@ -0,0 +1,13 @@ +package gregtech.api.interfaces.internal; + +import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.tile.IEnergyStorage; + +/** + * A simple compound Interface for generic EnergyTileEntities. I don't want to have imports of the IC2-API in my main-code + */ +public interface IIC2TileEntity extends IEnergyStorage, IEnergySink, IEnergySource, IHasWorldObjectAndCoords { + // +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java new file mode 100644 index 0000000000..2c1f930835 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java @@ -0,0 +1,30 @@ +package gregtech.api.interfaces.internal; + +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +import java.util.List; + +public interface IThaumcraftCompat { + public static final int RESEARCH_TYPE_NORMAL = 0, RESEARCH_TYPE_SECONDARY = 1, RESEARCH_TYPE_FREE = 2, RESEARCH_TYPE_HIDDEN = 4, RESEARCH_TYPE_VIRTUAL = 8, RESEARCH_TYPE_ROUND = 16, RESEARCH_TYPE_SPECIAL = 32, RESEARCH_TYPE_AUTOUNLOCK = 64; + + /** + * The Research Keys of GT + */ + public static final String + IRON_TO_STEEL = "GT_IRON_TO_STEEL", FILL_WATER_BUCKET = "GT_FILL_WATER_BUCKET", WOOD_TO_CHARCOAL = "GT_WOOD_TO_CHARCOAL", TRANSZINC = "GT_TRANSZINC", TRANSNICKEL = "GT_TRANSNICKEL", TRANSCOBALT = "GT_TRANSCOBALT", TRANSBISMUTH = "GT_TRANSBISMUTH", TRANSANTIMONY = "GT_TRANSANTIMONY", TRANSCUPRONICKEL = "GT_TRANSCUPRONICKEL", TRANSBATTERYALLOY = "GT_TRANSBATTERYALLOY", TRANSSOLDERINGALLOY = "GT_TRANSSOLDERINGALLOY", TRANSBRASS = "GT_TRANSBRASS", TRANSBRONZE = "GT_TRANSBRONZE", TRANSINVAR = "GT_TRANSINVAR", TRANSELECTRUM = "GT_TRANSELECTRUM", TRANSALUMINIUM = "GT_TRANSALUMINIUM", CRYSTALLISATION = "GT_CRYSTALLISATION", ADVANCEDENTROPICPROCESSING = "GT_ADVANCEDENTROPICPROCESSING", ADVANCEDMETALLURGY = "GT_ADVANCEDMETALLURGY"; + + public boolean registerPortholeBlacklistedBlock(Block aBlock); + + public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List<TC_AspectStack> aAspects, boolean aAdditive); + + public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List<TC_AspectStack> aAspects, String aOreDict); + + public Object addCrucibleRecipe(String aResearch, Object aInput, ItemStack aOutput, List<TC_AspectStack> aAspects); + + public Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput, int aInstability, List<TC_Aspects.TC_AspectStack> aAspects); + + public Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, List<TC_AspectStack> aAspects, ItemStack[] aResearchTriggers, Object[] aPages); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java b/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java new file mode 100644 index 0000000000..d183961a0d --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java @@ -0,0 +1,6 @@ +package gregtech.api.interfaces.internal; + + +public interface IUETileEntity /*extends IElectrical*/ { + // +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java new file mode 100644 index 0000000000..64c5072c39 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -0,0 +1,393 @@ +package gregtech.api.interfaces.metatileentity; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_Config; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.IFluidTank; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes, Transformers, but not the regular Blocks) + * <p/> + * Don't implement this yourself and expect it to work. Extend @MetaTileEntity itself. + */ +public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity { + /** + * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. + * <p/> + * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantle + * 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle + * 2 = BaseMetaTileEntity, Wrench lvl 2 to dismantle + * 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle + * 4 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle + * 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle + * 6 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle + * 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle + * 8 = BaseMetaPipeEntity, Cutter lvl 0 to dismantle + * 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle + * 10 = BaseMetaPipeEntity, Cutter lvl 2 to dismantle + * 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle + * 12 = BaseMetaPipeEntity, Axe lvl 0 to dismantle + * 13 = BaseMetaPipeEntity, Axe lvl 1 to dismantle + * 14 = BaseMetaPipeEntity, Axe lvl 2 to dismantle + * 15 = BaseMetaPipeEntity, Axe lvl 3 to dismantle + */ + public byte getTileEntityBaseType(); + + /** + * @param aTileEntity is just because the internal Variable "mBaseMetaTileEntity" is set after this Call. + * @return a newly created and ready MetaTileEntity + */ + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); + + /** + * @return an ItemStack representing this MetaTileEntity. + */ + public ItemStack getStackForm(long aAmount); + + /** + * new getter for the BaseMetaTileEntity, which restricts usage to certain Functions. + */ + public IGregTechTileEntity getBaseMetaTileEntity(); + + /** + * Sets the BaseMetaTileEntity of this + */ + public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity); + + /** + * when placing a Machine in World, to initialize default Modes. aNBT can be null! + */ + public void initDefaultModes(NBTTagCompound aNBT); + + /** + * ^= writeToNBT + */ + public void saveNBTData(NBTTagCompound aNBT); + + /** + * ^= readFromNBT + */ + public void loadNBTData(NBTTagCompound aNBT); + + /** + * Adds the NBT-Information to the ItemStack, when being dismanteled properly + * Used to store Machine specific Upgrade Data. + */ + public void setItemNBT(NBTTagCompound aNBT); + + /** + * Called in the registered MetaTileEntity when the Server starts, to reset static variables + */ + public void onServerStart(); + + /** + * Called in the registered MetaTileEntity when the Server ticks a World the first time, to load things from the World Save + */ + public void onWorldLoad(File aSaveDirectory); + + /** + * Called in the registered MetaTileEntity when the Server stops, to save the Game. + */ + public void onWorldSave(File aSaveDirectory); + + /** + * Called to set Configuration values for this MetaTileEntity. + * Use aConfig.get(ConfigCategories.machineconfig, "MetaTileEntityName.Ability", DEFAULT_VALUE); to set the Values. + */ + public void onConfigLoad(GT_Config aConfig); + + /** + * If a Cover of that Type can be placed on this Side. + * Also Called when the Facing of the Block Changes and a Cover is on said Side. + */ + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack); + + /** + * When a Player rightclicks the Facing with a Screwdriver. + */ + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + + /** + * When a Player rightclicks the Facing with a Wrench. + */ + public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + + /** + * Called right before this Machine explodes + */ + public void onExplosion(); + + /** + * The First processed Tick which was passed to this MetaTileEntity + */ + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity); + + /** + * The Tick before all the generic handling happens, what gives a slightly faster reaction speed. + * Don't use this if you really don't need to. @onPostTick is better suited for ticks. + * This happens still after the Cover handling. + */ + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); + + /** + * The Tick after all the generic handling happened. + * Recommended to use this like updateEntity. + */ + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); + + /** + * Called when this MetaTileEntity gets (intentionally) disconnected from the BaseMetaTileEntity. + * Doesn't get called when this thing is moved by Frames or similar hacks. + */ + public void inValidate(); + + /** + * Called when the BaseMetaTileEntity gets invalidated, what happens right before the @inValidate above gets called + */ + public void onRemoval(); + + /** + * @param aFacing + * @return if aFacing would be a valid Facing for this Device. Used for wrenching. + */ + public boolean isFacingValid(byte aFacing); + + /** + * @return the Server Side Container + */ + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity); + + /** + * @return the Client Side GUI Container + */ + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity); + + /** + * From new ISidedInventory + */ + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); + + /** + * From new ISidedInventory + */ + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); + + /** + * @return if aIndex is a valid Slot. false for things like HoloSlots. Is used for determining if an Item is dropped upon Block destruction and for Inventory Access Management + */ + public boolean isValidSlot(int aIndex); + + /** + * @return if aIndex can be set to Zero stackSize, when being removed. + */ + public boolean setStackToZeroInsteadOfNull(int aIndex); + + /** + * If this Side can connect to inputting pipes + */ + public boolean isLiquidInput(byte aSide); + + /** + * If this Side can connect to outputting pipes + */ + public boolean isLiquidOutput(byte aSide); + + /** + * Just an Accessor for the Name variable. + */ + public String getMetaName(); + + /** + * @return true if the Machine can be accessed + */ + public boolean isAccessAllowed(EntityPlayer aPlayer); + + /** + * When a Machine Update occurs + */ + public void onMachineBlockUpdate(); + + /** + * a Player rightclicks the Machine + * Sneaky rightclicks are not getting passed to this! + * + * @return + */ + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); + + /** + * a Player leftclicks the Machine + * Sneaky leftclicks are getting passed to this unlike with the rightclicks. + */ + public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer); + + /** + * Called Clientside with the Data got from @getUpdateData + */ + public void onValueUpdate(byte aValue); + + /** + * return a small bit of Data, like a secondary Facing for example with this Function, for the Client. + * The BaseMetaTileEntity detects changes to this Value and will then send an Update. + * This is only for Information, which is visible as Texture to the outside. + * <p/> + * If you just want to have an Active/Redstone State then set the Active State inside the BaseMetaTileEntity instead. + */ + public byte getUpdateData(); + + /** + * For the rare case you need this Function + */ + public void receiveClientEvent(byte aEventID, byte aValue); + + /** + * Called to actually play the Sound. + * Do not insert Client/Server checks. That is already done for you. + * Do not use @playSoundEffect, Minecraft doesn't like that at all. Use @playSound instead. + */ + public void doSound(byte aIndex, double aX, double aY, double aZ); + + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ); + + public void stopSoundLoop(byte aValue, double aX, double aY, double aZ); + + /** + * Sends the Event for the Sound Triggers, only usable Server Side! + */ + public void sendSound(byte aIndex); + + /** + * Sends the Event for the Sound Triggers, only usable Server Side! + */ + public void sendLoopStart(byte aIndex); + + /** + * Sends the Event for the Sound Triggers, only usable Server Side! + */ + public void sendLoopEnd(byte aIndex); + + /** + * Called when the Machine explodes, override Explosion Code here. + * + * @param aExplosionPower + */ + public void doExplosion(long aExplosionPower); + + /** + * If this is just a simple Machine, which can be wrenched at 100% + */ + public boolean isSimpleMachine(); + + /** + * If there should be a Lag Warning if something laggy happens during this Tick. + * <p/> + * The Advanced Pump uses this to not cause the Lag Message, while it scans for all close Fluids. + * The Item Pipes and Retrievers neither send this Message, when scanning for Pipes. + */ + public boolean doTickProfilingMessageDuringThisTick(); + + /** + * returns the DebugLog + */ + public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList); + + /** + * get a small Description + */ + public String[] getDescription(); + + /** + * In case the Output Voltage varies. + */ + public String getSpecialVoltageToolTip(); + + /** + * Icon of the Texture. If this returns null then it falls back to getTextureIndex. + * + * @param aSide is the Side of the Block + * @param aFacing is the direction the Block is facing (or a Bitmask of all Connections in case of Pipes) + * @param aColorIndex The Minecraft Color the Block is having + * @param aActive if the Machine is currently active (use this instead of calling mBaseMetaTileEntity.mActive!!!). Note: In case of Pipes this means if this Side is connected to something or not. + * @param aRedstone if the Machine is currently outputting a RedstoneSignal (use this instead of calling mBaseMetaTileEntity.mRedstone!!!) + */ + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone); + + /** + * The Textures used for the Item rendering. Return null if you want the regular 3D Block Rendering. + */ + //public ITexture[] getItemTexture(ItemStack aStack); + + /** + * Register Icons here. This gets called when the Icons get initialized by the Base Block + * Best is you put your Icons in a static Array for quick and easy access without relying on the MetaTileList. + * + * @param aBlockIconRegister The Block Icon Register + */ + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister); + + /** + * @return true if you override the Rendering. + */ + @SideOnly(Side.CLIENT) + public boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer); + + /** + * @return true if you override the Rendering. + */ + @SideOnly(Side.CLIENT) + public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer); + + /** + * Gets the Output for the comparator on the given Side + */ + public byte getComparatorValue(byte aSide); + + public float getExplosionResistance(byte aSide); + + public String[] getInfoData(); + + public boolean isGivingInformation(); + + public ItemStack[] getRealInventory(); + + public boolean connectsToItemPipe(byte aSide); + + public void onColorChangeServer(byte aColor); + + public void onColorChangeClient(byte aColor); + + public int getLightOpacity(); + + public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); + + public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); + + /** + * The onCreated Function of the Item Class redirects here + */ + public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java new file mode 100644 index 0000000000..17fca8a65f --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java @@ -0,0 +1,9 @@ +package gregtech.api.interfaces.metatileentity; + +import net.minecraft.tileentity.TileEntity; + +import java.util.ArrayList; + +public interface IMetaTileEntityCable extends IMetaTileEntity { + public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java new file mode 100644 index 0000000000..510f314d8c --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -0,0 +1,99 @@ +package gregtech.api.interfaces.metatileentity; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.util.GT_Utility; + +import java.util.Map; + +public interface IMetaTileEntityItemPipe extends IMetaTileEntity { + /** + * @return if this Pipe can still be used. + */ + public boolean pipeCapacityCheck(); + + /** + * @return if this Pipe can still be used. + */ + public boolean incrementTransferCounter(int aIncrement); + + /** + * Sends an ItemStack from aSender to the adjacent Blocks. + * + * @param aSender the BaseMetaTileEntity sending the Stack. + * @return if it was able to send something + */ + public boolean sendItemStack(Object aSender); + + /** + * Executes the Sending Code for inserting Stacks into the TileEntities. + * + * @param aSender the BaseMetaTileEntity sending the Stack. + * @param aSide the Side of the PIPE facing the TileEntity. + * @return if this Side was allowed to Output into the Block. + */ + public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide); + + /** + * Can be used to make flow control Pipes, like Redpowers Restriction Tubes. + * Every normal Pipe returns a Value of 32768, so you can easily insert lower Numbers to set Routing priorities. + * Negative Numbers to "suck" Items into a certain direction are also possible. + */ + public int getStepSize(); + + /** + * Utility for the Item Network + */ + public static class Util { + /** + * @return a List of connected Item Pipes + */ + public static Map<IMetaTileEntityItemPipe, Long> scanPipes(IMetaTileEntityItemPipe aMetaTileEntity, Map<IMetaTileEntityItemPipe, Long> aMap, long aStep, boolean aSuckItems, boolean aIgnoreCapacity) { + aStep += aMetaTileEntity.getStepSize(); + if (aIgnoreCapacity || aMetaTileEntity.pipeCapacityCheck()) + if (aMap.get(aMetaTileEntity) == null || aMap.get(aMetaTileEntity) > aStep) { + IGregTechTileEntity aBaseMetaTileEntity = aMetaTileEntity.getBaseMetaTileEntity(); + aMap.put(aMetaTileEntity, aStep); + for (byte i = 0, j = 0; i < 6; i++) { + j = GT_Utility.getOppositeSide(i); + if (aSuckItems) { + if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsItemsIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), -2, aBaseMetaTileEntity)) { + IGregTechTileEntity tItemPipe = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(i); + if (aBaseMetaTileEntity.getColorization() >= 0) { + byte tColor = tItemPipe.getColorization(); + if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) { + continue; + } + } + if (tItemPipe != null && tItemPipe instanceof BaseMetaPipeEntity) { + IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); + if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { + scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); + } + } + } + } else { + if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsItemsOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), -2, aBaseMetaTileEntity)) { + IGregTechTileEntity tItemPipe = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(i); + if (tItemPipe != null) { + if (aBaseMetaTileEntity.getColorization() >= 0) { + byte tColor = tItemPipe.getColorization(); + if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) { + continue; + } + } + if (tItemPipe instanceof BaseMetaPipeEntity) { + IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); + if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { + scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); + } + } + } + } + } + } + } + return aMap; + } + } +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java new file mode 100644 index 0000000000..423b3d4379 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java @@ -0,0 +1,100 @@ +package gregtech.api.interfaces.tileentity; + +/** + * Interface for internal Code, which is mainly used for independent Energy conversion. + */ +public interface IBasicEnergyContainer extends IEnergyConnected { + /** + * Gets if that Amount of Energy is stored inside the Machine. + * It is used for checking the contained Energy before consuming it. + * If this returns false, it will also give a Message inside the Scanner, that this Machine doesn't have enough Energy. + */ + public boolean isUniversalEnergyStored(long aEnergyAmount); + + /** + * Gets the stored electric, kinetic or steam Energy (with EU as reference Value) + * Always returns the largest one. + */ + public long getUniversalEnergyStored(); + + /** + * Gets the largest electric, kinetic or steam Energy Capacity (with EU as reference Value) + */ + public long getUniversalEnergyCapacity(); + + /** + * Gets the amount of Energy Packets per tick. + */ + public long getOutputAmperage(); + + /** + * Gets the Output in EU/p. + */ + public long getOutputVoltage(); + + /** + * Gets the amount of Energy Packets per tick. + */ + public long getInputAmperage(); + + /** + * Gets the maximum Input in EU/p. + */ + public long getInputVoltage(); + + /** + * Decreases the Amount of stored universal Energy. If ignoring too less Energy, then it just sets the Energy to 0 and returns false. + */ + public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy); + + /** + * Increases the Amount of stored electric Energy. If ignoring too much Energy, then the Energy Limit is just being ignored. + */ + public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy); + + /** + * Drain Energy Call for Electricity. + */ + public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage); + + /** + * returns the amount of Electricity, accepted by this Block the last 5 ticks as Average. + */ + public long getAverageElectricInput(); + + /** + * returns the amount of Electricity, outputted by this Block the last 5 ticks as Average. + */ + public long getAverageElectricOutput(); + + /** + * returns the amount of electricity contained in this Block, in EU units! + */ + public long getStoredEU(); + + /** + * returns the amount of electricity containable in this Block, in EU units! + */ + public long getEUCapacity(); + + /** + * returns the amount of Steam contained in this Block, in EU units! + */ + public long getStoredSteam(); + + /** + * returns the amount of Steam containable in this Block, in EU units! + */ + public long getSteamCapacity(); + + /** + * Increases stored Energy. Energy Base Value is in EU, even though it's Steam! + * + * @param aEnergy The Energy to add to the Machine. + * @param aIgnoreTooMuchEnergy if it shall ignore if it has too much Energy. + * @return if it was successful + * <p/> + * And yes, you can't directly decrease the Steam of a Machine. That is done by decreaseStoredEnergyUnits + */ + public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java new file mode 100644 index 0000000000..6b69911ad2 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java @@ -0,0 +1,15 @@ +package gregtech.api.interfaces.tileentity; + +public interface IColoredTileEntity { + /** + * @return 0 - 15 are Colors, while -1 means uncolored + */ + public byte getColorization(); + + /** + * Sets the Color Modulation of the Block + * + * @param aColor the Color you want to set it to. -1 for reset. + */ + public byte setColorization(byte aColor); +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java new file mode 100644 index 0000000000..99ec88c149 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java @@ -0,0 +1,44 @@ +package gregtech.api.interfaces.tileentity; + +import gregtech.api.util.GT_CoverBehavior; +import net.minecraft.item.ItemStack; + +public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEnergyContainer { + public boolean canPlaceCoverIDAtSide(byte aSide, int aID); + + public boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover); + + public boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced); + + public void setCoverDataAtSide(byte aSide, int aData); + + public void setCoverIDAtSide(byte aSide, int aID); + + public void setCoverItemAtSide(byte aSide, ItemStack aCover); + + public int getCoverDataAtSide(byte aSide); + + public int getCoverIDAtSide(byte aSide); + + public ItemStack getCoverItemAtSide(byte aSide); + + public GT_CoverBehavior getCoverBehaviorAtSide(byte aSide); + + /** + * For use by the regular MetaTileEntities. Returns the Cover Manipulated input Redstone. + * Don't use this if you are a Cover Behavior. Only for MetaTileEntities. + */ + public byte getInternalInputRedstoneSignal(byte aSide); + + /** + * For use by the regular MetaTileEntities. This makes it not conflict with Cover based Redstone Signals. + * Don't use this if you are a Cover Behavior. Only for MetaTileEntities. + */ + public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength); + + /** + * Causes a general Cover Texture update. + * Sends 6 Integers to Client + causes @issueTextureUpdate() + */ + public void issueCoverUpdate(byte aSide); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java new file mode 100644 index 0000000000..8f55b75fcf --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java @@ -0,0 +1,31 @@ +package gregtech.api.interfaces.tileentity; + +import net.minecraft.item.ItemStack; + +/** + * You are allowed to include this File in your Download, as i will not change it. + */ +public interface IDigitalChest extends IHasWorldObjectAndCoords { + /** + * Is this even a TileEntity of a Digital Chest? + * I need things like this Function for MetaTileEntities, you MUST check this!!! + * Do not assume that it's a Digital Chest or similar Device, when it just implements this Interface. + */ + public boolean isDigitalChest(); + + /** + * Gives an Array of Stacks with Size (of all the Data-stored Items) of the correspondent Item kinds (regular QChests have only one) + * Does NOT include the 64 "ready" Items inside the Slots, and neither the 128 Items in the overflow Buffer. + */ + public ItemStack[] getStoredItemData(); + + /** + * A generic Interface for just setting the amount of contained Items + */ + public void setItemCount(int aCount); + + /** + * Gets the maximum Item count for this QChest alike Storage. This applies to the Data-Storage, not for the up to 192 buffered Items! + */ + public int getMaxItemCount(); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java new file mode 100644 index 0000000000..2384678529 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java @@ -0,0 +1,40 @@ +package gregtech.api.interfaces.tileentity; + +import gregtech.api.enums.Materials; + +/** + * Informative Class for Cables. Not used for now. + * <p/> + * Not all Data might be reliable. This is just for Information sake. + */ +public interface IEnergyConductor extends IEnergyConnected { + /** + * @return if this is actually a Cable. (you must check this) + */ + public boolean isConductor(); + + /** + * @return the maximum Voltage of the Cable. + */ + public long getMaxVoltage(); + + /** + * @return the maximum Amperage of the Cable, per Wire. + */ + public long getMaxAmperage(); + + /** + * @return the Loss of the Cable, per Meter. + */ + public long getLossPerMeter(); + + /** + * @return the Material the Cable consists of. (may return Materials._NULL) + */ + public Materials getCableMaterial(); + + /** + * @return the Material the Cable Insulation consists of. (may return Materials._NULL) + */ + public Materials getInsulationMaterial(); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java new file mode 100644 index 0000000000..b62ed4500b --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -0,0 +1,96 @@ +package gregtech.api.interfaces.tileentity; + +import cofh.api.energy.IEnergyReceiver; +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_Utility; +import ic2.api.energy.tile.IEnergySink; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Interface for getting Connected to the GregTech Energy Network. + * <p/> + * This is all you need to connect to the GT Network. + * IColoredTileEntity is needed for not connecting differently coloured Blocks to each other. + * IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does implement most of that Interface. + */ +public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAndCoords { + /** + * Inject Energy Call for Electricity. Gets called by EnergyEmitters to inject Energy into your Block + * <p/> + * Note: you have to check for @inputEnergyFrom because the Network won't check for that by itself. + * + * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do Side checks for this Side) + * @return amount of used Amperes. 0 if not accepted anything. + */ + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage); + + /** + * Sided Energy Input + */ + public boolean inputEnergyFrom(byte aSide); + + /** + * Sided Energy Output + */ + public boolean outputsEnergyTo(byte aSide); + + /** + * Utility for the Network + */ + public static class Util { + /** + * Emits Energy to the E-net. Also compatible with adjacent IC2 TileEntities. + * + * @return the used Amperage. + */ + public static final long emitEnergyToNetwork(long aVoltage, long aAmperage, IEnergyConnected aEmitter) { + long rUsedAmperes = 0; + for (byte i = 0, j = 0; i < 6 && aAmperage > rUsedAmperes; i++) + if (aEmitter.outputsEnergyTo(i)) { + j = GT_Utility.getOppositeSide(i); + TileEntity tTileEntity = aEmitter.getTileEntityAtSide(i); + if (tTileEntity instanceof IEnergyConnected) { + if (aEmitter.getColorization() >= 0) { + byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); + if (tColor >= 0 && tColor != aEmitter.getColorization()) continue; + } + rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(j, aVoltage, aAmperage - rUsedAmperes); +// } else if (tTileEntity instanceof IEnergySink) { +// if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aEmitter, ForgeDirection.getOrientation(j))) { +// while (aAmperage > rUsedAmperes && ((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(ForgeDirection.getOrientation(j), aVoltage) < aVoltage) rUsedAmperes++; +// } + } else if (tTileEntity instanceof IEnergySink) { + if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aEmitter, ForgeDirection.getOrientation(j))) { + while (aAmperage > rUsedAmperes && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(ForgeDirection.getOrientation(j), aVoltage, aVoltage) < aVoltage) + rUsedAmperes++; + } + } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { + ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100); + if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) { + ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); + rUsedAmperes++; + } + if (GregTech_API.mRFExplosions && GregTech_API.sMachineExplosions && ((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600) { + if (rfOut > 32 * GregTech_API.mEUtoRF / 100) { + int aExplosionPower = rfOut; + float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; + int tX = tTileEntity.xCoord, tY = tTileEntity.yCoord, tZ = tTileEntity.zCoord; + World tWorld = tTileEntity.getWorldObj(); + GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); + tWorld.setBlock(tX, tY, tZ, Blocks.air); + if (GregTech_API.sMachineExplosions) + tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); + } + } + } + } + return rUsedAmperes; + } + } +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java new file mode 100644 index 0000000000..7e86701f6b --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java @@ -0,0 +1,93 @@ +package gregtech.api.interfaces.tileentity; + +import cofh.api.energy.IEnergyReceiver; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_Utility; +import ic2.api.energy.tile.IEnergySink; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * THIS IS GOING TO BE USED IN 1.8 + * <p/> + * Interface for getting Connected to the GregTech Energy Network. + * <p/> + * This is all you need to connect to the GT Network. + * IColoredTileEntity is needed for not connecting differently coloured Blocks to each other. + * IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does implement most of that Interface. + */ +public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasWorldObjectAndCoords { + /** + * Inject Energy Call for Electricity. Gets called by EnergyEmitters to inject Energy into your Block + * <p/> + * Note: you have to check for @inputEnergyFrom because the Network won't check for that by itself. + * + * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do Side checks for this Side) + * @return amount of used Amperes. 0 if not accepted anything. + */ + public long injectEnergy(SubTag aEnergyType, byte aSide, long aPrimary, long aSecondary); + + /** + * Sided Energy Input + */ + public boolean inputEnergyFrom(SubTag aEnergyType, byte aSide); + + /** + * Sided Energy Output + */ + public boolean outputsEnergyTo(SubTag aEnergyType, byte aSide); + + /** + * Utility for the Network + */ + public static class Util { + public static int RF_PER_EU = 4; + private static boolean RF_ENERGY = false, IC_ENERGY = false, CHECK_ALL = true; + + private static void checkAvailabilities() { + if (CHECK_ALL) { + try { + Class tClass = cofh.api.energy.IEnergyReceiver.class; + tClass.getCanonicalName(); + RF_ENERGY = true; + } catch (Throwable e) {/**/} + try { + Class tClass = ic2.api.energy.tile.IEnergySink.class; + tClass.getCanonicalName(); + IC_ENERGY = true; + } catch (Throwable e) {/**/} + CHECK_ALL = false; + } + } + + /** + * Emits Energy to the adjacent Blocks. Also compatible with adjacent IC2 TileEntities when electric and RF TileEntities when RedstoneFlux. + * + * @return the amount of used secondary value. + */ + public static final long emitEnergyToNetwork(SubTag aEnergyType, long aPrimary, long aSecondary, IExperimentalEnergyTileEntity aEmitter) { + long rUsedSecondary = 0; + checkAvailabilities(); + for (byte i = 0, j = 0; i < 6 && aSecondary > rUsedSecondary; i++) + if (aEmitter.outputsEnergyTo(aEnergyType, i)) { + j = GT_Utility.getOppositeSide(i); + TileEntity tTileEntity = aEmitter.getTileEntityAtSide(i); + if (tTileEntity instanceof IExperimentalEnergyTileEntity) { + if (aEmitter.getColorization() >= 0) { + byte tColor = ((IExperimentalEnergyTileEntity) tTileEntity).getColorization(); + if (tColor >= 0 && tColor != aEmitter.getColorization()) continue; + } + rUsedSecondary += ((IExperimentalEnergyTileEntity) tTileEntity).injectEnergy(aEnergyType, j, aPrimary, aSecondary - rUsedSecondary); + } else if (IC_ENERGY && aEnergyType == SubTag.ENERGY_ELECTRICITY && tTileEntity instanceof IEnergySink) { + if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aEmitter, ForgeDirection.getOrientation(j))) { + while (aSecondary > rUsedSecondary && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(ForgeDirection.getOrientation(j), aPrimary, aPrimary) < aPrimary) + rUsedSecondary++; + } + } else if (RF_ENERGY && aEnergyType == SubTag.ENERGY_REDSTONE_FLUX && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) { + rUsedSecondary += ((IEnergyReceiver) tTileEntity).receiveEnergy(ForgeDirection.getOrientation(j), (int) aSecondary, false); + } + } + return rUsedSecondary; + } + } +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java new file mode 100644 index 0000000000..edcf5bdb89 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java @@ -0,0 +1,31 @@ +package gregtech.api.interfaces.tileentity; + +/** + * This File has just internal Information about the Fibre Redstone State of a TileEntity + */ +public interface IFibreConnected extends IColoredTileEntity, IHasWorldObjectAndCoords { + /** + * If this Blocks accepts Fibre from this Side + */ + public void inputFibreFrom(byte aSide); + + /** + * If this Blocks emits Fibre to this Side + */ + public void outputsFibreTo(byte aSide); + + /** + * Sets the Signal this Blocks outputs to this Fibre Color + */ + public void setFibreOutput(byte aSide, byte aColor, byte aRedstoneStrength); + + /** + * Gets the Signal this Blocks outputs to this Fibre Color + */ + public byte getFibreOutput(byte aSide, byte aColor); + + /** + * Gets the Signal this Blocks receives from this Fibre Color + */ + public byte getFibreInput(byte aSide, byte aColor); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java new file mode 100644 index 0000000000..796f0a11b3 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java @@ -0,0 +1,17 @@ +package gregtech.api.interfaces.tileentity; + +public interface IGearEnergyTileEntity { + /** + * If Rotation Energy can be accepted on this Side. + * This means that the Gear/Axle will connect to this Side, and can cause the Gear/Axle to stop if the Energy isn't accepted. + */ + public boolean acceptsRotationalEnergy(byte aSide); + + /** + * Inject Energy Call for Rotational Energy. + * Rotation Energy can't be stored, this is just for things like internal Dynamos, which convert it into Energy, or into Progress. + * + * @param aSpeed Positive = Clockwise, Negative = Counterclockwise + */ + public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy); +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java new file mode 100644 index 0000000000..e4bb4f1371 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java @@ -0,0 +1,21 @@ +package gregtech.api.interfaces.tileentity; + +/** + * You are allowed to include this File in your Download, as i will not change it. + */ +public interface IGregTechDeviceInformation { + /** + * Is this even a TileEntity which allows GregTech Sensor Kits? + * I need things like this Function for MetaTileEntities, you MUST check this!!! + * Do not assume that it's a Information returning Device, when it just implements this Interface. + */ + public boolean isGivingInformation(); + + /** + * Up to 8 Strings can be returned. + * Note: If you insert "\\\\" in the String it tries to translate seperate Parts of the String instead of the String as a whole. + * + * @return an Array of Information Strings. Don't return null! + */ + public String[] getInfoData(); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java new file mode 100644 index 0000000000..2170b6543c --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -0,0 +1,127 @@ +package gregtech.api.interfaces.tileentity; + +import gregtech.api.interfaces.IDescribable; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.fluids.IFluidHandler; + +import java.util.ArrayList; +import java.util.List; + +/** + * A simple compound Interface for all my TileEntities. + * <p/> + * Also delivers most of the Informations about my TileEntities. + * <p/> + * It can cause Problems to include this Interface! + */ +public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTileEntity, ICoverable, IFluidHandler, ITurnable, IGregTechDeviceInformation, IUpgradableMachine, IDigitalChest, IDescribable, IMachineBlockUpdateable { + /** + * gets the Error displayed on the GUI + */ + public int getErrorDisplayID(); + + /** + * sets the Error displayed on the GUI + */ + public void setErrorDisplayID(int aErrorID); + + /** + * @return the MetaID of the Block or the MetaTileEntity ID. + */ + public int getMetaTileID(); + + /** + * Internal Usage only! + */ + public int setMetaTileID(short aID); + + /** + * @return the MetaTileEntity which is belonging to this, or null if it doesnt has one. + */ + public IMetaTileEntity getMetaTileEntity(); + + /** + * Sets the MetaTileEntity. + * Even though this uses the Universal Interface, certain BaseMetaTileEntities only accept one kind of MetaTileEntity + * so only use this if you are sure its the correct one or you will get a Class cast Error. + * + * @param aMetaTileEntity + */ + public void setMetaTileEntity(IMetaTileEntity aMetaTileEntity); + + /** + * Causes a general Texture update. + * <p/> + * Only used Client Side to mark Blocks dirty. + */ + public void issueTextureUpdate(); + + /** + * Causes the Machine to send its initial Data, like Covers and its ID. + */ + public void issueClientUpdate(); + + /** + * causes Explosion. Strength in Overload-EU + */ + public void doExplosion(long aExplosionEU); + + /** + * Sets the Block on Fire in all 6 Directions + */ + public void setOnFire(); + + /** + * Sets the Block to Fire + */ + public void setToFire(); + + /** + * Sets the Owner of the Machine. Returns the set Name. + */ + public String setOwnerName(String aName); + + /** + * gets the Name of the Machines Owner or "Player" if not set. + */ + public String getOwnerName(); + + /** + * Sets initial Values from NBT + * + * @param tNBT is the NBTTag of readFromNBT + * @param aID is the MetaTileEntityID + */ + public void setInitialValuesAsNBT(NBTTagCompound aNBT, short aID); + + /** + * Called when leftclicking the TileEntity + */ + public void onLeftclick(EntityPlayer aPlayer); + + /** + * Called when rightclicking the TileEntity + */ + public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float par1, float par2, float par3); + + public float getBlastResistance(byte aSide); + + public ArrayList<ItemStack> getDrops(); + + /** + * 255 = 100% + */ + public int getLightOpacity(); + + public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); + + public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java new file mode 100644 index 0000000000..3bd8b0429c --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java @@ -0,0 +1,33 @@ +package gregtech.api.interfaces.tileentity; + +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; + +public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords { + + /** + * if the Inventory of this TileEntity got modified this tick + */ + public boolean hasInventoryBeenModified(); + + /** + * if this is just a Holoslot + */ + public boolean isValidSlot(int aIndex); + + /** + * Tries to add a Stack to the Slot. + * It doesn't matter if the Slot is valid or invalid as described at the Function above. + * + * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and then true if aStack has been added + */ + public boolean addStackToSlot(int aIndex, ItemStack aStack); + + /** + * Tries to add X Items of a Stack to the Slot. + * It doesn't matter if the Slot is valid or invalid as described at the Function above. + * + * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and then true if aStack has been added + */ + public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java new file mode 100644 index 0000000000..c86ac0f33f --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java @@ -0,0 +1,169 @@ +package gregtech.api.interfaces.tileentity; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.fluids.IFluidHandler; + +/** + * This is a bunch of Functions my TileEntities provide, to make life much easier, and to get rid of internal TileEntity stuff. + * <p/> + * This also makes access to adjacent TileEntities more Efficient. + * <p/> + * Note: It doesn't have to be a TileEntity in certain cases! And only certain cases, such as the Recipe checking of the findRecipe Function. + */ +public interface IHasWorldObjectAndCoords { + public World getWorld(); + + public int getXCoord(); + + public short getYCoord(); + + public int getZCoord(); + + public boolean isServerSide(); + + public boolean isClientSide(); + + public int getRandomNumber(int aRange); + + public TileEntity getTileEntity(int aX, int aY, int aZ); + + public TileEntity getTileEntityOffset(int aX, int aY, int aZ); + + public TileEntity getTileEntityAtSide(byte aSide); + + public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance); + + public IInventory getIInventory(int aX, int aY, int aZ); + + public IInventory getIInventoryOffset(int aX, int aY, int aZ); + + public IInventory getIInventoryAtSide(byte aSide); + + public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance); + + public IFluidHandler getITankContainer(int aX, int aY, int aZ); + + public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ); + + public IFluidHandler getITankContainerAtSide(byte aSide); + + public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance); + + public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ); + + public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ); + + public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide); + + public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance); + + public Block getBlock(int aX, int aY, int aZ); + + public Block getBlockOffset(int aX, int aY, int aZ); + + public Block getBlockAtSide(byte aSide); + + public Block getBlockAtSideAndDistance(byte aSide, int aDistance); + + public byte getMetaID(int aX, int aY, int aZ); + + public byte getMetaIDOffset(int aX, int aY, int aZ); + + public byte getMetaIDAtSide(byte aSide); + + public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance); + + public byte getLightLevel(int aX, int aY, int aZ); + + public byte getLightLevelOffset(int aX, int aY, int aZ); + + public byte getLightLevelAtSide(byte aSide); + + public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance); + + public boolean getOpacity(int aX, int aY, int aZ); + + public boolean getOpacityOffset(int aX, int aY, int aZ); + + public boolean getOpacityAtSide(byte aSide); + + public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance); + + public boolean getSky(int aX, int aY, int aZ); + + public boolean getSkyOffset(int aX, int aY, int aZ); + + public boolean getSkyAtSide(byte aSide); + + public boolean getSkyAtSideAndDistance(byte aSide, int aDistance); + + public boolean getAir(int aX, int aY, int aZ); + + public boolean getAirOffset(int aX, int aY, int aZ); + + public boolean getAirAtSide(byte aSide); + + public boolean getAirAtSideAndDistance(byte aSide, int aDistance); + + public BiomeGenBase getBiome(); + + public BiomeGenBase getBiome(int aX, int aZ); + + public int getOffsetX(byte aSide, int aMultiplier); + + public short getOffsetY(byte aSide, int aMultiplier); + + public int getOffsetZ(byte aSide, int aMultiplier); + + /** + * Checks if the TileEntity is Invalid or Unloaded. Stupid Minecraft cannot do that btw. + */ + public boolean isDead(); + + /** + * Sends a Block Event to the Client TileEntity, the byte Parameters are only for validation as Minecraft doesn't properly write Packet Data. + */ + public void sendBlockEvent(byte aID, byte aValue); + + /** + * @return the Time this TileEntity has been loaded. + */ + public long getTimer(); + + /** + * Sets the Light Level of this Block on a Scale of 0 - 15 + * It could be that it doesn't work. This is just for convenience. + */ + public void setLightValue(byte aLightValue); + + /** + * Function of the regular TileEntity + */ + public void writeToNBT(NBTTagCompound aNBT); + + /** + * Function of the regular TileEntity + */ + public void readFromNBT(NBTTagCompound aNBT); + + /** + * Function of the regular TileEntity + */ + public boolean isInvalidTileEntity(); + + /** + * Opens the GUI with this ID of this MetaTileEntity + */ + public boolean openGUI(EntityPlayer aPlayer, int aID); + + /** + * Opens the GUI with the ID = 0 of this TileEntity + */ + public boolean openGUI(EntityPlayer aPlayer); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java new file mode 100644 index 0000000000..bb34419357 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java @@ -0,0 +1,16 @@ +package gregtech.api.interfaces.tileentity; + +/** + * You are allowed to include this File in your Download, as i will not change it. + * Simple Interface for Machines, which need my Machine Blocks for MultiBlockStructures. + * <p/> + * Every Machine implementing this Interface will conduct Machine updates. + */ +public interface IMachineBlockUpdateable { + /** + * The Machine Update, which is called when the Machine needs an Update of its Parts. + * I suggest to wait 1-5 seconds before actually checking the Machine Parts. + * RP-Frames could for example cause Problems when you instacheck the Machine Parts. + */ + public void onMachineBlockUpdate(); +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java new file mode 100644 index 0000000000..00bb7b9a7d --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java @@ -0,0 +1,69 @@ +package gregtech.api.interfaces.tileentity; + +/** + * For Machines which have Progress + */ +public interface IMachineProgress extends IHasWorldObjectAndCoords { + /** + * returns the Progress this Machine has made. Warning, this can also be negative! + */ + public int getProgress(); + + /** + * returns the Progress the Machine needs to complete its task. + */ + public int getMaxProgress(); + + /** + * increases the Progress of the Machine + */ + public boolean increaseProgress(int aProgressAmountInTicks); + + /** + * returns if the Machine currently does something. + */ + public boolean hasThingsToDo(); + + /** + * returns if the Machine just got enableWorking called after being disabled. + * Used for Translocators, which need to check if they need to transfer immediately. + */ + public boolean hasWorkJustBeenEnabled(); + + /** + * allows Machine to work + */ + public void enableWorking(); + + /** + * disallows Machine to work + */ + public void disableWorking(); + + /** + * if the Machine is allowed to Work + */ + public boolean isAllowedToWork(); + + /** + * used to control Machines via Redstone Signal Strength by special Covers + * In case of 0 the Machine is very likely doing nothing, or is just not being controlled at all. + */ + public byte getWorkDataValue(); + + /** + * used to control Machines via Redstone Signal Strength by special Covers + * only Values between 0 and 15! + */ + public void setWorkDataValue(byte aValue); + + /** + * gives you the Active Status of the Machine + */ + public boolean isActive(); + + /** + * sets the visible Active Status of the Machine + */ + public void setActive(boolean aActive); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java new file mode 100644 index 0000000000..6618e4b4fd --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java @@ -0,0 +1,11 @@ +package gregtech.api.interfaces.tileentity; + +import gregtech.api.interfaces.ITexture; + +public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity { + public float getThickNess(); + + public byte getConnections(); + + public ITexture[] getTextureUncovered(byte aSide); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java new file mode 100644 index 0000000000..5be185b4a3 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java @@ -0,0 +1,37 @@ +package gregtech.api.interfaces.tileentity; + +/** + * This File has just internal Information about the Redstone State of a TileEntity + */ +public interface IRedstoneEmitter extends IHasWorldObjectAndCoords { + /** + * gets the Redstone Level the TileEntity should emit to the given Output Side + */ + byte getOutputRedstoneSignal(byte aSide); + + /** + * sets the Redstone Level the TileEntity should emit to the given Output Side + * <p/> + * Do not use this if ICoverable is implemented. ICoverable has @getInternalOutputRedstoneSignal for Machine internal Output Redstone, so that it doesnt conflict with Cover Redstone. + * This sets the true Redstone Output Signal. Only Cover Behaviors should use it, not MetaTileEntities. + */ + void setOutputRedstoneSignal(byte aSide, byte aStrength); + + /** + * gets the Redstone Level the TileEntity should emit to the given Output Side + */ + byte getStrongOutputRedstoneSignal(byte aSide); + + /** + * sets the Redstone Level the TileEntity should emit to the given Output Side + * <p/> + * Do not use this if ICoverable is implemented. ICoverable has @getInternalOutputRedstoneSignal for Machine internal Output Redstone, so that it doesnt conflict with Cover Redstone. + * This sets the true Redstone Output Signal. Only Cover Behaviors should use it, not MetaTileEntities. + */ + void setStrongOutputRedstoneSignal(byte aSide, byte aStrength); + + /** + * Gets the Output for the comparator on the given Side + */ + byte getComparatorValue(byte aSide); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java new file mode 100644 index 0000000000..f5b0f76bad --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java @@ -0,0 +1,29 @@ +package gregtech.api.interfaces.tileentity; + +/** + * This File has just internal Information about the Redstone State of a TileEntity + */ +public interface IRedstoneReceiver extends IHasWorldObjectAndCoords { + /** + * gets the Redstone Level of the TileEntity to the given Input Side + * <p/> + * Do not use this if ICoverable is implemented. ICoverable has @getInternalInputRedstoneSignal for Machine internal Input Redstone + * This returns the true incoming Redstone Signal. Only Cover Behaviors should check it, not MetaTileEntities. + */ + public byte getInputRedstoneSignal(byte aSide); + + /** + * gets the strongest Redstone Level the TileEntity receives + */ + public byte getStrongestRedstone(); + + /** + * gets if the TileEntity receives Redstone + */ + public boolean getRedstone(); + + /** + * gets if the TileEntity receives Redstone at this Side + */ + public boolean getRedstone(byte aSide); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java new file mode 100644 index 0000000000..f1cf01d291 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java @@ -0,0 +1,17 @@ +package gregtech.api.interfaces.tileentity; + +/** + * This File has just internal Information about the Redstone State of a TileEntity + */ +public interface IRedstoneTileEntity extends IRedstoneEmitter, IRedstoneReceiver { + /** + * enables/disables Redstone Output in general. + */ + void setGenericRedstoneOutput(boolean aOnOff); + + /** + * Causes a general Block update. + * Sends nothing to Client, just causes a Block Update. + */ + public void issueBlockUpdate(); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java new file mode 100644 index 0000000000..ea46c9cc11 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java @@ -0,0 +1,10 @@ +package gregtech.api.interfaces.tileentity; + +import gregtech.api.interfaces.ITexture; + +public interface ITexturedTileEntity { + /** + * @return the Textures rendered by the GT Rendering + */ + public ITexture[] getTexture(byte aSide); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java new file mode 100644 index 0000000000..dca9c5ce0b --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java @@ -0,0 +1,33 @@ +package gregtech.api.interfaces.tileentity; + + +/** + * Implemented by all my Machines. However without any security checks, if the Players are even allowed to rotate it. + */ +public interface ITurnable { + /** + * Get the block's facing. + * + * @return front Block facing + */ + byte getFrontFacing(); + + /** + * Set the block's facing + * + * @param facing facing to set the block to + */ + void setFrontFacing(byte aSide); + + /** + * Get the block's back facing. + * + * @return opposite Block facing + */ + byte getBackFacing(); + + /** + * Determine if the wrench can be used to set the block's facing. + */ + boolean isValidFacing(byte aSide); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java b/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java new file mode 100644 index 0000000000..0d027f6e30 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java @@ -0,0 +1,42 @@ +package gregtech.api.interfaces.tileentity; + + +/** + * To access my Machines a bit easier + */ +public interface IUpgradableMachine extends IMachineProgress { + /** + * Accepts Upgrades. Some Machines have an Upgrade Limit. + */ + boolean isUpgradable(); + + /** + * Accepts Muffler Upgrades + */ + boolean isMufflerUpgradable(); + + /** + * Accepts Steam-Converter Upgrades + */ + boolean isSteamEngineUpgradable(); + + /** + * Adds Muffler Upgrade + */ + boolean addMufflerUpgrade(); + + /** + * Adds MJ-Converter Upgrade + */ + boolean addSteamEngineUpgrade(); + + /** + * Does this Machine have an Muffler + */ + boolean hasMufflerUpgrade(); + + /** + * Does this Machine have a Steam-Converter + */ + boolean hasSteamEngineUpgrade(); +} |