package gregtech.api.metatileentity;
import static gregtech.api.enums.GT_Values.V;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.util.AECableType;
import appeng.me.helpers.AENetworkProxy;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;
import gregtech.api.GregTech_API;
import gregtech.api.enums.SoundResource;
import gregtech.api.interfaces.metatileentity.IConfigurationCircuitSupport;
import gregtech.api.interfaces.metatileentity.IMachineCallback;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
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.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
* Extend this Class to add a new MetaMachine
* Call the Constructor with the desired ID at the load-phase (not preload and also not postload!)
* Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
* <p/>
* Call the Constructor like the following example inside the Load Phase, to register it.
* "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
*/
@SuppressWarnings("unused")
public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallback<MetaTileEntity> {
/**
* Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
*/
public final String mName;
/**
* The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO!
*/
public final ItemStack[] mInventory;
public boolean doTickProfilingInThisTick = true;
private MetaTileEntity mCallBackTile;
/**
* accessibility to this Field is no longer given, see below
*/
private IGregTechTileEntity mBaseMetaTileEntity;
public long mSoundRequests = 0;
/**
* This registers your Machine at the List.
* Use only ID's larger than 2048, because i reserved these ones.
* See also the List in the API, as it has a Description containing all the reservations.
*
* @param aID the ID
* @example for Constructor overload.
* <p/>
* public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) {
* super(aID, mName, mNameRegional);
* }
*/
public MetaTileEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted)
throw new IllegalAccessError("This Constructor has to be called in the load Phase");
if (GregTech_API.METATILEENTITIES[aID] == null) {
GregTech_API.METATILEENTITIES[aID] = this;
} else {
throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!");
}
mName = aBasicName.replace(" ",