Jump to content

[1.8] Aligning cuztome info gui to the bottom left Corner of waw


perromercenary00

Recommended Posts

good days

little hard to explain english is not mi native languague

 

 

in the past i create a custom gui not like the one that come when you open a chest but the kind that is always visible in screen this

to show the gun munition and stats, it suppost to allways stay in to the botom left corner no mather the value of  int guiscale=mc.gameSettings.guiScale; was

 

but no luck  minecraft is not just using this values and must be another elements afecting the final positition of the mi gui resulting in missplace

 

3 values im using to position mi gui are

 

                                guiscale=mc.gameSettings.guiScale;

                displayWidth=mc.displayWidth;

                displayHeight=mc.displayHeight;

width and height are correct,  i test them agains the output of xwininfo in linux

 

 

here a little example for testing i set mi gui to draw allways starting at 10% of displayWidth  and 10% of displayHeight

 

        posX=(int)(displayHeight * 0.1); // gui X position

                posY=(int)(displayWidth * 0.1);  // gui Y position

 

so it must allways stay on upper left corner but the result is far from upper left must of the time and is afected more than espected by windows size and guiscale

https://drive.google.com/file/d/0B8sU_NyZQBd7bFVId0lyaDNTNUE/view?usp=sharing

view?usp=sharing

 

https://drive.google.com/file/d/0B8sU_NyZQBd7OHR2SmV4bXBRb3M/view?usp=sharing

view?usp=sharing

 

the closest to expected is when guiscale = 1

 

//#####

i remenber this from long old topic i dont find but that time and i could not solvet it that time

 

when i solved this i gona use this to set the position of butons also missplaced in another gui but for a bag pack   

 

 

can you help mi hwith this

 

thanks for reading

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

package mercenarymod.gui;

import mercenarymod.Mercenary;
import mercenarymod.items.MercenaryModItems;
import mercenarymod.utilidades.chat;
import mercenarymod.utilidades.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;

public class NotificationMercenaria extends Gui {
private static Minecraft mc;
private int posX = 0, posY = 0, mulY = -1;

private int displayWidth = 0;
private int displayHeight = 0;

private int guiscale = 0;
private int x = 0; // gui size
private float xf = x + 0.0F;
private float balas = 0;
private int tipoBalas = 0;

private static long systemTime = 0;
private static int graficaltick = 0; // conteo para sincronizar las
										// animaciones con el mundo local
private static int conteo = 0; // conteo para llevar los tiempos en que se
								// actualiza la gui
private static int conteo100 = 0; // conteo para ciclar las texturas en los
									// items
private static int conteo200 = 0; // conteo para ciclar las texturas en los
									// items

private static int vlmunicion = 0; // conteo para llevar la cuenta del
									// consumo de redstone
private static boolean permitirVlmunicion = true; // conteo para evitar que
													// vlmunicion cuente mas
													// de una vez por tick

private static int lconteo = 0; // conteo para llevar el tiempo que se
								// presion click izquierdo
private static int rconteo = 0; // conteo para llevar el tiempo que se
								// presion click izquierdo

private static int mensage00 = 0;

private static boolean permitirLdisparo2s = true; // conteo para evitar que
													// se dispare mas de una
													// granada en 2 seg
private int permitirLdisparo2sConteo = 0;// conteo para la variable anterior

private static boolean permitirSonido = true; // conteo para evitar que el
												// mismo sonido se ejecute
												// mas de una vez por tick
private static boolean permitirMensaje = true;

private String icono0 = "modmercenario:textures/items/gui/transparencia.png";// transparencia
private String icono1 = "modmercenario:textures/items/gui/transparencia.png";// transparencia
private String icono2 = "modmercenario:textures/items/gui/transparencia.png";// transparencia
private String icono3 = "modmercenario:textures/items/gui/transparencia.png";// transparencia
private String icono4 = "modmercenario:textures/items/gui/transparencia.png";// transparencia
private String icono5 = "modmercenario:textures/items/gui/transparencia.png";// transparencia

boolean transparencia = true;

private int metadata = 0;
private int municion = 0;
private int municionmaxima = 0;
private int municiondisponible = 0;
private int tipomunicion = 0;
private int tipomunicionDisplay = 0;
private int tipocargador = 0;
private int tipocargadormax = 0;

private int tipodisparo = 0;
private int tipodisparomax = 0;

private boolean habilitado = false;
private boolean recargando = false;

private boolean descargar = false;
private boolean descargando = false;
private boolean remplazando = false;

private boolean reload = false;
private boolean cargar = false;
private boolean shoot = false;
private boolean unload = false;
private float strength = 0.0F;
private boolean enable = false;

private static int texturajson = 0;
private static int accion = 0;

private String text0 = "";

public NotificationMercenaria(Minecraft mc, Configuration config) {
	super();
	this.mc = mc;

	displayWidth = mc.displayWidth;
	displayHeight = mc.displayHeight;

	x = 40; // gui size

}

// ####################################################################################################################3
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRender(RenderGameOverlayEvent event) {
	// Render above the chat
	if (event.isCancelable() || event.type != RenderGameOverlayEvent.ElementType.ALL)
		return;
	// Render only if there's a new notification
	// if (step == -1) return;

	conteo++;

	if ((conteo % 20) == 0 & Mercenary.getGuiOn()) {
		int modo = 0;



		EntityPlayer playerIn = mc.thePlayer;
		int hand = playerIn.inventory.currentItem;
		ItemStack stack0 = playerIn.inventory.getCurrentItem();

		icono0 = "modmercenario:textures/items/gui/transparencia.png";
		icono1 = "modmercenario:textures/items/gui/transparencia.png";
		icono2 = "modmercenario:textures/items/gui/transparencia.png";
		icono3 = "modmercenario:textures/items/gui/transparencia.png";
		icono4 = "modmercenario:textures/items/gui/transparencia.png";
		icono5 = "modmercenario:textures/items/gui/transparencia.png";
		text0 = "";
		tipomunicionDisplay = 0;


            metadata = stack0.getMetadata();
            municion = getInttag(stack0, "municion");
            municionmaxima =getInttag(stack0, "municionmaxima");
            municiondisponible=getInttag(stack0, "municiondisponible");
            tipomunicion=getInttag(stack0, "tipomunicion");
            tipocargador=getInttag(stack0, "tipocargador");
            tipocargadormax=getInttag(stack0, "tipocargadormax");

    		tipodisparo=getInttag(stack0, "tipodisparo");
	    	tipodisparomax=getInttag(stack0, "tipodisparomax");

		    reload= getBooleantag(stack0, "reload");
		    cargar= getBooleantag(stack0, "cargar");
		    shoot= getBooleantag(stack0, "shoot");
		    unload= getBooleantag(stack0, "unload");
		    strength=getFloattag(stack0, "strength");
		    enable= getBooleantag(stack0, "enable");
        
		    habilitado= getBooleantag(stack0, "habilitado");
		    recargando= getBooleantag(stack0, "recargando");
		    descargar= getBooleantag(stack0, "descargar");
		    descargando= getBooleantag(stack0, "descargando");
		    remplazando= getBooleantag(stack0, "remplazando");
		    
		    int lmunicion = getInttag(stack0, "lmunicion");
		    int ltipomunicion=getInttag(stack0, "ltipomunicion");


		if (stack0 != null) {
			Item item0 = stack0.getItem();
			boolean transparencia = true;

			NBTTagCompound etiquetas = stack0.getTagCompound();
			if (etiquetas != null) { // nbt
				// boolean ex=etiquetas.getBoolean(tag);

				// System.out.println("item0="+item0.getUnlocalizedName());

				if (unload) {
					modo = 1;
				}

				if (tipocargador <= 0) {
					modo = 2;
				}

				// ########################
				if (item0.equals(MercenaryModItems.cargador45acp)) {

					switch (tipomunicion) {
					case 0:
						icono5 = "modmercenario:textures/items/gui/transparencia.png";
						break;
					case 1:
						icono5 = "modmercenario:textures/items/gui/A.png";
						break;
					case 2:
						icono5 = "modmercenario:textures/items/gui/R.png";
						break;
					case 3:
						icono5 = "modmercenario:textures/items/gui/O.png";
						break;
					}

					switch (tipocargador) {
					case 1:
						icono0 = "modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CC_icono.png";
						break;
					case 2:
						icono0 = "modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CL_icono.png";
						break;
					case 3:
						icono0 = "modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CG_icono.png";
						break;
					}

					if (descargar | descargando) {
						switch (tipocargador) {
						case 1:
							icono0 = "modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CC_iconoInv.png";
							break;
						case 2:
							icono0 = "modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CL_iconoInv.png";
							break;
						case 3:
							icono0 = "modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CG_iconoInv.png";
							break;
						}
						// icono4="modmercenario:textures/items/gui/transparencia.png";
						// icono5="modmercenario:textures/items/gui/transparencia.png";
					}

					switch (tipomunicion) {
					case 1:
						tipomunicionDisplay = 8;
						break;
					case 2:
						tipomunicionDisplay = 9;
						break;
					case 3:
						tipomunicionDisplay = 10;
						break;
					}

					text0 = "" + municion + " / " + municionmaxima;
					transparencia = false;

					switch (tipomunicion) {
					case 1:
						icono1 = "modmercenario:textures/items/gui/botones_ARO_A.png";
						break;
					case 2:
						icono1 = "modmercenario:textures/items/gui/botones_ARO_R.png";
						break;
					case 3:
						icono1 = "modmercenario:textures/items/gui/botones_ARO_O.png";
						break;
					}

					icono3 = "modmercenario:textures/items/gui/botones.png";

				}

				// ########################
				if ((item0.equals(MercenaryModItems.pistolaSocom))
						| (item0.equals(MercenaryModItems.pistolaSocomS))) {
					switch (tipomunicion) {
					case 0:
						icono5 = "modmercenario:textures/items/gui/transparencia.png";
						break;
					case 1:
						icono5 = "modmercenario:textures/items/gui/A.png";
						break;
					case 2:
						icono5 = "modmercenario:textures/items/gui/R.png";
						break;
					case 3:
						icono5 = "modmercenario:textures/items/gui/O.png";
						break;
					}

					icono0 = "modmercenario:textures/items/armasdefuego/armas45cal/socom_icono.png";

					if (recargando | descargando | remplazando) {
						icono0 = "modmercenario:textures/items/armasdefuego/armas45cal/socom_iconoInv.png";
						icono4 = "modmercenario:textures/items/gui/transparencia.png";
						icono5 = "modmercenario:textures/items/gui/transparencia.png";
					}

					transparencia = false;
					text0 = "" + municion + "/" + municionmaxima;

					switch (tipodisparo) {
					case 2:
						icono1 = "modmercenario:textures/items/gui/auto.png";
						break;
					case 0:
						icono1 = "modmercenario:textures/items/gui/manual.png";
						break;
					case 1:
						icono1 = "modmercenario:textures/items/gui/semiAuto.png";
						break;
					}

					// icono1="modmercenario:textures/items/gui/manualO.png";
					icono3 = "modmercenario:textures/items/gui/botonesAsterisco.png";

					switch (tipomunicion) {
					case 1:
						tipomunicionDisplay = 8;
						break;
					case 2:
						tipomunicionDisplay = 9;
						break;
					case 3:
						tipomunicionDisplay = 10;
						break;
					}

				}

				// ##########################################################################################

			} // nbttag
		} // (stack0 != null)

		displayWidth = mc.displayWidth;
		displayHeight = mc.displayHeight;
		guiscale = mc.gameSettings.guiScale;

		System.out.println("guiscale=" + guiscale);
		System.out.println("displayWidth=" + displayWidth);
		System.out.println("displayHeight=" + displayHeight);
		System.out.println("displayHeight=(" + (displayHeight / 2) + ")");

		System.out.println("\n\n\n");


		switch (guiscale) {
		case 0: // mid
		{
			posX = 30; // controls the gui size
			posY = (displayHeight / 2);// -60 (displayHeight - 120);
			x = 40; // gui size
		}
			;
			break;

		case 3: // grande
		{
			posX = 16; // controls the gui size
			posY = ((int) (displayHeight * 0.25F));
			x = 40; // gui size
		}
			;
			break;

		case 2: // mid
		{
			posX = (int) (displayHeight * 0.1); // 30; //controls the gui
												// size
			posY = (int) (displayWidth * 0.1); // (displayHeight - 120);
			x = 40; // gui size
		}
			;
			break;

		case 1: // little
		{
			posX = 16; // controls the gui size
			posY = (int) (displayHeight * 0.95F); // ((displayHeight)-100);
			x = 10; // gui size
		}
			;
			break;
		/*
		 * guiscale=1 displayWidth=1680 displayHeight=970
		 * displayHeight=(850)
		 */

		}

################################################
################################################
################################################
################################################


//here is where im seting the gui position


		posX = (int) (displayHeight * 0.1); // controls the gui X position
		posY = (int) (displayWidth * 0.1); // controls the gui Y position
		x = 40; // gui size

		switch (tipomunicionDisplay) {
		case 0:
			icono2 = "modmercenario:textures/items/gui/transparencia.png";
			break;
		case 1:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraRedStone.png";
			break;

		case 2:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraBala9mmA.png";
			break;
		case 3:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraBala9mmR.png";
			break;
		case 4:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraBala9mmO.png";
			break;

		case 5:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_acero.png";
			break;
		case 6:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_redstone.png";
			break;
		case 7:
			icono2 = "modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_obsidiana.png";
			break;

		}

		// el ancho de la barra al que equivale cada unidad de municion
		switch (tipomunicionDisplay) {
		default:
			balas = 32.0F;
			break;
		case 1:
			balas = 256.0F;
			break;
		case 8:
		case 9:
		case 10:
		case 11:
		case 12:
		case 13:
		case 17:
		case 18:
		case 19:
			balas = 16.0F;
			break;
		}

		xf = x + 0.0F;

	} // ( (conteo%20)==0 )

	// Prepare rendering
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glDisable(GL11.GL_LIGHTING);

	if (municion < 0) {
		municion = 0;
	}

	if (Mercenary.getGuiOn()) {

		// drawModalRectWithCustomSizedtexture(int x, int y,float u,float
		// v,int width,int height,float textureWidth,float textureHeight);

		this.mc.renderEngine.bindTexture(new ResourceLocation(icono0));
		this.drawModalRectWithCustomSizedTexture((posX - 5), (posY), 0.0F, 0.0F, x, x, xf, xf); // imagen
																								// al
																								// 60%
		// this.drawModalRectWithCustomSizedtexture(posX + 8, posY + 8,
		// 0.0F, 0.0F, 200, 200 , 200.0F, 200.0F);

		this.mc.renderEngine.bindTexture(new ResourceLocation(icono1));
		this.drawModalRectWithCustomSizedTexture((posX + x), (posY), 0.0F, 0.0F, (int) (x * 1.5), (x / 3),
				(xf * 1.5F), (xf / 3)); // imagen al 60%

		this.mc.renderEngine.bindTexture(new ResourceLocation(icono2));
		this.drawModalRectWithCustomSizedTexture((posX + x), (posY + (x / 3)), 0.0F, 0.0F,
				(int) (((x * 1.0) / balas) * municion), (x / 3), (xf * 1.0F), (xf / 3));

		this.mc.renderEngine.bindTexture(new ResourceLocation(icono3));
		this.drawModalRectWithCustomSizedTexture((posX + x), (posY + ((x / 3) * 2)), 0.0F, 0.0F, (int) (x * 1.5),
				(x / 3), (xf * 1.5F), (xf / 3));

		this.mc.renderEngine.bindTexture(new ResourceLocation(icono4));
		this.drawModalRectWithCustomSizedTexture((posX - 5), (posY), 0.0F, 0.0F, x, x / 2, xf, xf / 2); // imagen
																										// al
																										// 60%

		this.mc.renderEngine.bindTexture(new ResourceLocation(icono5));
		this.drawModalRectWithCustomSizedTexture((posX - 5), (posY + (x / 2)), 0.0F, 0.0F, x, x / 2, xf, xf / 2); // imagen
																													// al
																													// 60%

		this.mc.fontRendererObj.drawStringWithShadow(text0, posX, ((posY) + x), 0xffcccccc);
		// this.mc.fontRendererObj.drawStringWithShadow(text0, posX + 32 +
		// 8, posX + 8, 0xffcccccc);

	}

}
// ####################################################################################################################3

// ####################################################################################################################3
}// fin de la classe

           

Link to comment
Share on other sites

I don't see a problem with what you are doing:

 

posX=(int)(displayHeight * 0.1)

 

I am doing the same in a mod I am currently working on to do percentage layouts as well.

 

Have you tried writing the positions to the log along with the screen width values?  What does it say when the position appears wrong on the screen for:

 

1. The position of your gui element

2. The width of the screen

Link to comment
Share on other sites

 

well  i actually leave this in a  (deje así)  state

and work arounded using the things i learn whith the questions in this other post

http://www.minecraftforge.net/forum/index.php/topic,35931.0.html

 

 

#####

Have you tried writing the positions to the log along with the screen width values?  What does it say when the position appears wrong on the screen for:

 

1. The position of your gui element

2. The width of the screen

#####

 

yes but i want the gui to keep aligned whith corner all the time, when windowed when maximaxed or when full screen

 

hand coded the closest values to what i want are the ones from

            switch(guiscale)
            {
            case 0: 
            {
            	posX=10; 
                posY= 200;
                //x=30;  
            } ;break;
            
            case 3:
            {
            	posX=10;//( (int) (displayWidth  * 0.025F) ); //30 controls the gui size
                posY=( (int) (displayHeight * 0.30F) );
                //x=40;  //gui size    
            } ;break;
            
            case 2:
            {
            	posX=10;//( (int) (displayWidth  * 0.025F) ); //30 controls the gui size
                posY=( (int) (displayHeight * 0.45F) );
                //x=40;  //gui size    
            } ;break;
            
            case 1:
            {
            	posX=10;//( (int) (displayWidth  * 0.05F) ); //16; //controls the gui size
                posY=( (int)(displayHeight * 0.92F));
                //x=40;  //gui size    
            } ;break;
            
            
            }

 

but if you changes whindows mode or size the gui some times to ends to much up, some times half out of the botom

 

for what i learn scavenguin the code from other moders 

i theorized than for this case and only this gui type, minecraft internally is using his own values to set

the elements in the window totally ignoring the values from displayWidth and displayHeight

 

a bether try to explain this

i put some buttons in another gui to manually move the guns gui position 

and whit this buttons move the gui to the upper right corner soo i could know the trully values of height and width

and looks like

 

width=800 height=500http://s11.postimg.org/65jvxnedv/Pantallazo_25.png[/img]

 

defaults windowed at 854x480

when: guiscale=0 

displayWidth=854

displayHeight=480   

 

posX=415

posY=238

 

the truly window size is like 420 x 240

 

 

set guiscale to 1 the gui is now in middle so manully set it again to upper right

when: guiscale=1

displayWidth=854

displayHeight=480   

 

posX=845

posY=458

 

when: guiscale=1 the true size is like 460 x 480  but the real windows size has not change still at 854x480

 

now whithout changing nothing i maximaxed the window

and mi gui goes to the center again and whoa the numbers change again

 

guiscale=1

displayWidth=1680

displayHeight=970

 

posX=928  //i supouse thiis diferent coz the posX= ( (int) (displayWidth  * 0.1F) );

posY=507

 

so i manually move the gui to bottom right again

posX=1668

posY=957

 

and now looks like the real value is the same as displayWidth and displayHeight

 

 

 

###

Well the is no patron here the real internal size width height  values are diferent from the one i get

from displayWidth displayHeight

and values are afected by the guiscale value and the real window size and mode

 

in the other type of gui the one we use to make the chest like guis take this values from the gui class

 

    /** The width of the screen object. */

    public int width;

    /** The height of the screen object. */

    public int height;

 

but when i call this values from mi gun gui this returns allways zeros and mi gui class is extending GuiScreen and that one is  extends Gui

 

 

public class NotificationMercenaria extends GuiScreen // Gui

 

            System.out.println("this.width ="+this.width);

            System.out.println("this.height="+this.height);

 

returns

[10:44:12][mercenarymod.gui.NotificationMercenaria:onRender:1963]: this.width =0

[10:44:12][mercenarymod.gui.NotificationMercenaria:onRender:1964]: this.height=0

 

well i also change mi class to extends Gui but no look it still returns zeroes

public class NotificationMercenaria extends Gui

 

jummmmm

 

well i alredy leave this issue in (deje así) state I just set some buttons for the user to manually set gui position to wherever he/her/it wants

 

but it would be nine to know how to get the internal windows size values are

 

############

 

well this has become to long

 

 

this is testing code in mi gui class

            displayWidth=mc.displayWidth;
            displayHeight=mc.displayHeight;
            guiscale=mc.gameSettings.guiScale;            
                      
            System.out.println("guiscale="+guiscale);
            System.out.println("displayWidth="+displayWidth);
            System.out.println("displayHeight="+displayHeight);
            
            posX= ( (int) (displayWidth  * 0.1F) );
            posY= ( (int) (displayHeight * 0.1F) );
            
            //Offset added for the gui whit the buttons
            posX = posX + ppx;
            posY = posY + ppy;
            
            System.out.println("posX="+posX );
            System.out.println("posY="+posY );
            
            System.out.println("\n\n\n" ); 

 

 

console output

[10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:1952]: guiscale=0
[10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:1953]: displayWidth=854
[10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:1954]: displayHeight=480
[10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:2006]: posX=415
[10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:2007]: posY=238

 

 

 

and this is the full guns gui class

 

thanks fro reading

 

ther is other things in this class but relevant code come from the 1890 line

package mercenarymod.gui;

import mercenarymod.Mercenary;
import mercenarymod.items.MercenaryModItems;
import mercenarymod.utilidades.chat;
import mercenarymod.utilidades.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Color;
import org.lwjgl.util.ReadableColor;

public class NotificationMercenaria extends GuiScreen // Gui
{
    private static Minecraft mc;
    private static int posX=0;
private static int posY=0;
private int mulY=-1;
    
    private int displayWidth=0;
    private int displayHeight=0;
    
    public static int ppx=0;
    public static int ppy=0;
    
    private static int guiTick = 0;
    
    
    private int guiscale=0;
    public static int x=30;  //gui size
    private static float xf=x+0.0F; 
    private float balas=0;
    private int tipoBalas=0;
    
    private static long systemTime=0;
    private static int graficaltick=0; //conteo para sincronizar las animaciones con el mundo local 
    private static int conteo=0;  //conteo para llevar los tiempos en que se actualiza la gui
    private static int conteo100=0; //conteo para ciclar las texturas en los items
    private static int conteo200=0; //conteo para ciclar las texturas en los items
    
    private static int vlmunicion=0; //conteo para llevar la cuenta del consumo de redstone
    private static boolean permitirVlmunicion=true; //conteo para evitar que vlmunicion cuente mas de una vez por tick
    
    private static int lconteo=0;  //conteo para llevar el tiempo que se presion click izquierdo
    private static int rconteo=0;  //conteo para llevar el tiempo que se presion click izquierdo
    
    private static int mensage00=0;
    
    private static boolean permitirLdisparo2s =true; //conteo para evitar que se dispare mas de una granada en 2 seg 
    private int permitirLdisparo2sConteo=0;//conteo para la variable anterior
    
    private static boolean permitirSonido=true; //conteo para evitar que el mismo sonido se ejecute mas de una vez por tick 
    private static boolean permitirMensaje=true;
    
    private String icono0="modmercenario:textures/items/gui/transparencia.png";//transparencia
    private String icono1="modmercenario:textures/items/gui/transparencia.png";//transparencia
    private String icono2="modmercenario:textures/items/gui/transparencia.png";//transparencia
    private String icono3="modmercenario:textures/items/gui/transparencia.png";//transparencia
    private String icono4="modmercenario:textures/items/gui/transparencia.png";//transparencia
    private String icono5="modmercenario:textures/items/gui/transparencia.png";//transparencia
    
    
    boolean transparencia=true;
    
    private int metadata=0;
    private int municion =0;
    private int municionmaxima =0;
    private int municiondisponible=0;
    private int tipomunicion=0;
    private int tipomunicionDisplay=0;
    private int tipocargador=0;
    private int tipocargadormax=0;

    private int tipodisparo=0;
    private int tipodisparomax=0;
  

private boolean habilitado=false;
    private boolean recargando=false;
    
    private boolean descargar=false;
    private boolean descargando=false;
    private boolean remplazando=false;

    private boolean reload=false;
    private boolean cargar=false;
    private boolean shoot=false;
    private boolean unload=false;
    private float strength=0.0F;
    private boolean enable=false;
    
    private static int texturajson = 0;
    private static int accion = 0;
    
    private String text0 = "";
    
    private static Configuration configFile;
    
    
    public NotificationMercenaria(Minecraft mc) 
    {
        super();
        this.mc = mc;
        
        
        this.configFile = Mercenary.getConfigFile();
        
        
        if (configFile != null){

	Property cfg_guiX = configFile.get("Gui", "Gui pos X", 0, "posicion x de la gui");
	Property cfg_guiY = configFile.get("Gui", "Gui pos Y", 0, "posicion y de la gui");
	Property cfg_guiSize = configFile.get("Gui", "Gui Size", 30, "Tamaño de la gui");

	// saving the configuration to its file
        //configFile.save();

	ppx = cfg_guiX.getInt(0);
	ppy = cfg_guiY.getInt(0);
	x = cfg_guiSize.getInt(30);
        }
        
        
    }
//####################################################################################################################3
    @SubscribeEvent(priority = EventPriority.NORMAL)
    public void onRender(RenderGameOverlayEvent event) 
    {
    	//Render above the chat
        if(event.isCancelable() || event.type != RenderGameOverlayEvent.ElementType.ALL) return;
        //Render only if there's a new notification
        //if (step == -1) return;

    	
        conteo++;
        
        
        if ( (conteo % 30)==0 )
        {
        	permitirMensaje = true;
        }
        
        if ( (conteo%4)==0 )//systemTime
        {
           	conteo100 ++;
           	graficaltick ++;
           	
        	permitirSonido=true;
        	permitirVlmunicion=true;

        	
        	if (Mouse.isButtonDown(0) & (Minecraft.getMinecraft().currentScreen == null) )
        	{
        		lconteo +=4;
        	}
        	else
        	{
        		lconteo= 0 ;
        	}	
        	
        	if (Mouse.isButtonDown(1) & (Minecraft.getMinecraft().currentScreen == null) )
        	{
        		rconteo +=4;
        	}
        	else
        	{
        		rconteo= 0 ;
        	}	
        	
        	
        }
        
        
        if(!permitirLdisparo2s){
        
        	permitirLdisparo2sConteo ++;	
        	
        	if (permitirLdisparo2sConteo > 10 ){
        		permitirLdisparo2sConteo=0;
        		permitirLdisparo2s=true;
            }
        
        }
        
    
        
        
        
        if ( (conteo%20)==0 & Mercenary.getGuiOn() )
        {
        int modo=0;
        
        	if (conteo > 20000)
        	{
        		conteo=0;
        	}
        	
          	if (guiTick > 0)
        	{
        		guiTick--;
        	}

  
        	//tckin para controlar las animaciones
        	if (conteo100 > 20000)
        	{
        	conteo100=0;
        	}
        
        
        EntityPlayer playerIn=mc.thePlayer;
        int         hand = playerIn.inventory.currentItem;
        ItemStack stack0 = playerIn.inventory.getCurrentItem();
        
    	icono0="modmercenario:textures/items/gui/transparencia.png";
    	icono1="modmercenario:textures/items/gui/transparencia.png";
    	icono2="modmercenario:textures/items/gui/transparencia.png";
    	icono3="modmercenario:textures/items/gui/transparencia.png";
    	icono4="modmercenario:textures/items/gui/transparencia.png";
    	icono5="modmercenario:textures/items/gui/transparencia.png";
    	text0="";
    	tipomunicionDisplay=0;	

        
            if (stack0 != null )
            {
       	    Item       item0 = stack0.getItem();
            boolean transparencia=true;
            
                      	
            	NBTTagCompound etiquetas = stack0.getTagCompound();
            	if (etiquetas != null)
            	{   
         
            
            metadata = stack0.getMetadata();
            municion = getInttag(stack0, "municion");
            municionmaxima =getInttag(stack0, "municionmaxima");
            municiondisponible=getInttag(stack0, "municiondisponible");
            tipomunicion=getInttag(stack0, "tipomunicion");
            tipocargador=getInttag(stack0, "tipocargador");
            tipocargadormax=getInttag(stack0, "tipocargadormax");

    		tipodisparo=getInttag(stack0, "tipodisparo");
    	tipodisparomax=getInttag(stack0, "tipodisparomax");

	    reload= getBooleantag(stack0, "reload");
	    cargar= getBooleantag(stack0, "cargar");
	    shoot= getBooleantag(stack0, "shoot");
	    unload= getBooleantag(stack0, "unload");
	    strength=getFloattag(stack0, "strength");
	    enable= getBooleantag(stack0, "enable");
        
	    habilitado= getBooleantag(stack0, "habilitado");
	    recargando= getBooleantag(stack0, "recargando");
	    descargar= getBooleantag(stack0, "descargar");
	    descargando= getBooleantag(stack0, "descargando");
	    remplazando= getBooleantag(stack0, "remplazando");
	    
	    int lmunicion = getInttag(stack0, "lmunicion");
	    int ltipomunicion=getInttag(stack0, "ltipomunicion");
	    
	        if (unload)
	        {modo=1;}
	        
	        if (tipocargador<=0)
	        {modo=2;}
	        


//########################
	        if ( item0.equals(MercenaryModItems.fusilSCARH) | item0.equals(MercenaryModItems.fusilSCARHB) | item0.equals(MercenaryModItems.fusilSCARHG) )
	        {

	        	
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/fusilscar/scarh_icono.png";
	        		
	        	if (recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/fusilscar/scarh_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}		
	        			
	        			
	        	
	        	
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
	        	icono3="modmercenario:textures/items/gui/botones.png";
	        
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=20;break;
	        	case 2:	tipomunicionDisplay=21;break;
	        	case 3:	tipomunicionDisplay=22;break;
	        	}
	        	
	        	
	        	
	        	if (item0.equals(MercenaryModItems.fusilSCARHG)){
	        		if (lmunicion > 0)
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/GA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/GR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/GO.png";break;
	        			}
	        		}	
	        		else
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/dA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/dR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/dO.png";break;
	        			}
	        		}
	        	}
	        	
	        	
	        	
	        	
	        }	
	      //########################
	        if ( item0.equals(MercenaryModItems.fusil47AK) | item0.equals(MercenaryModItems.fusil47AKB) | item0.equals(MercenaryModItems.fusil47AKG) )
	        {

	        	
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	

	        	icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil47ak_icono.png";
	        		
	        	if (recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil47ak_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}		
	        			
	        			
	        	
	        	
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
	        	icono3="modmercenario:textures/items/gui/botones.png";
	        
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=20;break;
	        	case 2:	tipomunicionDisplay=21;break;
	        	case 3:	tipomunicionDisplay=22;break;
	        	}
	        	
	        	
	        	
	        	if (item0.equals(MercenaryModItems.fusil47AKG)){
	        		if (lmunicion > 0)
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/GA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/GR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/GO.png";break;
	        			}
	        		}	
	        		else
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/dA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/dR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/dO.png";break;
	        			}
	        		}
	        	}
	        	
	        	
	        	
	        	
	        } 
	        
//########################
	        if (item0.equals(MercenaryModItems.cargador76239))
	        {
	        	
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	

	        	switch (tipocargador)
	        	{
	        	case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CC_icono.png";break;
	        	case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CL_icono.png";break;
	        	case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador55645_CG_icono.png";break;
	        	}
	        
	        	
	        	
		      if (descargar | descargando )	
				{
		        	switch (tipocargador)
		        	{
		        	case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CC_iconoInv.png";break;
		        	case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CL_iconoInv.png";break;
		        	case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CG_iconoInv.png";break;
		        	}
		        		//icono4="modmercenario:textures/items/gui/transparencia.png";
		        		//icono5="modmercenario:textures/items/gui/transparencia.png";
		        }	
	        	
	        	
	        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=20;break;
		        case 2:	tipomunicionDisplay=21;break;
		        case 3:	tipomunicionDisplay=22;break;
		        }
	        	
		        text0=""+municion+" / "+municionmaxima ;
		        transparencia=false;
	        
		        switch (tipomunicion)
		        {
		        case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
		        case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
		        case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
		        }
		        	
		        icono3="modmercenario:textures/items/gui/botones.png";
	        }

            	
	        
//########################		        
	        if ( item0.equals(MercenaryModItems.fusil200AK) | item0.equals(MercenaryModItems.fusil200AKB) | item0.equals(MercenaryModItems.fusil200AKG) )
	        {
	        			        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil200ak_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil200ak_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}		
	        			
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
	        	icono3="modmercenario:textures/items/gui/botones.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=14;break;
	        	case 2:	tipomunicionDisplay=15;break;
	        	case 3:	tipomunicionDisplay=16;break;
	        	}
	        	

	        	
	        	
	        	if (item0.equals(MercenaryModItems.fusil200AKG)){
	        		if (lmunicion > 0)
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/GA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/GR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/GO.png";break;
	        			}
	        		}	
	        		else
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/dA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/dR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/dO.png";break;
	        			}
	        		}
	        	}
	    		
	    		
	    		
	    		
	    		
	        	
	        	
	        }	      
	        
//########################			        
	        
	        if ( item0.equals(MercenaryModItems.fusilM4A1) | item0.equals(MercenaryModItems.fusilM4A1B) | item0.equals(MercenaryModItems.fusilM4A1G) )
	        {



	        			        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	



	        	icono0="modmercenario:textures/items/armasdefuego/fusilm4a1/fusilm4a1_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/fusilm4a1/fusilm4a1_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}		
	        			
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
	        	icono3="modmercenario:textures/items/gui/botones.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=14;break;
	        	case 2:	tipomunicionDisplay=15;break;
	        	case 3:	tipomunicionDisplay=16;break;
	        	}
	        	

	        	
	        	
	        	if (item0.equals(MercenaryModItems.fusilM4A1G)){
	        		if (lmunicion > 0)
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/GA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/GR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/GO.png";break;
	        			}
	        		}	
	        		else
	        		{
	        			switch (ltipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/dA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/dR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/dO.png";break;
	        			}
	        		}
	        	}
	    		
	    		
	    		
	    		
	    		
	        	
	        	
	        }		
	        
	        
	        
//########################		        
	        if (item0.equals(MercenaryModItems.cargador5728))
	        {
	        			        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	

	        	switch (tipocargador)
	        	{
	        	case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CC_icono.png";break;
	        	case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CL_icono.png";break;
	        	case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CG_icono.png";break;
	        	}
	        			        
	        	
	        	
		      if (descargar | descargando )	
				{
		        	switch (tipocargador)
		        	{
	        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CC_iconoInv.png";break;
	        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CL_iconoInv.png";break;
	        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CG_iconoInv.png";break;
		        	}

		        }	
	        	
	        	
	        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=5;break;
		        case 2:	tipomunicionDisplay=6;break;
		        case 3:	tipomunicionDisplay=7;break;
		        }
	        	
		        text0=""+municion+" / "+municionmaxima ;
		        transparencia=false;
	        
		        switch (tipomunicion)
		        {
		        case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
		        case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
		        case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
		        }
		        	
		        icono3="modmercenario:textures/items/gui/botones.png";
		    	
	        }
//########################		        
	        if (item0.equals(MercenaryModItems.pistola57NF))
	        {
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/pistola75nf/75NF_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/pistola75nf/75NF_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=5;break;
	        	case 2:	tipomunicionDisplay=6;break;
	        	case 3:	tipomunicionDisplay=7;break;
	        	}
	        }
	        
//########################		        
	        if (item0.equals(MercenaryModItems.subfusil90PNF))
	        {

	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/subfusil90pnf/90PNF_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/subfusil90pnf/90PNF_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
		        
		      	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	  
		        
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=5;break;
	        	case 2:	tipomunicionDisplay=6;break;
	        	case 3:	tipomunicionDisplay=7;break;
	        	}
	        	
	        }	
	        
//########################
	        if (item0.equals(MercenaryModItems.subfusil57ar))
	        {
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/subfusil75ar/75ar_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/subfusil75ar/75ar_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
		        
		      	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	  
		        
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=5;break;
	        	case 2:	tipomunicionDisplay=6;break;
	        	case 3:	tipomunicionDisplay=7;break;
	        	}
	        	 	
	        }	

	        
	        
//########################		        
	        if ( (item0.equals(MercenaryModItems.cargadorFM9X)) )
	        {
	        	
	        switch (tipomunicion)
        	{
        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/H.png";break;
        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
        	}
        	
        	switch (tipocargador)
        	{
        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CC_icono.png";break;
        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CL_icono.png";break;
        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CG_icono.png";break;
        	}
        			        
        	
        	
	      if (descargar | descargando )	
			{
	        	switch (tipocargador)
	        	{
        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CC_iconoInv.png";break;
        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CL_iconoInv.png";break;
        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CG_iconoInv.png";break;
	        	}

	        }	
        		        	
        
	        switch (tipomunicion)
	        {
	        case 1:	tipomunicionDisplay=2;break;
	        case 2:	tipomunicionDisplay=3;break;
	        case 3:	tipomunicionDisplay=4;break;
	        }
        	
	        
	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;
        
	        
	        switch (tipomunicion)
	        {
	        case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
	        case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
	        case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
	        }
	        	
	        icono3="modmercenario:textures/items/gui/botones.png";
	        }
//########################
	        if (item0.equals(MercenaryModItems.pistolaFM92))
	        {
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/H.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/92_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas9mm/92_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
		        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=2;break;
		        case 2:	tipomunicionDisplay=3;break;
		        case 3:	tipomunicionDisplay=4;break;
		        }
	        		        	


	        }
	        
//########################		        
	        if (item0.equals(MercenaryModItems.pistolaFM93R))
	        {
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/H.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/93r_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas9mm/93r_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		    
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        
	        	
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
		        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=2;break;
		        case 2:	tipomunicionDisplay=3;break;
		        case 3:	tipomunicionDisplay=4;break;
		        }
		        			        
	        	
	        }
//########################
	        if (item0.equals(MercenaryModItems.subfusilMP5T5))
	        {
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/H.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/mp5t5_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas9mm/mp5t5_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		    
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        
	        	
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
		        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=2;break;
		        case 2:	tipomunicionDisplay=3;break;
		        case 3:	tipomunicionDisplay=4;break;
		        }

	        }
	        
//########################		        
	        if (item0.equals(MercenaryModItems.subfusilAresFMG))
	        {
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/H.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/ares_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas9mm/ares_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		    
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        
	        	
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
		        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=2;break;
		        case 2:	tipomunicionDisplay=3;break;
		        case 3:	tipomunicionDisplay=4;break;
		        }
		        			        
	        	
	        }
	        
//########################		        
	        if (item0.equals(MercenaryModItems.pistolaMauserC92))
	        {
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/H.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/mauser_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas9mm/mauser_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		    
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        
	        	
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
		        
		        switch (tipomunicion)
		        {
		        case 1:	tipomunicionDisplay=2;break;
		        case 2:	tipomunicionDisplay=3;break;
		        case 3:	tipomunicionDisplay=4;break;
		        }
		        			        
	        	
	        }
	        
	        
//########################		        
	        if (item0.equals(MercenaryModItems.cargador45acp))
	        {
	        	

		        switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
        		switch (tipocargador)
        		{
        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CC_icono.png";break;
        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CL_icono.png";break;
        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CG_icono.png";break;
        		}
	        			        
	        	
	        	
		      if (descargar | descargando )	
				{
		        	switch (tipocargador)
		        	{
	        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CC_iconoInv.png";break;
	        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CL_iconoInv.png";break;
	        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CG_iconoInv.png";break;
		        	}

		        }	
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=8;break;
	        	case 2:	tipomunicionDisplay=9;break;
	        	case 3:	tipomunicionDisplay=10;break;
	        	}
	        	
	        	text0=""+municion+" / "+municionmaxima ;
		        transparencia=false;
	        
		        
		        switch (tipomunicion)
		        {
		        case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
		        case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
		        case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
		        }
		        	
		        icono3="modmercenario:textures/items/gui/botones.png";

		        }
	        
//########################		        

	        
	        
	        if (item0.equals(MercenaryModItems.pistola1911colt))
	        {
	            switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas45cal/1911colt_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas45cal/1911colt_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=8;break;
	        	case 2:	tipomunicionDisplay=9;break;
	        	case 3:	tipomunicionDisplay=10;break;
	        	}


	        }
	        
//########################		        
	        if (item0.equals(MercenaryModItems.pistolaDesertEagle))
	        {
	        	
	            switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas45cal/deserteagle_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas45cal/deserteagle_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=8;break;
	        	case 2:	tipomunicionDisplay=9;break;
	        	case 3:	tipomunicionDisplay=10;break;
	        	}
        	
	        	
	        }
//########################		        
	        if ( (item0.equals(MercenaryModItems.pistolaSocom)) | (item0.equals(MercenaryModItems.pistolaSocomS)) )
	        {
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/armas45cal/socom_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas45cal/socom_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        	
		        //icono1="modmercenario:textures/items/gui/manualO.png";
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=8;break;
	        	case 2:	tipomunicionDisplay=9;break;
	        	case 3:	tipomunicionDisplay=10;break;
	        	}
        	
	        	
	        }    
	        
	       
//########################		        
	        if ( (item0.equals(MercenaryModItems.arcoMercenarioDeMadera)) 
	           | (item0.equals(MercenaryModItems.arcoMercenario))
	           | (item0.equals(MercenaryModItems.vallestaMercenaria))	
	           | (item0.equals(MercenaryModItems.vallestaMercenariaDeMadera))
	        		
	        		)
	        {
	        	switch(tipomunicion)
	        	{
	        	case 1: icono0="modmercenario:textures/items/arcos/flechas/flechaV_icono.png";break;
	        	case 2: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaA_icono.png";break;
	        	case 3: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaR_icono.png";break;
	        	case 4: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaO_icono.png";break;
	        	case 5: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaE_icono.png";break;
                    }
	        	
	        	
	        text0=""+municiondisponible; 
	        transparencia=false;
	        tipomunicionDisplay=0;
	        icono3="modmercenario:textures/items/gui/botonesDivRes.png";
	        
	        
	        if ( mensage00 > 0 )
	        {		        
	        icono4 = "modmercenario:textures/items/gui/headS.png";
	        mensage00 --;
	        }
	        
	        }
       

	        
//#######################		        
	        if (item0.equals(MercenaryModItems.revolverMagnum))
	        {
	        	
	        	switch(modo)
	        	{
	        	case 0: icono0="modmercenario:textures/items/armasdefuego/revolvermagnum/magnum_icono.png";break;
	        	case 1: icono0="modmercenario:textures/items/armasdefuego/revolvermagnum/magnum_iconoInv.png";break;
	        	case 2: icono0="modmercenario:textures/items/armasdefuego/revolvermagnum/magnum_icono.png";break;
                    }
	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;

	    	switch (tipomunicion)
        	{
        	case 1:	tipomunicionDisplay=8;icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
        	case 2:	tipomunicionDisplay=9;icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
        	case 3:	tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
        	}
        		    	
	        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        }
	        
	        
	        
//########################		        
	        if (item0.equals(MercenaryModItems.cargadorRedClub))
	        {
	        	
	            switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	            
	            
	            
	            
        		switch (tipocargador)
        		{
        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_icono.png";break;
        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_icono.png";break;
        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_icono.png";break;
        		}
	        			        
	        	
	        	
		      if (descargar | descargando )	
				{
		        	switch (tipocargador)
		        	{
	        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_iconoInv.png";break;
	        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_iconoInv.png";break;
	        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_iconoInv.png";break;			        	}

		        }	
	        		        	
		        text0=""+municion+" / "+municionmaxima ;
		        transparencia=false;
		        
		    	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/redclub_ARO_O.png";break;
	        	case 2:	tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/redclub_ARO_O.png";break;
	        	case 3:	tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/redclub_ARO_O.png";break;
	        	}
	        
		    	icono3="modmercenario:textures/items/gui/botones.png";
	        }
	        
	        
//########################		        
	        if (item0.equals(MercenaryModItems.pistolaRedClub))
	        {
	        	
	        	
	            switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	            
	            
	        	icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_icono.png";
	        		
	        	if ( recargando | descargando | remplazando)
	        	{
	        		icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_iconoInv.png";
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
	        	switch(tipodisparo)
	        	{
	        	case 0: icono1="modmercenario:textures/items/gui/redclub_R.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/redclub_A.png";break;
	        	case 2: icono1="modmercenario:textures/items/gui/redclub_Z.png";break;
	        	
	        	}
	        	
	        	transparencia=false;
	        	text0=""+municion+"/"+municionmaxima;
	        	
		        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        		        	
	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=10;break;
	        	case 2:	tipomunicionDisplay=10;break;
	        	case 3:	tipomunicionDisplay=10;break;
	        	}
	        	
	        	
	        	
	        	
	        	
	        	
	        	switch(modo)
	        	{
	        	case 0: icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_icono.png";break;
	        	case 1: icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_iconoInv.png";break;
	        	case 2: icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_icono.png";break;
                    }//########################
	        	
	        	
	        	
	        }	
	        	
        
	        

	        
	        

        
//########################		        
	        if (item0.equals(MercenaryModItems.subfusilAresFMG))
	        {
	        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/ares_icono.png";
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}

	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;
	        
	        switch (tipomunicion)
        	{
        	case 1:	tipomunicionDisplay=2;break;
        	case 2:	tipomunicionDisplay=3;break;
        	case 3:	tipomunicionDisplay=4;break;
        	}
	        
	        icono3="modmercenario:textures/items/gui/botones.png";
	        }

//########################		        
	        if (item0.equals(MercenaryModItems.escopetaSPAS12))
	        {
	        	icono0="modmercenario:textures/items/armasdefuego/escopetaspas12/spas12_icono.png";
	        	
	        	
	        	
	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;
	        
	        switch (tipomunicion)
        	{
        	case 1:	tipomunicionDisplay=11;break;
        	case 2:	tipomunicionDisplay=12;break;
        	case 3:	tipomunicionDisplay=13;break;
        	}
	        
	    
	        switch (tipomunicion)
        	{
        	case 1:	icono1="modmercenario:textures/items/gui/cartuchosRojo.png";break;
        	case 2:	icono1="modmercenario:textures/items/gui/cartuchosVerde.png";break;
        	case 3:	icono1="modmercenario:textures/items/gui/cartuchosAzul.png";break;
        	}
	        
	        icono3="modmercenario:textures/items/gui/botones.png";

	        }
	        
	        
	        
	        
//#######################		        
	        if (item0.equals(MercenaryModItems.escopetaWinchester1200))
	        {
	        	icono0="modmercenario:textures/items/armasdefuego/escopetawinchester1200/winchester1200_icono.png";
	        	
	        	 icono1="modmercenario:textures/items/gui/manual.png";
	        	
	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;
	        
	        switch (tipomunicion)
        	{
        	case 1:	tipomunicionDisplay=11;break;
        	case 2:	tipomunicionDisplay=12;break;
        	case 3:	tipomunicionDisplay=13;break;
        	}
	        
	        
	        switch (tipomunicion)
        	{
        	case 1:	icono1="modmercenario:textures/items/gui/cartuchosRojo.png";break;
        	case 2:	icono1="modmercenario:textures/items/gui/cartuchosVerde.png";break;
        	case 3:	icono1="modmercenario:textures/items/gui/cartuchosAzul.png";break;
        	}
	        
	        icono3="modmercenario:textures/items/gui/botones.png";

	        
	        }
	        
	        
//#######################		        
	        if (item0.equals(MercenaryModItems.lanzagranadas79M))
	        {
	        	
	        	
	        icono0="modmercenario:textures/items/armasdefuego/lanzagrandas79m/M79_icono.png";
	        	
	        		if (municion > 0)
	        		{
	        			switch (tipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/GA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/GR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/GO.png";break;
	        			}
	        		}	
	        		else
	        		{
	        			switch (tipomunicion)
	        			{
	        			case 0:	icono4="modmercenario:textures/items/gui/transparencia.png";break;
	        			case 1:	icono4="modmercenario:textures/items/gui/dA.png";break;
	        			case 2:	icono4="modmercenario:textures/items/gui/dR.png";break;
	        			case 3:	icono4="modmercenario:textures/items/gui/dO.png";break;
	        			}
	        		}
	        	
	        	

	        
	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;
	        
        	if (tipomunicion==1)
        	{tipomunicionDisplay=17;
        	icono1="modmercenario:textures/items/gui/granadas_A.png";
        	}
        	if (tipomunicion==2)
        	{tipomunicionDisplay=18;
        	icono1="modmercenario:textures/items/gui/granadas_R.png";
        	}
        	if (tipomunicion==3)
        	{tipomunicionDisplay=19;
        	icono1="modmercenario:textures/items/gui/granadas_O.png";
        	}
        	
        	icono3="modmercenario:textures/items/gui/botones.png";
	        }
	        

//########################
	        if ( item0.equals(MercenaryModItems.fusilMarkLancer)  )
	        {
        	
        	boolean extraer = util.getBooleantag(stack0, "extraer");
        	
	        	
        	
        	switch(tipodisparo)
        	{
        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
        	}
        	
        	
        	
        	switch (tipomunicion)
        	{
        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
        	}
        	
        	
        	
        	icono0="modmercenario:textures/items/armasdefuego/fusilmarklancer/mark1_icono.png";
        		
        	if ( extraer )
        	{
        		
        		icono4="modmercenario:textures/items/gui/transparencia.png";
        		icono5="modmercenario:textures/items/gui/transparencia.png";
        	}	
        	
        	

        	icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        
	        

	        
        	int accion = util.getInttag(stack0, "accion");
        	
        	if (accion == 5)
        	{
        		lmunicion = lmunicion - getLmunicion();
        	}
        	
        	transparencia=false;
        	text0="B "+municion+"/"+municionmaxima+"  R "+ lmunicion +"/"+" 5K";

        	switch (tipomunicion)
        	{
        	case 1:	tipomunicionDisplay=14;break;
        	case 2:	tipomunicionDisplay=15;break;
        	case 3:	tipomunicionDisplay=16;break;
        	}
	        	
	        }		

//########################

	     

//########################
	        if ( item0.equals(MercenaryModItems.fusilMark2Lancer)  )
		        {
	        	
	        	boolean extraer = util.getBooleantag(stack0, "extraer");
	        	
		        	
	        	
	        	switch(tipodisparo)
	        	{
	        	case 2: icono1="modmercenario:textures/items/gui/auto.png";break;
	        	case 0: icono1="modmercenario:textures/items/gui/manual.png";break;
	        	case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break;
	        	}
	        	
	        	
	        	
	        	switch (tipomunicion)
	        	{
	        	case 0:	icono5="modmercenario:textures/items/gui/transparencia.png";break;
        		case 1:	icono5="modmercenario:textures/items/gui/A.png";break;
	        	case 2:	icono5="modmercenario:textures/items/gui/R.png";break;
	        	case 3:	icono5="modmercenario:textures/items/gui/O.png";break;
	        	}
	        	
	        	
	        	
	        	icono0="modmercenario:textures/items/armasdefuego/fusilmark2lancer/mark2_icono.png";
	        		
	        	if ( extraer )
	        	{
	        		
	        		icono4="modmercenario:textures/items/gui/transparencia.png";
	        		icono5="modmercenario:textures/items/gui/transparencia.png";
	        	}	
	        	
        	

	        	icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
		        
		        

		        
	        	int accion = util.getInttag(stack0, "accion");
	        	
	        	if (accion == 5)
	        	{
	        		lmunicion = lmunicion - getLmunicion();
	        	}
	        	
	        	transparencia=false;
	        	text0="B "+municion+"/"+municionmaxima+"  R "+ lmunicion +"/"+" 5K";

	        	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=14;break;
	        	case 2:	tipomunicionDisplay=15;break;
	        	case 3:	tipomunicionDisplay=16;break;
	        	}
		        	
		        }		

//########################
		        if (item0.equals(MercenaryModItems.cargador55645))
		        {
		        	
		        switch (modo)
		        {	
		        	default:{
		        		switch (tipocargador)
		        		{
		        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_icono.png";break;
		        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_icono.png";break;
		        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_icono.png";break;
		        		}
		        	}break;
		        	
		        	case 1:{
		        		switch (tipocargador)
		        		{
		        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_iconoInv.png";break;
		        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_iconoInv.png";break;
		        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_iconoInv.png";break;
		        		}
		        	}break;
		        	
		        }
		        
		        text0=""+municion+" / "+municionmaxima ;
		        transparencia=false;
		        
		    	switch (tipomunicion)
	        	{
	        	case 1:	tipomunicionDisplay=14;icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
	        	case 2:	tipomunicionDisplay=15;icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
	        	case 3:	tipomunicionDisplay=16;icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
	        	}
	        
		    	icono3="modmercenario:textures/items/gui/botones.png";
		        }



	        
	        


//########################
	        if (item0.equals(MercenaryModItems.cargador55645))
	        {
	        	
	        switch (modo)
	        {	
	        	default:{
	        		switch (tipocargador)
	        		{
	        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_icono.png";break;
	        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_icono.png";break;
	        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_icono.png";break;
	        		}
	        	}break;
	        	
	        	case 1:{
	        		switch (tipocargador)
	        		{
	        		case 1:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_iconoInv.png";break;
	        		case 2:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_iconoInv.png";break;
	        		case 3:	icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_iconoInv.png";break;
	        		}
	        	}break;
	        	
	        }
	        
	        text0=""+municion+" / "+municionmaxima ;
	        transparencia=false;
	        
	    	switch (tipomunicion)
        	{
        	case 1:	tipomunicionDisplay=14;icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break;
        	case 2:	tipomunicionDisplay=15;icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break;
        	case 3:	tipomunicionDisplay=16;icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break;
        	}
        
	    	icono3="modmercenario:textures/items/gui/botones.png";
	        }


	        
	        
//########################		        
	        if (item0.equals(MercenaryModItems.taladroMercenario))
	        {
	        	switch(tipodisparo)
	        	{	
	        	default: icono0="modmercenario:textures/items/herramientas/taladro/taladro00cam02.png";break;
	        	case 1: icono0="modmercenario:textures/items/herramientas/taladro/modo1.png";break;
	        	case 2: icono0="modmercenario:textures/items/herramientas/taladro/modo2.png";break;
	        	case 3: icono0="modmercenario:textures/items/herramientas/taladro/modo3.png";break;
	        	case 4: icono0="modmercenario:textures/items/herramientas/taladro/modo4.png";break;
	        	case 5: icono0="modmercenario:textures/items/herramientas/taladro/modo5.png";break;
	        	case 6: icono0="modmercenario:textures/items/herramientas/taladro/modo6.png";break;
	        	}
	        text0=""+municion+" / "+municionmaxima; 
		    transparencia=false;
		    tipomunicionDisplay=1;
		    icono3="modmercenario:textures/items/gui/botones.png";
		    }
//########################		        
	        if (item0.equals(MercenaryModItems.sierraMercenaria))
	        {
	        	switch(tipodisparo)
	        	{	
	        	default: icono0="modmercenario:textures/items/herramientas/sierra/sierramercenaria0.png";break;
	        	}
	        text0=""+municion+" / "+256; 
		    transparencia=false;
		    tipomunicionDisplay=1;
		    icono3="modmercenario:textures/items/gui/botones.png";
		    }
	        
	        

	        
	        
//########################		        

	        
	        
	        if ( unload | reload )
	        {icono1="modmercenario:textures/items/gui/holdRigthClick.png";}
	        

	        
	                
            	}//nbttag
            }//(stack0 != null)
            
            
            
          //paint a default gun just to show the position  
          //########################
        if (guiTick > 0)
        {
        	transparencia=false;
        	icono5="modmercenario:textures/items/gui/H.png";
        	icono0="modmercenario:textures/items/armasdefuego/armas9mm/92_icono.png";
        	text0="00/00";
        	
	        icono1="modmercenario:textures/items/gui/manualO.png";
	        icono3="modmercenario:textures/items/gui/botonesAsterisco.png";
	        tipomunicionDisplay=2;	        	
        }
            
        
            displayWidth=mc.displayWidth;
            displayHeight=mc.displayHeight;
            guiscale=mc.gameSettings.guiScale;            
                      
            System.out.println("guiscale="+guiscale);
            System.out.println("displayWidth="+displayWidth);
            System.out.println("displayHeight="+displayHeight);
            
        	//posX= ( (int) (displayWidth  * 0.1F) );
           // posY= ( (int) (displayHeight * 0.1F) );
            
            

            
           
            System.out.println("this.width ="+this.width);
            System.out.println("this.height="+this.height);

            
            switch(guiscale)
            {
            case 0: 
            {
            	posX=10; //1 6; //controls the gui size
                posY= 200;//((displayHeight/2)-25);
                //x=30;  //gui size    
            } ;break;
            
            case 3:
            {
            	posX=10;//( (int) (displayWidth  * 0.025F) ); //30 controls the gui size
                posY=( (int) (displayHeight * 0.30F) );
                //x=40;  //gui size    
            } ;break;
            
            case 2:
            {
            	posX=10;//( (int) (displayWidth  * 0.025F) ); //30 controls the gui size
                posY=( (int) (displayHeight * 0.45F) );
                //x=40;  //gui size    
            } ;break;
            
            case 1:
            {
            	posX=10;//( (int) (displayWidth  * 0.05F) ); //16; //controls the gui size
                posY=( (int)(displayHeight * 0.92F));
                //x=40;  //gui size    
            } ;break;
            
            
            }
            
            
           // posX = this.width / 2; 
           // posY = this.height / 2;
            


        	posX = posX + ppx;//( (int) (displayWidth  * 0.05F) ); //16; //controls the gui size
            posY = posY + ppy;

            System.out.println("posX="+posX );
            System.out.println("posY="+posY );
            
            System.out.println("\n\n\n" );
            

            
            //  System.out.println("posX="+ppx );
            //  System.out.println("posY="+ppy );
            //  System.out.println("x="+x );
            
            
            
            switch(tipomunicionDisplay)           
            {
            case 0: icono2="modmercenario:textures/items/gui/transparencia.png"; break;
            case 1: icono2="modmercenario:textures/items/armasdefuego/balas/barraRedStone.png"; break;
            
            case 2: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala9mmA.png"; break;
            case 3: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala9mmR.png"; break;
            case 4: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala9mmO.png"; break;
            
            case 5: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_acero.png"; break;
            case 6: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_redstone.png"; break;
            case 7: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_obsidiana.png"; break;
            
            case 8:  icono2="modmercenario:textures/items/armasdefuego/balas/barraBalacal45acp_acero.png"; break;
            case 9:  icono2="modmercenario:textures/items/armasdefuego/balas/barraBalacal45acp_redstone.png"; break;
            case 10: icono2="modmercenario:textures/items/armasdefuego/balas/barraBalacal45acp_obsidiana.png"; break;
                             
            case 11: icono2="modmercenario:textures/items/armasdefuego/balas/barra12Grojo.png"; break;
            case 12: icono2="modmercenario:textures/items/armasdefuego/balas/barra12Gverde.png"; break;
            case 13: icono2="modmercenario:textures/items/armasdefuego/balas/barra12Gazul.png"; break;
            
            case 14: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala55645mm_acero.png"; break;
            case 15: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala55645mm_restone.png"; break;
            case 16: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala55645mm_obsidiana.png"; break;
            
            case 17: icono2="modmercenario:textures/items/armasdefuego/balas/barraGranada_A.png"; break;
            case 18: icono2="modmercenario:textures/items/armasdefuego/balas/barraGranada_R.png"; break;
            case 19: icono2="modmercenario:textures/items/armasdefuego/balas/barraGranada_O.png"; break;

            case 20: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala76239mm_acero.png"; break;
            case 21: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala76239mm_redstone.png"; break;
            case 22: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala76239mm_obsidiana.png"; break;

            
            }
            
            //el ancho de la barra al que equivale cada unidad de municion
            switch(tipomunicionDisplay)           
            {
            default: balas=32.0F; break;
            case 1:  balas=256.0F; break;
            case 8: 
            case 9: 
            case 10: 
            case 11:
            case 12:
            case 13:
            case 17:
            case 18:
            case 19: balas=16.0F; break;	
            }
            
            

            
            xf=x+0.0F;
            	
            
            
        }//( (conteo%20)==0 )
        
        //Prepare rendering
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        
        
        
        if (municion<0)
        {
        municion=0;	
        }	
        

        if ( Mercenary.getGuiOn() ){
        	
        	
        
           //drawModalRectWithCustomSizedtexture(int x, int y,float u,float v,int width,int height,float textureWidth,float textureHeight);
        
        this.mc.renderEngine.bindTexture(new ResourceLocation(icono0));
        this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY), 0.0F, 0.0F, x, x, xf, xf); //imagen al 60%
      //this.drawModalRectWithCustomSizedtexture(posX + 8, posY + 8, 0.0F, 0.0F, 200, 200 , 200.0F, 200.0F);
        
        this.mc.renderEngine.bindTexture(new ResourceLocation(icono1));
        this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY ), 0.0F, 0.0F, (int) (x * 1.5), (x / 3), (xf * 1.5F), (xf / 3) ); //imagen al 60%
        
        this.mc.renderEngine.bindTexture(new ResourceLocation(icono2));
        this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY + (x / 3) ), 0.0F, 0.0F, (int)  (((x * 1.0) / balas ) * municion), (x / 3), (xf * 1.0F), (xf / 3) ); 
        
        this.mc.renderEngine.bindTexture(new ResourceLocation(icono3));
        this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY + ((x / 3) * 2) ), 0.0F, 0.0F, (int) (x * 1.5), (x / 3), (xf * 1.5F), (xf / 3) ); 
        
        this.mc.renderEngine.bindTexture(new ResourceLocation(icono4));
        this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY), 0.0F, 0.0F, x, x/2 , xf, xf/2 ); //imagen al 60%
        
        this.mc.renderEngine.bindTexture(new ResourceLocation(icono5));
        this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY + (x/2)), 0.0F, 0.0F, x, x/2 , xf, xf/2 ); //imagen al 60%

        
        this.mc.fontRendererObj.drawStringWithShadow(text0,  posX, ((posY ) + x) , 0xffcccccc);
        //this.mc.fontRendererObj.drawStringWithShadow(text0,  posX + 32 + 8, posX + 8, 0xffcccccc);
        
        
    }
        
        
    }
//####################################################################################################################3

       

public static boolean getPermitirMensaje()
{
 boolean p = permitirMensaje;
 permitirMensaje=false;
 return p;

}   
    
public static int getlconteoAndSetToZero()
{
 int l = lconteo;
 lconteo = 0;

 return l;
}     


public static int getlconteo()
{
 return lconteo;
}   

public static int getrconteo()
{
  	 return rconteo;
} 

public static int getconteo100()
{
 return conteo100;
}
    
public static void setconteo100(int c)
{
 conteo100 = c;
}

public static void setconteo100Zero()
{
 conteo100 = 0;
}
   
public static void addconteo100(int c)
{
 conteo100 = conteo100 + c;
}

// conteo200
public static int getconteo200()
{
 conteo200 ++;
 return (conteo200 / 3);
}
    
public static void setconteo200(int c)
{
 conteo200 = c;
}

public static void setconteo200Zero()
{
 conteo200 = 0;
}



public static boolean permitirSonido()
{
 boolean p =  permitirSonido;
 permitirSonido=false;
 return p;
}


public static boolean permitirLdisparo2s()
{
 boolean s2 =  permitirLdisparo2s;
 permitirLdisparo2s=false;
 return s2;
}




public static int getLmunicion()
{
 return vlmunicion;
}
    
public static void setLmunicion(int c)
{
 vlmunicion = c;
}

public static void addLmunicion()
{

 if (permitirVlmunicion)
 {
	 vlmunicion ++ ;	 
	 permitirVlmunicion=false;
 }
}

public static void setHeadshoot(int t)
{

 mensage00=t;
}



public static int getTexturajson()
{
 return texturajson;
}

public static void setTexturajson(int t) 
{
 texturajson = t;
}

public static int getAccion()
{
 return accion;
}

public static void setAccion(int t) 
{
 accion = t;
}

public static int getGraficaltick()
{
 return graficaltick;
}


public static void setPpx(int px) 
{
 ppx = px;
}

public static int getPpx()
{
 guiTick =2;
 return ppx;
}

public static void setPpy(int py) 
{
 ppy = py;
}

public static int getPpy()
{
 guiTick =2;
 return ppy;
}

public static void setX(int p) 
{
 x = p;
}

public static int getX()
{
 guiTick =2;
 return x;
}

public static float getXf()
{
 return xf;
}
  


public static int getPosX()
{
 return posX;
}

public static int getPosY()
{
 return posY;
} 



//####################################################################################################################3   


public static void lineaRoja(Vec3 vectorA, Vec3 vectorB)
{	  


//MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver;
    	



//  System.out.println("vectorA="+vectorA);
//  System.out.println("vectorB="+vectorB);

     GL11.glPushMatrix();
     GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
     
     //because of the way 3D rendering is done, all coordinates are relative to the camera.  This "resets" the "0,0,0" position to the location that is (0,0,0) in the world.

     EntityPlayer playerIn = mc.thePlayer;
     Vec3 pos0 = playerIn.getPositionVector();
           
     GL11.glTranslated(-pos0.xCoord, -pos0.yCoord, -pos0.zCoord);
     
     GlStateManager.rotate(0.0F, 0.0F, 0.0F, 0.0F);
     GlStateManager.rotate(0.0F, 0.0F, 0.0F, 0.0F);
     
     GL11.glDisable(GL11.GL_LIGHTING);
     GL11.glDisable(GL11.GL_TEXTURE_2D);
     //you will need to supply your own position vectors
     //GL11.drawLineWithGL(pos, pos1);

     

     
//		int d = Math.round((float)blockA.distanceTo(blockB)+0.2f);

	GL11.glColor3f(1F, 0F, 0F);
//		float oz = (blockA.xCoord - blockB.xCoord == 0?0:-1f/16f);
//		float ox = (blockA.zCoord - blockB.zCoord == 0?0:1f/16f);

	GL11.glBegin(GL11.GL_LINE_STRIP);

	GL11.glVertex3d(vectorA.xCoord ,vectorA.yCoord ,vectorA.zCoord );
	GL11.glVertex3d(vectorB.xCoord ,vectorB.yCoord ,vectorB.zCoord );

	GL11.glEnd();
     
//     drawLineWithGL(pos0, pos1);
     
     GL11.glPopAttrib();
     GL11.glPopMatrix();
     
}
///##################################################################################################################3 
public static void miraRoja(Vec3 vectorA, Vec3 vectorB, EntityLivingBase entidad)
{	  
     GL11.glPushMatrix();
     GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
     
     //because of the way 3D rendering is done, all coordinates are relative to the camera.  This "resets" the "0,0,0" position to the location that is (0,0,0) in the world.

     EntityPlayer playerIn = mc.thePlayer;
     Vec3 pos0 = entidad.getPositionVector();
     
     
     //GL11.glTranslated(-pos0.xCoord, -pos0.yCoord, -pos0.zCoord);
     GL11.glDisable(GL11.GL_LIGHTING);
     GL11.glDisable(GL11.GL_TEXTURE_2D);


	MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver;

	pos0 = new Vec3(pos0.xCoord, pos0.yCoord + entidad.getEyeHeight() - 0.2F , pos0.zCoord); //from the eye heigth

	Vec3 pos1 = mov.hitVec;  //bala.shootingEntity.getLookVec(); //bala.getPositionVector();//new Vec3(-4, 5, -4);


//	mercenarymod.gui.NotificationMercenaria.lineaRoja(pos0, pos1 );

     
     


	GL11.glColor3f(1F, 0F, 0F);

	GL11.glBegin(GL11.GL_LINE_STRIP);

	GL11.glVertex3d(pos0.xCoord ,pos0.yCoord ,pos0.zCoord );
	GL11.glVertex3d(pos1.xCoord ,pos1.yCoord ,pos1.zCoord );

	GL11.glEnd();
     
     GL11.glPopAttrib();
     GL11.glPopMatrix();








}
//####################################################################################################################3   
public static int[] getIntArraytag(ItemStack item, String tag)
  {	
  int[] array = new int[5];
  	
  NBTTagCompound etiquetas = item.getTagCompound();
  	if (etiquetas == null)
  	{ 
  	etiquetas = new NBTTagCompound();
  	item.setTagCompound(etiquetas);
  	array[0]=9999;
  	return array;
  	}
  			
  array=etiquetas.getIntArray(tag); 
  return array;
  }
//####################################################################################################################3
  public static void setIntArraytag(ItemStack item, String tag, int[] value)
  {
  	NBTTagCompound etiquetas = item.getTagCompound();
  		if (etiquetas == null)
  		{ 
  		etiquetas = new NBTTagCompound();
  	    }
  	
  	etiquetas.setIntArray(tag, value);
  	item.setTagCompound(etiquetas);
  		
  }
//####################################################################################################################3   
  public static float getFloattag(ItemStack item, String tag)
  {	
  	
  	NBTTagCompound etiquetas = item.getTagCompound();
  		if (etiquetas == null)
  		{ 
  		etiquetas = new NBTTagCompound();
  		item.setTagCompound(etiquetas);
  		return 999.9F;
  	    }
  		
  	float ex=etiquetas.getFloat(tag); 
  	return ex;
  }
//####################################################################################################################3
  public static void setFloattag(ItemStack item, String tag, float value)
  {
    NBTTagCompound etiquetas = item.getTagCompound();
  		if (etiquetas == null)
  		{ 
  		etiquetas = new NBTTagCompound();
  	    }
  	
  	etiquetas.setFloat(tag, value);
  	item.setTagCompound(etiquetas);
  	
  }
//####################################################################################################################3
  public static int getInttag(ItemStack item, String tag){	
  	NBTTagCompound etiquetas = item.getTagCompound();
  		if (etiquetas == null)
  		{ 
  		etiquetas = new NBTTagCompound();
  		item.setTagCompound(etiquetas);
  		return 9999;
  		}
  			
  	int ex=etiquetas.getInteger(tag); 
  	return ex;
  }
//####################################################################################################################3
  public static void setInttag(ItemStack item, String tag, int value)
  {
  NBTTagCompound etiquetas = item.getTagCompound();
  	if (etiquetas == null)
  	{ 
  	etiquetas = new NBTTagCompound();
    }
  	
  etiquetas.setInteger(tag, value);
  item.setTagCompound(etiquetas);
  		
  }
//####################################################################################################################3
  public static Boolean getBooleantag(ItemStack item, String tag)
  {	
  	NBTTagCompound etiquetas = item.getTagCompound();
  		if (etiquetas == null)
  		{ 
        etiquetas = new NBTTagCompound();
  		item.setTagCompound(etiquetas);
  		return false;
  		}
  		
  	boolean ex=etiquetas.getBoolean(tag); 
  	return ex;
  }
//####################################################################################################################3
  public static void setBooleantag(ItemStack item, String tag, boolean value)
  {
NBTTagCompound etiquetas = item.getTagCompound();
  		if (etiquetas == null)
  		{ 
  		etiquetas = item.getTagCompound();
  		}
  		
  	etiquetas.setBoolean(tag, value);
  	item.setTagCompound(etiquetas);
  }	
//####################################################################################################################3
}//fin de la classe

 

 

 

 

Link to comment
Share on other sites

When you are logging the values, do this:

 

  posX= ( (int) (displayWidth  * 0.1F) );

  posY= ( (int) (displayHeight * 0.1F) );

 

and get rid of this:

         

            //Offset added for the gui whit the buttons

//            posX = posX + ppx;

//            posY = posY + ppy;

 

 

You should always see the button at the top left of the screen and it should always start at 10% of the screen size (use a ruler in real life to check).

Link to comment
Share on other sites

E pues Nop

 

precisely the trouble is that

the gui is not always at 10% de X and 10% de Y

 

posX= ( (int) (displayWidth  * 0.1F) );

posY= ( (int) (displayHeight * 0.1F) );

 

per example in this picture im playing whith the maximed, the window size is 1680x970

the gui position is set as 10% 10% of this values so posX=168 posY=97 are the same in all the four pictures but the gui end in diferents places the closes to 10% 10% is the one when guiscale=1

and the fartest is guiscale=0 looks more like a 22% 75%

 

 

 

http://s7.postimg.org/ow0trlgmj/gui_1680x970.png

 

dont press atention the ppx ppy i made that yesterday soo i could move the gui manually whithout restarting the game in this picture i keep that values at zero

 

but  in this video is whith the values aproximated to leftBotom corner not 10% 10% is just to show the other  gui whith the buttons

 

 

 

 

Link to comment
Share on other sites

Ok so you have 168 for the 10% value when the screen is 1680 .  But what about the values when you make the screen smaller?  Did you ensure it was (for example) 70 and 700?

 

You might be using the wrong value for screen width even after the user resizes the screen.  You might be using the old width value that you calculated earlier.

Link to comment
Share on other sites

well actually not

 

i set System.outs there and there soo i could see the values all the time,

for thet is  io make the other gui whith buttons and whith that gui i get the values i post before

here is some trick needed or may the gui for the guns is wrong made or is missing something

actually i think i need tu up something whith a super() to the gui class so it return  me the right values of width and heigth

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.