Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.twitmund.gui;
- import java.awt.Color;
- import com.mojang.realmsclient.client.Request.Get;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.client.renderer.OpenGlHelper;
- import net.minecraft.client.renderer.RenderHelper;
- import net.minecraft.client.renderer.entity.RenderManager;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.util.ResourceLocation;;
- public class OgabeGuiMenu extends GuiScreen {
- private final ResourceLocation background = new ResourceLocation("textures/gui/OgabeGui/GuiOgabe.png");
- //248 :/166
- private final int xSize = 248;
- private final int ySize = 166;
- private int guiLeft;
- private int guiTop;
- private Minecraft minecraft;
- public OgabeGuiMenu(Minecraft mc){
- minecraft = mc;
- }
- public void initGui(){
- guiLeft = (this.width - this.xSize) / 2;
- guiTop = (this.height - this.ySize) / 2;
- buttonList.add(new GuiButton(0, guiLeft +(248 / 2 - 120) , guiTop + (166 / 2 - 30), 50, 20, "§bSpawn"));
- buttonList.add(new GuiButton(1, guiLeft +(248 / 2 - 120) , guiTop + (166 / 2 - 50), 50, 20, "§bTest"));
- buttonList.add(new GuiButton(2, guiLeft +(248 / 2 - 122) , guiTop + 2, 20, 20, "§c§lX"));
- }
- public void actionPerformed(GuiButton button){
- if(button.id == 0 ){
- this.mc.thePlayer.sendChatMessage(":sethome maisons");
- }
- else if(button.id == 1 ){
- this.mc.thePlayer.sendChatMessage(":home maisons");
- }
- if(button.id == 2){
- this.mc.displayGuiScreen((GuiScreen)null);
- this.mc.setIngameFocus();
- }
- }
- public void drawScreen(int mouseX, int mouseY, float partialTicks){
- this.drawBackgroundImage();
- drawText();
- drawEntityOnScreen(guiLeft + 110, guiTop + 100 ,40 , (guiLeft + 110) - mouseX, (guiTop + 40) - mouseY ,this.mc.thePlayer );
- super.drawScreen(mouseX, mouseY, partialTicks);
- }
- public void drawBackgroundImage(){
- GlStateManager.pushMatrix();
- GlStateManager.color(1.0F,1.0F,1.0F,1.0F);
- this.minecraft.getTextureManager().bindTexture(background);
- drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- GlStateManager.popMatrix();
- }
- public void drawText(){
- //drawString
- //drawSkinCeteredString
- //drawStringWithShadow
- drawCenteredString(fontRendererObj, "§fTu as §4§l" + this.mc.thePlayer.getHealth() / 2 + " " +"§fde coeur ", guiLeft +(248 / 2 - 5) , guiTop + 150 + 2,0x87E990 );
- //drawString(fontRendererObj, "Tu a " + this.mc.thePlayer.getAbsorptionAmount() / 2 + " " +"de coeur d'absorbtion", guiLeft +(248 / 2 - 120) , guiTop + (166 / 2 - 50),0x87E990 );
- }
- public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent){
- GlStateManager.enableColorMaterial();
- GlStateManager.pushMatrix();
- GlStateManager.translate((float)posX, (float)posY, 50.0F);
- GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
- GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
- float f = ent.renderYawOffset;
- float f1 = ent.rotationYaw;
- float f2 = ent.rotationPitch;
- float f3 = ent.prevRotationYawHead;
- float f4 = ent.rotationYawHead;
- GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
- RenderHelper.enableStandardItemLighting();
- GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
- ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
- ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
- ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
- ent.rotationYawHead = ent.rotationYaw;
- ent.prevRotationYawHead = ent.rotationYaw;
- GlStateManager.translate(0.0F, 0.0F, 0.0F);
- RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
- rendermanager.setPlayerViewY(180.0F);
- rendermanager.setRenderShadow(false);
- rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
- rendermanager.setRenderShadow(true);
- ent.renderYawOffset = f;
- ent.rotationYaw = f1;
- ent.rotationPitch = f2;
- ent.prevRotationYawHead = f3;
- ent.rotationYawHead = f4;
- GlStateManager.popMatrix();
- RenderHelper.disableStandardItemLighting();
- GlStateManager.disableRescaleNormal();
- GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
- GlStateManager.disableTexture2D();
- GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement