package shadersmod.transform;

import static shadersmod.transform.Names.*;

import java.util.ArrayList;

import shadersmod.transform.Names.Clas;
import shadersmod.transform.Names.Fiel;
import shadersmod.transform.Names.Meth;

public class Namer {

	ArrayList<Clas> ac = new ArrayList();
	ArrayList<Fiel> af = new ArrayList();
	ArrayList<Meth> am = new ArrayList();

	Clas c(String name) {
		Clas x = new Clas(name);
		if (ac!=null) ac.add(x);
		return x;
	}
	Fiel f(Clas clas, String name, String desc) {
		Fiel x = new Fiel(clas, name, desc);
		if (af!=null) af.add(x);
		return x;
	}
	Fiel fd(Clas clas, Fiel fiel) {
		Fiel x = new Fiel(clas, fiel.name, fiel.desc);
		return x;
	}
	Meth m(Clas clas, String name, String desc) {
		Meth x = new Meth(clas, name, desc);
		if (am!=null) am.add(x);
		return x;
	}
	Meth md(Clas clas, Meth meth) {
		Meth x = new Meth(clas, meth.name, meth.desc);
		return x;
	}
	
	public void setNames() {
		beginSetNames();
		setNamesCC();
		setNamesCO();
		setNamesCD();
		setNamesFC();
		setNamesMC();
		setNamesFO();
		setNamesMO();
		rename();
		setNamesFD();
		setNamesMD();
		endSetNames();
	}
	
	public void beginSetNames() {
	}
	public void rename() {
	}
	public void endSetNames() {
	}
	
	public void setNamesCC() {
		ofConnectedTextures_ = new Clas("net/minecraft/src/ConnectedTextures"); // OptiFine
		ofReflector_ = new Clas("net/minecraft/src/Reflector"); // OptiFine
		forgeHooksClient_ = new Clas("net/minecraftforge/client/ForgeHooksClient"); // Forge
		forgeAttributes_ = new Clas("net/minecraftforge/client/model/Attributes");
	}
	
	public void setNamesCO() {
	}
	
	public void setNamesCD() {
	}
	
	public void setNamesFC() {
		// non-obfuscated fields
		vertexBuffer_sVertexBuffer   = new Fiel(vertexBuffer_, "sVertexBuffer", sVertexBuffer_.desc);
		vertexFormat_tangentElementOffset = new Fiel(vertexFormat_, "tangentElementOffset", "I");
		vertexFormat_entityElementOffset = new Fiel(vertexFormat_, "entityElementOffset", "I");
		vertexFormat_miduvElementOffset = new Fiel(vertexFormat_, "miduvElementOffset", "I");
		
		abstractTexture_multiTex     = new Fiel(abstractTexture_, "multiTex", multiTexID_.desc);
		textureMap_atlasWidth        = new Fiel(textureMap_, "atlasWidth", "I");
		textureMap_atlasHeight       = new Fiel(textureMap_, "atlasWidth", "I");
		forgeAttributes_defBakedFormat  = new Fiel(forgeAttributes_,"DEFAULT_BAKED_FORMAT",vertexFormat_.desc);
	}
	
	public void setNamesFO() {
	}
	
	public void setNamesFD() {
		// derived fields
		guiOptions_buttonList = fd(guiOptions_,guiScreen_buttonList);
		guiOptions_width      = fd(guiOptions_,guiScreen_width);
		guiOptions_height     = fd(guiOptions_,guiScreen_height);
		guiOptions_mc         = fd(guiOptions_,guiScreen_mc);
		bakedQuadRetextured_vertexData = fd(bakedQuadRetextured_,bakedQuad_vertexData);
	}
	
	public void setNamesMC() {
		// non-obfuscated method
		modelRenderer_resetDisplayList  = new Meth(modelRenderer_, "resetDisplayList", "()V");
		iTextureObject_getMultiTexID    = new Meth(iTextureObject_, "getMultiTexID", "()"+multiTexID_.desc);
		forgeHooksClient_setRenderPass  = new Meth(forgeHooksClient_,"setRenderPass","(I)V");
		forgeAttributes_clinit          = new Meth(forgeAttributes_,"<clinit>","()V");
		faceBakery_makeQuadVertexDataForge  = new Meth(faceBakery_,"makeQuadVertexData","("+blockPartFace_.desc+""+textureAtlasSpri_.desc+""+enumFacing_.desc+"[F"+"Lnet/minecraftforge/client/model/ITransformation;"+blockPartRotation_.desc+"ZZ)[I");
		//sVertexFormat_setDefBakedFormat = new Meth(sVertexFormat_,"setDefBakedFormat","("+vertexFormat_.desc+")V");
		sVertexFormat_onAddElement      = new Meth(sVertexFormat_,"onAddElement","("+vertexFormat_.desc+vertexFormatElement_.desc+")V");
		sVertexFormat_onDefaultVertexFormatsClinit = new Meth(sVertexFormat_,"onDefaultVertexFormatsClinit","()V");
		sBakedQuad_onMakeQuadData       = new Meth(sBakedQuad_,"onMakeQuadData","([I)[I");
		sBakedQuad_onRemapQuad          = new Meth(sBakedQuad_,"onRemapQuad","([I)V");
		sVertexBuffer_enableCalcNormal  = new Meth(sVertexBuffer_,"enableCalcNormal","("+vertexBuffer_.desc+")V");
		sTexturedQuad_draw              = new Meth(sTexturedQuad_,"draw","("+texturedQuad_.desc+vertexBuffer_.desc+"F)V");
		// init
		vertexFormatElement_init       = new Meth(vertexFormatElement_,"<init>","(I"+vertexFormatElementEnumType_.desc+vertexFormatElementEnumUsage_.desc+"I)V");
		sVertexElement_init            = new Meth(sVertexElement_,"<init>","(I"+vertexFormatElementEnumType_.desc+vertexFormatElementEnumUsage_.desc+"I)V");
		vertexFormat_init_vertexFormat = new Meth(vertexFormat_,"<init>","("+vertexFormat_.desc+")V");
		chunkRenderDispatcher_init = new Meth(chunkRenderDispatcher_,"<init>","()V");
		regionRenderCacheBuilder_init = new Meth(regionRenderCacheBuilder_,"<init>","()V");
		vertexBufferDrawer_init    = new Meth(vertexBufferDrawer_,"<init>","()V");
		sVertexBufferDrawer_init   = new Meth(sVertexBufferDrawer_, "<init>", "()V");
		sVertexBufferDrawerChunk_init   = new Meth(sVertexBufferDrawerChunk_, "<init>", "()V");
	}
	
	public void setNamesMO() {
	}
	
	public void setNamesMD() {
		// derived and overriding methods
		guiOptions_initGui                 = md(guiOptions_      ,guiScreen_initGui);
		guiVideoSettings_initGui           = md(guiVideoSettings_,guiScreen_initGui);
		frustrum_setPosition  = md(frustum_,iCamera_setPosition);
		worldClient_getCelestialAngle = md(worldClient_,world_getCelestialAngle);
		worldClient_getRainStrength   = md(worldClient_,world_getRainStrength);
	}
}
