aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/tileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/interfaces/tileentity')
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IAllSidedTexturedTileEntity.java24
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java110
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java27
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java91
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java18
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java33
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java41
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java178
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java34
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java19
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java21
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java22
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java206
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java21
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java37
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java169
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java17
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java24
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java96
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java15
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java18
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java31
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java52
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java33
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java17
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java14
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java46
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java42
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java89
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IWirelessEnergyHatchInformation.java17
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java49
31 files changed, 1611 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IAllSidedTexturedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IAllSidedTexturedTileEntity.java
new file mode 100644
index 0000000000..1d00aa5d76
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IAllSidedTexturedTileEntity.java
@@ -0,0 +1,24 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraft.block.Block;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import gregtech.api.interfaces.ITexture;
+
+/**
+ * Block which has same texture on all sides
+ */
+public interface IAllSidedTexturedTileEntity extends ITexturedTileEntity {
+
+ /**
+ * @return the Textures rendered by the GT Rendering
+ */
+ default ITexture[] getTexture(Block aBlock, ForgeDirection side) {
+ return getTexture(aBlock);
+ }
+
+ /**
+ * @return the Textures rendered by the GT Rendering
+ */
+ ITexture[] getTexture(Block aBlock);
+}
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..37d62894bb
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java
@@ -0,0 +1,110 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Interface for internal Code, which is mainly used for independent Energy conversion.
+ */
+public interface IBasicEnergyContainer extends IEnergyConnected, IHasWorldObjectAndCoords {
+
+ /**
+ * 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.
+ */
+ boolean isUniversalEnergyStored(long aEnergyAmount);
+
+ /**
+ * Gets the stored electric, kinetic or steam Energy (with EU as reference Value) Always returns the largest one.
+ */
+ long getUniversalEnergyStored();
+
+ /**
+ * Gets the largest electric, kinetic or steam Energy Capacity (with EU as reference Value)
+ */
+ long getUniversalEnergyCapacity();
+
+ /**
+ * Gets the amount of Energy Packets per tick.
+ */
+ long getOutputAmperage();
+
+ /**
+ * Gets the Output in EU/p.
+ */
+ long getOutputVoltage();
+
+ /**
+ * Gets the amount of Energy Packets per tick.
+ */
+ long getInputAmperage();
+
+ /**
+ * Gets the maximum Input in EU/p.
+ */
+ 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.
+ */
+ 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.
+ */
+ boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy);
+
+ /**
+ * Drain Energy Call for Electricity.
+ */
+ boolean drainEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage);
+
+ /**
+ * returns the amount of Electricity, accepted by this Block the last 5 ticks as Average.
+ */
+ long getAverageElectricInput();
+
+ /**
+ * returns the amount of Electricity, outputted by this Block the last 5 ticks as Average.
+ */
+ long getAverageElectricOutput();
+
+ /**
+ * returns the amount of electricity contained in this Block, in EU units!
+ */
+ long getStoredEU();
+
+ /**
+ * returns the amount of electricity containable in this Block, in EU units!
+ */
+ long getEUCapacity();
+
+ /**
+ * returns the amount of Steam contained in this Block, in EU units!
+ */
+ default long getStoredSteam() {
+ return 0;
+ }
+
+ /**
+ * returns the amount of Steam containable in this Block, in EU units!
+ */
+ default long getSteamCapacity() {
+ return 0;
+ }
+
+ /**
+ * 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
+ */
+ default boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) {
+ return false;
+ }
+}
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..ec760dd346
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java
@@ -0,0 +1,27 @@
+package gregtech.api.interfaces.tileentity;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.util.GT_Util;
+
+public interface IColoredTileEntity {
+
+ /**
+ * @return 0 - 15 are Colors, while -1 means uncolored
+ */
+ byte getColorization();
+
+ /**
+ * Sets the Color Modulation of the Block
+ *
+ * @param aColor the Color you want to set it to. -1 for reset.
+ */
+ byte setColorization(byte aColor);
+
+ /**
+ * @return Actual color shown on GUI
+ */
+ default int getGUIColorization() {
+ return GT_Util
+ .getRGBInt((getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA());
+ }
+}
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..8834678984
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java
@@ -0,0 +1,91 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import gregtech.api.util.GT_CoverBehavior;
+import gregtech.api.util.GT_CoverBehaviorBase;
+import gregtech.api.util.ISerializableObject;
+import gregtech.common.covers.CoverInfo;
+
+public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEnergyContainer {
+
+ boolean canPlaceCoverIDAtSide(ForgeDirection side, int aID);
+
+ boolean canPlaceCoverItemAtSide(ForgeDirection side, ItemStack aCover);
+
+ boolean dropCover(ForgeDirection side, ForgeDirection droppedSide, boolean aForced);
+
+ @Deprecated
+ void setCoverDataAtSide(ForgeDirection side, int aData);
+
+ default void setCoverDataAtSide(ForgeDirection side, ISerializableObject aData) {
+ if (aData instanceof ISerializableObject.LegacyCoverData)
+ setCoverDataAtSide(side, ((ISerializableObject.LegacyCoverData) aData).get());
+ }
+
+ void setCoverIdAndDataAtSide(ForgeDirection side, int aId, ISerializableObject aData);
+
+ void setCoverIDAtSide(ForgeDirection side, int aID);
+
+ boolean setCoverIDAtSideNoUpdate(ForgeDirection side, int aID);
+
+ void setCoverItemAtSide(ForgeDirection side, ItemStack aCover);
+
+ @Deprecated
+ int getCoverDataAtSide(ForgeDirection side);
+
+ default CoverInfo getCoverInfoAtSide(ForgeDirection side) {
+ return null;
+ }
+
+ default ISerializableObject getComplexCoverDataAtSide(ForgeDirection side) {
+ return new ISerializableObject.LegacyCoverData(getCoverDataAtSide(side));
+ }
+
+ int getCoverIDAtSide(ForgeDirection side);
+
+ ItemStack getCoverItemAtSide(ForgeDirection side);
+
+ @Deprecated
+ GT_CoverBehavior getCoverBehaviorAtSide(ForgeDirection side);
+
+ default GT_CoverBehaviorBase<?> getCoverBehaviorAtSideNew(ForgeDirection side) {
+ return getCoverBehaviorAtSide(side);
+ }
+
+ /**
+ * 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.
+ */
+ byte getInternalInputRedstoneSignal(ForgeDirection side);
+
+ /**
+ * 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.
+ */
+ void setInternalOutputRedstoneSignal(ForgeDirection side, byte aStrength);
+
+ /**
+ * Causes a general Cover Texture update. Sends 6 Integers to Client + causes @issueTextureUpdate()
+ */
+ void issueCoverUpdate(ForgeDirection side);
+
+ /**
+ * Receiving a packet with cover data.
+ */
+ void receiveCoverData(ForgeDirection coverSide, int coverID, int coverData);
+
+ /**
+ * Receiving a packet with cover data.
+ *
+ * @param coverSide cover side
+ * @param aPlayer the player who made the change
+ */
+ default void receiveCoverData(ForgeDirection coverSide, int aCoverID, ISerializableObject aCoverData,
+ EntityPlayerMP aPlayer) {
+ if (aCoverData instanceof ISerializableObject.LegacyCoverData)
+ receiveCoverData(coverSide, aCoverID, ((ISerializableObject.LegacyCoverData) aCoverData).get());
+ }
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java
new file mode 100644
index 0000000000..5208944d66
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java
@@ -0,0 +1,18 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.ArrayList;
+
+import net.minecraft.entity.player.EntityPlayer;
+
+public interface IDebugableTileEntity {
+
+ /**
+ * Returns a Debug Message, for a generic DebugItem
+ *
+ * @param aPlayer the Player, who rightclicked with his Debug Item
+ * @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)
+ */
+ ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel);
+}
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..9a08e65b78
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java
@@ -0,0 +1,33 @@
+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.
+ */
+ 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.
+ */
+ ItemStack[] getStoredItemData();
+
+ /**
+ * A generic Interface for just setting the amount of contained Items
+ */
+ 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!
+ */
+ int getMaxItemCount();
+}
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..e285c6f0e3
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java
@@ -0,0 +1,41 @@
+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, IHasWorldObjectAndCoords {
+
+ /**
+ * @return if this is actually a Cable. (you must check this)
+ */
+ boolean isConductor();
+
+ /**
+ * @return the maximum Voltage of the Cable.
+ */
+ long getMaxVoltage();
+
+ /**
+ * @return the maximum Amperage of the Cable, per Wire.
+ */
+ long getMaxAmperage();
+
+ /**
+ * @return the Loss of the Cable, per Meter.
+ */
+ long getLossPerMeter();
+
+ /**
+ * @return the Material the Cable consists of. (may return Materials._NULL)
+ */
+ Materials getCableMaterial();
+
+ /**
+ * @return the Material the Cable Insulation consists of. (may return Materials._NULL)
+ */
+ Materials getInsulationMaterial();
+}
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..91a9759e47
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java
@@ -0,0 +1,178 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.Objects;
+
+import javax.annotation.Nonnull;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import cofh.api.energy.IEnergyReceiver;
+import gregtech.api.GregTech_API;
+import gregtech.api.logic.PowerLogic;
+import gregtech.api.logic.interfaces.PowerLogicHost;
+import gregtech.api.util.GT_Utility;
+import ic2.api.energy.tile.IEnergySink;
+
+/**
+ * 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 {
+
+ /**
+ * 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 side 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.
+ */
+ long injectEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage);
+
+ /**
+ * Sided Energy Input
+ */
+ boolean inputEnergyFrom(ForgeDirection side);
+
+ default boolean inputEnergyFrom(ForgeDirection side, boolean waitForActive) {
+ return inputEnergyFrom(side);
+ }
+
+ /**
+ * Sided Energy Output
+ */
+ boolean outputsEnergyTo(ForgeDirection side);
+
+ default boolean outputsEnergyTo(ForgeDirection side, boolean waitForActive) {
+ return outputsEnergyTo(side);
+ }
+
+ /**
+ * Utility for the Network
+ */
+ final class Util {
+
+ // TODO: Deduplicate code by rewokring the Enet system using the GTCEu one as inspiration - BlueWeabo
+ /**
+ * Emits Energy to the E-net. Also compatible with adjacent IC2 TileEntities.
+ *
+ * @return the used Amperage.
+ */
+ public static long emitEnergyToNetwork(long voltage, long amperage, IEnergyConnected emitter) {
+ long usedAmperes = 0;
+ if (!(emitter instanceof IHasWorldObjectAndCoords emitterTile)) {
+ return 0;
+ }
+
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
+ if (usedAmperes > amperage) break;
+ if (!emitter.outputsEnergyTo(side)) {
+ continue;
+ }
+
+ final ForgeDirection oppositeSide = Objects.requireNonNull(side.getOpposite());
+ final TileEntity tTileEntity = emitterTile.getTileEntityAtSide(side);
+ if (tTileEntity instanceof PowerLogicHost host) {
+
+ final PowerLogic logic = host.getPowerLogic(oppositeSide);
+ if (logic == null || logic.isEnergyReceiver()) {
+ continue;
+ }
+
+ usedAmperes += logic.injectEnergy(voltage, amperage - usedAmperes);
+ } else if (tTileEntity instanceof IEnergyConnected energyConnected) {
+ if (emitter.getColorization() >= 0) {
+ final byte tColor = energyConnected.getColorization();
+ if (tColor >= 0 && tColor != emitter.getColorization()) continue;
+ }
+ usedAmperes += energyConnected.injectEnergyUnits(oppositeSide, voltage, amperage - usedAmperes);
+
+ } else if (tTileEntity instanceof IEnergySink sink) {
+ if (sink.acceptsEnergyFrom((TileEntity) emitter, oppositeSide)) {
+ while (amperage > usedAmperes && sink.getDemandedEnergy() > 0
+ && sink.injectEnergy(oppositeSide, voltage, voltage) < voltage) usedAmperes++;
+ }
+ } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver receiver) {
+ final int rfOut = GT_Utility.safeInt(voltage * GregTech_API.mEUtoRF / 100);
+ if (receiver.receiveEnergy(oppositeSide, rfOut, true) == rfOut) {
+ receiver.receiveEnergy(oppositeSide, rfOut, false);
+ usedAmperes++;
+ }
+ }
+ }
+ return usedAmperes;
+ }
+
+ /**
+ * Same as {@link #emitEnergyToNetwork(long, long, IEnergyConnected)}, but instead we remove the energy directly from the logic itself.
+ * @param emitter The host, which is trying to emit energy in the network
+ * @param outputSide side from where energy is being outputted to. If its {@link ForgeDirection#UNKNOWN} then it doesn't emit energy to the network
+ */
+ public static void emitEnergyToNetwork(@Nonnull final PowerLogicHost emitter, @Nonnull final ForgeDirection outputSide) {
+ if (outputSide == ForgeDirection.UNKNOWN) return;
+ final PowerLogic emitterLogic = emitter.getPowerLogic();
+ long usedAmperes = 0;
+ long voltage = emitterLogic.getVoltage();
+ long amperage = emitterLogic.getMaxAmperage();
+ if (!(emitter instanceof final IHasWorldObjectAndCoords emitterTile)) {
+ return;
+ }
+ // We need to make sure we can actually output energy on this side. This is more of a safety check.
+ if (emitter.getPowerLogic(outputSide) == null) {
+ return;
+ }
+
+ final ForgeDirection oppositeSide = Objects.requireNonNull(outputSide.getOpposite());
+ final TileEntity tileEntity = emitterTile.getTileEntityAtSide(outputSide);
+ if (tileEntity instanceof PowerLogicHost host) {
+
+ final PowerLogic logic = host.getPowerLogic(oppositeSide);
+ if (logic == null || logic.isEnergyReceiver()) {
+ return;
+ }
+
+ usedAmperes += logic.injectEnergy(voltage, amperage);
+ emitterLogic.removeEnergyUnsafe(usedAmperes * voltage);
+ return;
+ }
+
+ if (tileEntity instanceof IEnergyConnected energyConnected) {
+ if (emitter instanceof IColoredTileEntity coloredEmitter && coloredEmitter.getColorization() >= 0) {
+ final byte tColor = energyConnected.getColorization();
+ if (tColor >= 0 && tColor != coloredEmitter.getColorization()) {
+ return;
+ }
+ }
+ usedAmperes += energyConnected.injectEnergyUnits(oppositeSide, voltage, amperage - usedAmperes);
+ emitterLogic.removeEnergyUnsafe(usedAmperes * voltage);
+ return;
+ }
+
+ if (tileEntity instanceof IEnergySink sink) {
+ if (sink.acceptsEnergyFrom((TileEntity) emitter, oppositeSide)) {
+ while (amperage > usedAmperes && sink.getDemandedEnergy() > 0
+ && sink.injectEnergy(oppositeSide, voltage, voltage) < voltage) {
+ usedAmperes++;
+ }
+ emitterLogic.removeEnergyUnsafe(usedAmperes * voltage);
+ return;
+ }
+ }
+
+ if (GregTech_API.mOutputRF && tileEntity instanceof IEnergyReceiver receiver) {
+ final int rfOut = GT_Utility.safeInt(voltage * GregTech_API.mEUtoRF / 100);
+ if (receiver.receiveEnergy(oppositeSide, rfOut, true) == rfOut) {
+ receiver.receiveEnergy(oppositeSide, rfOut, false);
+ usedAmperes++;
+ emitterLogic.removeEnergyUnsafe(usedAmperes * voltage);
+ return;
+ }
+ }
+ }
+ }
+}
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..2f7f26e723
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java
@@ -0,0 +1,34 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * 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
+ */
+ void inputFibreFrom(ForgeDirection side);
+
+ /**
+ * If this Blocks emits Fibre to this Side
+ */
+ void outputsFibreTo(ForgeDirection side);
+
+ /**
+ * Sets the Signal this Blocks outputs to this Fibre Color
+ */
+ void setFibreOutput(ForgeDirection side, byte aColor, byte aRedstoneStrength);
+
+ /**
+ * Gets the Signal this Blocks outputs to this Fibre Color
+ */
+ byte getFibreOutput(ForgeDirection side, byte aColor);
+
+ /**
+ * Gets the Signal this Blocks receives from this Fibre Color
+ */
+ byte getFibreInput(ForgeDirection side, byte aColor);
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java b/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java
new file mode 100644
index 0000000000..77b894fea7
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java
@@ -0,0 +1,19 @@
+package gregtech.api.interfaces.tileentity;
+
+public interface IGTEnet {
+
+ /**
+ * @return true if this Device consumes Energy at all
+ */
+ default boolean isEnetInput() {
+ return false;
+ }
+
+ /**
+ *
+ * @return true if this Device emits Energy at all
+ */
+ default boolean isEnetOutput() {
+ return false;
+ }
+}
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..7eeee90c8c
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java
@@ -0,0 +1,21 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+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.
+ */
+ boolean acceptsRotationalEnergy(ForgeDirection side);
+
+ /**
+ * 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 side inject to this side
+ * @param aSpeed Positive = Clockwise, Negative = Counterclockwise
+ */
+ boolean injectRotationalEnergy(ForgeDirection side, 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..001ed44825
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java
@@ -0,0 +1,22 @@
+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.
+ */
+ 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!
+ */
+ String[] getInfoData();
+}
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..d8231ee544
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
@@ -0,0 +1,206 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.annotation.Nonnull;
+
+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.common.util.ForgeDirection;
+import net.minecraftforge.fluids.IFluidHandler;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.interfaces.IDescribable;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.modularui.IAddInventorySlots;
+import gregtech.api.interfaces.modularui.IGetGUITextureSet;
+import gregtech.api.util.shutdown.ShutDownReason;
+import gregtech.common.blocks.GT_Block_Machines;
+
+/**
+ * A simple compound Interface for all my TileEntities.
+ * <p/>
+ * Also delivers most of the Information 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,
+ IGregtechWailaProvider, IGetGUITextureSet, IAddInventorySlots {
+
+ /**
+ * gets the Error displayed on the GUI
+ */
+ int getErrorDisplayID();
+
+ /**
+ * sets the Error displayed on the GUI
+ */
+ void setErrorDisplayID(int aErrorID);
+
+ /**
+ * @return the MetaID of the Block or the MetaTileEntity ID.
+ */
+ int getMetaTileID();
+
+ /**
+ * Internal Usage only!
+ */
+ int setMetaTileID(short aID);
+
+ /**
+ * @return the MetaTileEntity which is belonging to this, or null if it doesnt has one.
+ */
+ 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 a MetaTileEntity
+ */
+ void setMetaTileEntity(IMetaTileEntity aMetaTileEntity);
+
+ /**
+ * Causes a general Texture update.
+ * <p/>
+ * Only used Client Side to mark Blocks dirty.
+ */
+ void issueTextureUpdate();
+
+ /**
+ * Causes the Machine to send its initial Data, like Covers and its ID.
+ */
+ void issueClientUpdate();
+
+ /**
+ * causes Explosion. Strength in Overload-EU
+ */
+ void doExplosion(long aExplosionEU);
+
+ /**
+ * Sets the Block on Fire in all 6 Directions
+ */
+ void setOnFire();
+
+ /**
+ * Sets the Block to Fire
+ */
+ void setToFire();
+
+ /**
+ * Sets the Owner of the Machine. Returns the set Name.
+ */
+ String setOwnerName(String aName);
+
+ /**
+ * gets the Name of the Machines Owner or "Player" if not set.
+ */
+ String getOwnerName();
+
+ /**
+ * Gets the UniqueID of the Machines Owner.
+ */
+ UUID getOwnerUuid();
+
+ /**
+ * Sets the UniqueID of the Machines Owner.
+ */
+ void setOwnerUuid(UUID uuid);
+
+ /**
+ * Sets initial Values from NBT
+ *
+ * @param aNBT is the NBTTag of readFromNBT
+ * @param aID is the MetaTileEntityID
+ */
+ void setInitialValuesAsNBT(NBTTagCompound aNBT, short aID);
+
+ /**
+ * Called when leftclicking the TileEntity
+ */
+ void onLeftclick(EntityPlayer aPlayer);
+
+ /**
+ * Called when rightclicking the TileEntity
+ */
+ boolean onRightclick(EntityPlayer aPlayer, ForgeDirection side, float aX, float aY, float aZ);
+
+ float getBlastResistance(ForgeDirection side);
+
+ default void onBlockDestroyed() {}
+
+ ArrayList<ItemStack> getDrops();
+
+ /**
+ * Check if the item at the specific index should be dropped or not
+ *
+ * @param index Index that will be checked
+ * @return True if it should drop, else false
+ */
+ boolean shouldDropItemAt(int index);
+
+ /**
+ * 255 = 100%
+ */
+ int getLightOpacity();
+
+ void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider);
+
+ AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ);
+
+ void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider);
+
+ /**
+ * Checks validity of meta tile and delegates to it
+ */
+ @Override
+ default void onMachineBlockUpdate() {
+ if (!isDead() && getMetaTileEntity() != null && getMetaTileEntity().getBaseMetaTileEntity() == this) {
+ getMetaTileEntity().onMachineBlockUpdate();
+ }
+ }
+
+ /**
+ * Checks validity of meta tile and delegates to it
+ */
+ @Override
+ default boolean isMachineBlockUpdateRecursive() {
+ return !isDead() && getMetaTileEntity() != null
+ && getMetaTileEntity().getBaseMetaTileEntity() == this
+ && getMetaTileEntity().isMachineBlockUpdateRecursive();
+ }
+
+ default void setShutdownStatus(boolean newStatus) {}
+
+ default void setShutDownReason(@Nonnull ShutDownReason reason) {}
+
+ /**
+ * A randomly called display update to be able to add particles or other items for display The event is proxied by
+ * the {@link GT_Block_Machines#randomDisplayTick}
+ */
+ @SideOnly(Side.CLIENT)
+ default void onRandomDisplayTick() {
+ if (getMetaTileEntity() != null && getMetaTileEntity().getBaseMetaTileEntity() == this) {
+ getMetaTileEntity().onRandomDisplayTick(this);
+ }
+ }
+
+ /**
+ * gets the time statistics used for CPU timing
+ */
+ default int[] getTimeStatistics() {
+ return null;
+ }
+
+ default void startTimeStatistics() {}
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java
new file mode 100644
index 0000000000..61566d82fb
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java
@@ -0,0 +1,21 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+public interface IGregtechWailaProvider {
+
+ default void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
+ IWailaConfigHandler config) {}
+
+ default void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag,
+ final World world, int x, int y, int z) {}
+}
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..bee1756217
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java
@@ -0,0 +1,37 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+
+public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords {
+
+ default void markInventoryBeenModified() {}
+
+ /**
+ * if the Inventory of this TileEntity got modified this tick
+ */
+ boolean hasInventoryBeenModified();
+
+ /**
+ * if this is just a Holoslot
+ */
+ 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
+ */
+ 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
+ */
+ boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount);
+}
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..b62c3e92cf
--- /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.inventory.IInventory;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.util.ForgeDirection;
+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 {
+
+ World getWorld();
+
+ int getXCoord();
+
+ short getYCoord();
+
+ int getZCoord();
+
+ default ChunkCoordinates getCoords() {
+ return new ChunkCoordinates(getXCoord(), getYCoord(), getZCoord());
+ }
+
+ boolean isServerSide();
+
+ boolean isClientSide();
+
+ int getRandomNumber(int aRange);
+
+ TileEntity getTileEntity(int aX, int aY, int aZ);
+
+ TileEntity getTileEntityOffset(int aX, int aY, int aZ);
+
+ TileEntity getTileEntityAtSide(ForgeDirection side);
+
+ TileEntity getTileEntityAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ IInventory getIInventory(int aX, int aY, int aZ);
+
+ IInventory getIInventoryOffset(int aX, int aY, int aZ);
+
+ IInventory getIInventoryAtSide(ForgeDirection side);
+
+ IInventory getIInventoryAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ IFluidHandler getITankContainer(int aX, int aY, int aZ);
+
+ IFluidHandler getITankContainerOffset(int aX, int aY, int aZ);
+
+ IFluidHandler getITankContainerAtSide(ForgeDirection side);
+
+ IFluidHandler getITankContainerAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ);
+
+ IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ);
+
+ IGregTechTileEntity getIGregTechTileEntityAtSide(ForgeDirection side);
+
+ IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ Block getBlock(int aX, int aY, int aZ);
+
+ Block getBlockOffset(int aX, int aY, int aZ);
+
+ Block getBlockAtSide(ForgeDirection side);
+
+ Block getBlockAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ byte getMetaID(int aX, int aY, int aZ);
+
+ byte getMetaIDOffset(int aX, int aY, int aZ);
+
+ byte getMetaIDAtSide(ForgeDirection side);
+
+ byte getMetaIDAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ byte getLightLevel(int aX, int aY, int aZ);
+
+ byte getLightLevelOffset(int aX, int aY, int aZ);
+
+ byte getLightLevelAtSide(ForgeDirection side);
+
+ byte getLightLevelAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ boolean getOpacity(int aX, int aY, int aZ);
+
+ boolean getOpacityOffset(int aX, int aY, int aZ);
+
+ boolean getOpacityAtSide(ForgeDirection side);
+
+ boolean getOpacityAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ boolean getSky(int aX, int aY, int aZ);
+
+ boolean getSkyOffset(int aX, int aY, int aZ);
+
+ boolean getSkyAtSide(ForgeDirection side);
+
+ boolean getSkyAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ boolean getAir(int aX, int aY, int aZ);
+
+ boolean getAirOffset(int aX, int aY, int aZ);
+
+ boolean getAirAtSide(ForgeDirection side);
+
+ boolean getAirAtSideAndDistance(ForgeDirection side, int aDistance);
+
+ BiomeGenBase getBiome();
+
+ BiomeGenBase getBiome(int aX, int aZ);
+
+ int getOffsetX(ForgeDirection side, int aMultiplier);
+
+ short getOffsetY(ForgeDirection side, int aMultiplier);
+
+ int getOffsetZ(ForgeDirection side, int aMultiplier);
+
+ /**
+ * Checks if the TileEntity is Invalid or Unloaded. Stupid Minecraft cannot do that btw.
+ */
+ boolean isDead();
+
+ /**
+ * Sends a Block Event to the Client TileEntity.
+ *
+ * @param aValue value to sync
+ */
+ void sendBlockEvent(byte aID, byte aValue);
+
+ /**
+ * @return the Time this TileEntity has been loaded.
+ */
+ 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.
+ */
+ void setLightValue(byte aLightValue);
+
+ /**
+ * Function of the regular TileEntity
+ */
+ void writeToNBT(NBTTagCompound aNBT);
+
+ /**
+ * Function of the regular TileEntity
+ */
+ void readFromNBT(NBTTagCompound aNBT);
+
+ /**
+ * Function of the regular TileEntity
+ */
+ boolean isInvalidTileEntity();
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java b/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java
new file mode 100644
index 0000000000..971558c092
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java
@@ -0,0 +1,17 @@
+package gregtech.api.interfaces.tileentity;
+
+/**
+ * IC2 Energy Compat
+ */
+public interface IIC2Enet {
+
+ /**
+ * Should this tile/block join the ic2 enet
+ */
+ boolean shouldJoinIc2Enet();
+
+ /**
+ * Update the ic2 enet
+ */
+ void doEnetUpdate();
+}
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..f772c1ee69
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java
@@ -0,0 +1,24 @@
+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.
+ */
+ void onMachineBlockUpdate();
+
+ /**
+ * Should recurse?
+ */
+ default boolean isMachineBlockUpdateRecursive() {
+ return true;
+ }
+}
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..83570fedcc
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java
@@ -0,0 +1,96 @@
+package gregtech.api.interfaces.tileentity;
+
+import javax.annotation.Nonnull;
+
+import gregtech.api.util.shutdown.ShutDownReason;
+import gregtech.api.util.shutdown.ShutDownReasonRegistry;
+
+/**
+ * For Machines which have Progress
+ */
+public interface IMachineProgress extends IHasWorldObjectAndCoords {
+
+ /**
+ * returns the Progress this Machine has made. Warning, this can also be negative!
+ */
+ int getProgress();
+
+ /**
+ * returns the Progress the Machine needs to complete its task.
+ */
+ int getMaxProgress();
+
+ /**
+ * Manually increases the Progress of the Machine by vent cover.
+ */
+ boolean increaseProgress(int aProgressAmountInTicks);
+
+ /**
+ * returns if the Machine currently does something.
+ */
+ 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.
+ */
+ boolean hasWorkJustBeenEnabled();
+
+ /**
+ * allows Machine to work
+ */
+ void enableWorking();
+
+ /**
+ * disallows Machine to work
+ */
+ void disableWorking();
+
+ /**
+ * if the Machine is allowed to Work
+ */
+ boolean isAllowedToWork();
+
+ default void setAllowedToWork(Boolean allowedToWork) {
+ if (allowedToWork) {
+ enableWorking();
+ } else {
+ disableWorking();
+ }
+ }
+
+ /**
+ * 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.
+ */
+ default byte getWorkDataValue() {
+ return 0;
+ }
+
+ /**
+ * used to control Machines via Redstone Signal Strength by special Covers only Values between 0 and 15!
+ */
+ default void setWorkDataValue(byte aValue) {}
+
+ /**
+ * gives you the Active Status of the Machine
+ */
+ boolean isActive();
+
+ /**
+ * sets the visible Active Status of the Machine
+ */
+ void setActive(boolean aActive);
+
+ /**
+ * Indicates if the object in question was forced to shut down (i.e. loss of power)
+ */
+ default boolean wasShutdown() {
+ return false;
+ }
+
+ @Nonnull
+ default ShutDownReason getLastShutDownReason() {
+ return ShutDownReasonRegistry.NONE;
+ }
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java b/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java
new file mode 100644
index 0000000000..495cd9def4
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java
@@ -0,0 +1,15 @@
+package gregtech.api.interfaces.tileentity;
+
+import javax.annotation.Nullable;
+
+import gregtech.api.objects.overclockdescriber.OverclockDescriber;
+
+/**
+ * Classes implementing this interface can provide {@link OverclockDescriber} to provide overclock behavior and NEI
+ * description.
+ */
+public interface IOverclockDescriptionProvider {
+
+ @Nullable
+ OverclockDescriber getOverclockDescriber();
+}
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..ab476449f0
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java
@@ -0,0 +1,18 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+import gregtech.api.interfaces.ITexture;
+
+public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity {
+
+ float getThickNess();
+
+ byte getConnections();
+
+ ITexture[] getTextureUncovered(ForgeDirection side);
+
+ default ITexture[] getTextureCovered(ForgeDirection side) {
+ return getTextureUncovered(side);
+ }
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java b/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java
new file mode 100644
index 0000000000..54d178af3c
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java
@@ -0,0 +1,31 @@
+package gregtech.api.interfaces.tileentity;
+
+import gregtech.api.recipe.check.SingleRecipeCheck;
+
+/**
+ * Machines implementing this interface can have logic to lock to a single recipe.
+ */
+public interface IRecipeLockable extends RecipeMapWorkable {
+
+ /**
+ * @return if this machine supports single recipe locking.
+ */
+ boolean supportsSingleRecipeLocking();
+
+ /**
+ * @return true if recipe locking is enabled, else false. This is getter is used for displaying the icon in the GUI
+ */
+ boolean isRecipeLockingEnabled();
+
+ void setRecipeLocking(boolean enabled);
+
+ default boolean getDefaultRecipeLockingMode() {
+ return false;
+ }
+
+ default SingleRecipeCheck getSingleRecipeCheck() {
+ return null;
+ }
+
+ default void setSingleRecipeCheck(SingleRecipeCheck recipeCheck) {}
+}
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..1b280184ce
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java
@@ -0,0 +1,52 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * 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
+ *
+ * @param side the {@link ForgeDirection} side
+ * @return the Redstone Level the TileEntity
+ */
+ byte getOutputRedstoneSignal(ForgeDirection side);
+
+ /**
+ * 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(ForgeDirection side, byte aStrength);
+
+ /**
+ * gets the Redstone Level the TileEntity should emit to the given Output Side
+ */
+ byte getStrongOutputRedstoneSignal(ForgeDirection side);
+
+ /**
+ * 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(ForgeDirection side, byte aStrength);
+
+ /**
+ * Gets the Output for the comparator on the given Side
+ */
+ byte getComparatorValue(ForgeDirection side);
+
+ /**
+ * Get the redstone output signal strength for a given side
+ */
+ default byte getGeneralRS(ForgeDirection side) {
+ return 0;
+ }
+}
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..a41e9aaf7a
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java
@@ -0,0 +1,33 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * 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.
+ */
+ byte getInputRedstoneSignal(ForgeDirection side);
+
+ /**
+ * gets the strongest Redstone Level the TileEntity receives
+ */
+ byte getStrongestRedstone();
+
+ /**
+ * gets if the TileEntity receives Redstone
+ */
+ boolean getRedstone();
+
+ /**
+ * gets if the TileEntity receives Redstone at this Side
+ */
+ boolean getRedstone(ForgeDirection side);
+}
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..1deb5f1d7c
--- /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.
+ */
+ void issueBlockUpdate();
+}
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..379111b07e
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java
@@ -0,0 +1,14 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraft.block.Block;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import gregtech.api.interfaces.ITexture;
+
+public interface ITexturedTileEntity {
+
+ /**
+ * @return the Textures rendered by the GT Rendering
+ */
+ ITexture[] getTexture(Block aBlock, ForgeDirection side);
+}
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..64cc8675ef
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java
@@ -0,0 +1,46 @@
+package gregtech.api.interfaces.tileentity;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * 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
+ */
+ ForgeDirection getFrontFacing();
+
+ /**
+ * Set the block's facing
+ *
+ * @param side facing to set the block to
+ */
+ void setFrontFacing(ForgeDirection side);
+
+ /**
+ * Get the block's back facing.
+ *
+ * @return opposite Block facing
+ */
+ ForgeDirection getBackFacing();
+
+ /**
+ * Determine if the wrench can be used to set the block's facing.
+ */
+ boolean isValidFacing(ForgeDirection side);
+
+ /**
+ * Get the list of valid facings
+ */
+ default boolean[] getValidFacings() {
+ final boolean[] validFacings = new boolean[6];
+ for (final ForgeDirection facing : ForgeDirection.VALID_DIRECTIONS) {
+ validFacings[facing.ordinal()] = isValidFacing(facing);
+ }
+ return validFacings;
+ }
+}
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..546ada0c9d
--- /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();
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java b/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java
new file mode 100644
index 0000000000..841fd07bba
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java
@@ -0,0 +1,89 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.List;
+import java.util.Set;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import gregtech.api.enums.VoidingMode;
+import gregtech.api.interfaces.fluid.IFluidStore;
+
+/**
+ * Machines implementing this interface can have logic to configure whether to void excess output or not.
+ */
+public interface IVoidable {
+
+ /**
+ * @return if this machine can prevent excess item and fluid from voiding.
+ */
+ boolean supportsVoidProtection();
+
+ default Set<VoidingMode> getAllowedVoidingModes() {
+ return VoidingMode.ALL_OPTIONS;
+ }
+
+ /**
+ * @return if this machine is configured to not void excess item.
+ */
+ default boolean protectsExcessItem() {
+ return supportsVoidProtection() && getVoidingMode().protectItem;
+ }
+
+ /**
+ * @return if this machine is configured to not void excess fluid.
+ */
+ default boolean protectsExcessFluid() {
+ return supportsVoidProtection() && getVoidingMode().protectFluid;
+ }
+
+ VoidingMode getVoidingMode();
+
+ void setVoidingMode(VoidingMode mode);
+
+ default VoidingMode getDefaultVoidingMode() {
+ return supportsVoidProtection() ? VoidingMode.VOID_NONE : VoidingMode.VOID_ALL;
+ }
+
+ /**
+ * @param toOutput List of items this machine is going to output.
+ * @return List of slots available for item outputs. Null element represents empty slot.
+ */
+ List<ItemStack> getItemOutputSlots(ItemStack[] toOutput);
+
+ /**
+ * @param toOutput List of fluids this machine is going to output.
+ * @return List of slots available for fluid outputs.
+ */
+ List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput);
+
+ /**
+ * @return How many slots of items this machine can output per recipe. Item outputs whose slot number
+ * exceeding this limit will be voided.
+ */
+ default int getItemOutputLimit() {
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * @return How many slots of fluids this machine can output per recipe. Fluid outputs whose slot number
+ * exceeding this limit will be voided.
+ */
+ default int getFluidOutputLimit() {
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * @return If this machine has ability to dump item outputs to ME network.
+ * This doesn't need to check if it can actually dump to ME,
+ * as this might be called every tick and cause lag.
+ */
+ boolean canDumpItemToME();
+
+ /**
+ * @return If this machine has ability to dump fluid outputs to ME network.
+ * This doesn't need to check if it can actually dump to ME,
+ * as this might be called every tick and cause lag.
+ */
+ boolean canDumpFluidToME();
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IWirelessEnergyHatchInformation.java b/src/main/java/gregtech/api/interfaces/tileentity/IWirelessEnergyHatchInformation.java
new file mode 100644
index 0000000000..fa58e5dd54
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IWirelessEnergyHatchInformation.java
@@ -0,0 +1,17 @@
+package gregtech.api.interfaces.tileentity;
+
+public interface IWirelessEnergyHatchInformation {
+
+ // This interface is solely for usage by wireless hatches/dynamos.
+
+ // Ticks between energy additions to the hatch. For a dynamo this is how many ticks between energy being consumed
+ // and added to the global energy map.
+ long ticks_between_energy_addition = 100L * 20L;
+
+ // Total number of energy additions this multi can store before it is full.
+ long number_of_energy_additions = 4L;
+
+ default long totalStorage(long tier_eu_per_tick) {
+ return tier_eu_per_tick * ticks_between_energy_addition * number_of_energy_additions;
+ }
+}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java b/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java
new file mode 100644
index 0000000000..7d4db4396c
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java
@@ -0,0 +1,49 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.annotation.Nonnull;
+
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.recipe.RecipeMap;
+
+/**
+ * Machines implementing this interface are capable of executing certain recipes provided by {@link RecipeMap}.
+ * They will also be automatically registered as NEI recipe catalyst for the corresponding recipemaps.
+ */
+public interface RecipeMapWorkable {
+
+ /**
+ * @return RecipeMap this machine currently can execute. In general, it's allowed to be null.
+ */
+ RecipeMap<?> getRecipeMap();
+
+ /**
+ * @return ItemStack form of this machine.
+ */
+ ItemStack getStackForm(long amount);
+
+ /**
+ * If the machine supports multiple recipemaps by switching mode, override this method so that it will be displayed
+ * as NEI recipe catalyst on all the supported recipemaps.
+ *
+ * @return List of possible {@link RecipeMap}s this machine can execute. Must not contain null element.
+ */
+ @Nonnull
+ default Collection<RecipeMap<?>> getAvailableRecipeMaps() {
+ RecipeMap<?> recipeMap = getRecipeMap();
+ if (recipeMap != null) {
+ return Collections.singletonList(recipeMap);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @return Priority for NEI recipe catalyst. Higher priority comes first.
+ */
+ default int getRecipeCatalystPriority() {
+ return 0;
+ }
+}