package gregtech.api.metatileentity;
import static gregtech.api.enums.GT_Values.GT;
import static gregtech.api.enums.GT_Values.V;
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.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IColoredTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
import gregtech.common.GT_Client;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
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 MetaPipe
* 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");"
*/
public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
/**
* The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO!
*/
public final ItemStack[] mInventory;
/**
* This variable tells, which directions the Block is connected to. It is a Bitmask.
*/
public byte mConnections = 0;
protected boolean mCheckConnections = false;
/**
* Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
*/
public String mName;
public boolean doTickProfilingInThisTick = true;
/**
* accessibility to this Field is no longer given, see below
*/
private IGregTechTileEntity mBaseMetaTileEntity;
/**
* 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 MetaPipeEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
this(aID, aBasicName, aRegionalName, aInvSlotCount, true);
}
public MetaPipeEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount, boolean aAddInfo) {
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.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH);
setBaseMetaTileEntity(new BaseMetaPipeEntity());
getBaseMetaTileEntity().setMetaTileID((short) aID);
GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName);
mInventory = new ItemStack[aInvSlotCount];
if (aAddInfo && GT.isClientSide()) {
addInfo(aID);
}
}
protected final void addInfo(int aID) {
if (!GT.isClientSide()) return;
ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID);
tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true);
}
/**
* This is the normal Constructor.
*/
public MetaPipeEntity(String aName, int aInvSlotCount) {
mInventory = new ItemStack[aInvSlotCount];
mName = aName;
}
/**
* For Pipe Rendering
*/
public abstract float getThickNess();
/**
* For Pipe Rendering
*/
public abstract boolean renderInside(byte aSide);
public boolean isDisplaySecondaryDescription() {