daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.minecraft.client.gui;
  2.  
  3. import com.nexion.client.interfaces.Unsized;
  4.  
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.util.MathHelper;
  7.  
  8. public class ScaledResolution
  9. {
  10.     private int scaledWidth;
  11.     private int scaledHeight;
  12.     private double scaledWidthD;
  13.     private double scaledHeightD;
  14.     private int scaleFactor;
  15.     private static final String __OBFID = "CL_00000666";
  16.  
  17.     public ScaledResolution(Minecraft p_i46324_1_, int p_i46324_2_, int p_i46324_3_)
  18.     {
  19.         this.scaledWidth = p_i46324_2_;
  20.         this.scaledHeight = p_i46324_3_;
  21.         this.scaleFactor = 1;
  22.         boolean var4 = p_i46324_1_.func_152349_b();
  23.    
  24.  
  25.         int guiScale = p_i46324_1_.gameSettings.guiScale;
  26.         if(Minecraft.getMinecraft().currentScreen instanceof Unsized) {        
  27.             guiScale = 2;
  28.         }
  29.  
  30.         float scaleWidthModifier = 2;
  31.         float scaleHeightModifier = 2;
  32.         float widthSize = 320;
  33.         float heightSize = 240;
  34.         float largeScaleFactor = 2.5F;
  35.  
  36.         if (guiScale == 0) {
  37.             guiScale = 1000;
  38.         }
  39.         while (this.scaleFactor < guiScale && this.scaledWidth / (this.scaleFactor + scaleWidthModifier) >= widthSize
  40.                 && this.scaledHeight / (this.scaleFactor + scaleHeightModifier) >= heightSize) {
  41.             ++this.scaleFactor;
  42.         }
  43.  
  44.         if (var4 && this.scaleFactor % 2 != 0 && this.scaleFactor != 1) {
  45.             --this.scaleFactor;
  46.         }
  47.        
  48.         this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
  49.         this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
  50.         this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
  51.         this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
  52.     }
  53.  
  54.     public int getScaledWidth()
  55.     {
  56.         return this.scaledWidth;
  57.     }
  58.  
  59.     public int getScaledHeight()
  60.     {
  61.         return this.scaledHeight;
  62.     }
  63.  
  64.     public double getScaledWidth_double()
  65.     {
  66.         return this.scaledWidthD;
  67.     }
  68.  
  69.     public double getScaledHeight_double()
  70.     {
  71.         return this.scaledHeightD;
  72.     }
  73.  
  74.     public int getScaleFactor()
  75.     {
  76.         return this.scaleFactor;
  77.     }
  78. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top