Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.87 KB | None | 0 0
  1. import java.util.Vector;
  2.  
  3. import net.minecraft.client.Minecraft;
  4. import org.lwjgl.input.*;
  5. import org.lwjgl.opengl.GL11;
  6.  
  7.  
  8.  
  9. public class mod_IngameInvedit extends BaseMod{
  10.  
  11.     public class osdrenderer extends nc {
  12.        
  13.         public osdrenderer()
  14.         {
  15.             super();
  16.             renderer = new al();
  17.         }
  18.        
  19.         @SuppressWarnings("static-access")
  20.         public void doit(int centeridx,Minecraft minecraft)
  21.         {
  22.             GL11.glDisable(3042 /*GL_BLEND*/);
  23.             GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
  24.             ((p)null).b();
  25.             lw kl1 = new lw(minecraft.c, minecraft.d);
  26.            
  27.             //renderer.a(minecraft.o, minecraft.n, minecraft.g.e.a(), kl1.a() - 24, kl1.b()/2);
  28.             //renderer.a(minecraft.o, minecraft.n, minecraft.g.e.a(), 0, 0);
  29.             for (int i = -3; i <= 3; i++)
  30.             {
  31.                
  32.                 renderer.a(minecraft.o, minecraft.n, switchidx(centeridx + i), kl1.a() - (i == 0 ? 30 : 24), kl1.b()/2 + 19*i);
  33.             }
  34.            
  35.             ((p)null).a();
  36.            
  37.             GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
  38.             if(switchidx(centeridx).l() != null)
  39.             {
  40.                 String S = ((n)null).a().b(switchidx(centeridx).l());
  41.                 if(givesize > 0)
  42.                 {
  43.                     if(S == null)
  44.                         S=""+givesize;
  45.                     else
  46.                         S = "("+givesize+") "+S;
  47.                 }
  48.                    
  49.                 if (S != null && S.length() > 0)
  50.                     minecraft.o.a(S,(kl1.a() - minecraft.o.a(S)) - 10,kl1.b() - 10, 0xFFFFFF);
  51.             }
  52.         }
  53.         public al renderer;
  54.        
  55.     }
  56.    
  57.     public String displayMessage = "";
  58.     public boolean isfirstrun = true;
  59.     public Vector<pj> blocks;
  60.     public Vector<eo> items;
  61.     public static osdrenderer ren;
  62.     private static int InfNum = 99;
  63.     public int zidx = 0;
  64.     private ModSettings Settings;
  65.     private ModSettingScreen Screen;
  66.     private SettingInt sidebarscroll;
  67.     private SettingInt stacksizescroll;
  68.     private SettingKey sidebarup;
  69.     private SettingKey sidebardown;
  70.     private SettingKey stacksizeup;
  71.     private SettingKey stacksizedown;
  72.     private SettingKey bringitemdown;
  73.     private SettingKey seektoitem;
  74.     private SettingBoolean enableinf;
  75.     private SettingBoolean enableautoresetsmp;
  76.     private SettingBoolean enablemodssp;
  77.     private SettingBoolean enablemodsmp;
  78.     private SettingBoolean enablesmpzan;
  79.    
  80.     public mod_IngameInvedit()
  81.     {
  82.          ren = new osdrenderer();
  83.          blocks = new Vector<pj>();
  84.          items = new Vector<eo>();
  85.          Settings = new ModSettings("mod_IngameInveditClone");
  86.          Screen = new ModSettingScreen("IngameInvedit");
  87.          
  88.          sidebarscroll=Settings.addSetting(Screen, "Sidebar Initial MS Per Sroll","sidebar_frame_per_scroll", 100, 10,1,500);
  89.          stacksizescroll=Settings.addSetting(Screen, "Stacksize Initial MS Per Sroll","stacksize_frame_per_scroll", 100, 10,1,500);
  90.          
  91.          sidebarup = Settings.addSetting(Screen, "Sidebar Up","sidebar_scrollup", Keyboard.KEY_EQUALS);
  92.          stacksizeup = Settings.addSetting(Screen, "Stacksize Up","stacksize_scrollup", Keyboard.KEY_MINUS);
  93.          
  94.          sidebardown = Settings.addSetting(Screen, "Sidebar Down","sidebar_scrolldown", Keyboard.KEY_RBRACKET);
  95.          stacksizedown = Settings.addSetting(Screen, "Stacksize down","stacksize_scrolldown", Keyboard.KEY_LBRACKET);
  96.          
  97.          bringitemdown = Settings.addSetting(Screen, "Change Inv. Item","bringitemdown", Keyboard.KEY_P);
  98.          seektoitem = Settings.addSetting(Screen, "Seek to Item","seektoitem", Keyboard.KEY_0);
  99.          
  100.          enableautoresetsmp = Settings.addSetting(Screen, "Stacksize Reset SMP","autoreset",true,"ON","OFF");
  101.          enableinf = Settings.addSetting(Screen, "Infinite Stacks SSP","infinitestacks",true,"ON","OFF");
  102.          enablemodssp = Settings.addSetting(Screen, "Enable mod SSP","isenabled",true,"ON", "OFF");
  103.          enablemodsmp = Settings.addSetting(Screen, "Enable mod SMP","isenabledsmp",false,"ON", "OFF");
  104.          
  105.          enablesmpzan = Settings.addSetting(Screen, "Enable Zan Servermod Mode","zanmode",false,"ON", "OFF");
  106.        
  107.          Settings.load();
  108.     }
  109.    
  110.     public gz switchidx(int idx)
  111.     {
  112.         while(idx<0)
  113.         {
  114.             idx += blocks.size() + items.size();
  115.         }
  116.         while(idx>=blocks.size() + items.size())
  117.         {
  118.             idx -= blocks.size() + items.size();
  119.         }
  120.         if(idx < blocks.size())
  121.         {
  122.             return new gz(blocks.get(idx));
  123.         }
  124.         else
  125.         {
  126.             return new gz(items.get(idx - blocks.size()));
  127.         }
  128.     }
  129.    
  130.     public int idx_at_id(int id)
  131.     {
  132.         for(int i=0; i<blocks.size() + items.size(); i++)
  133.         {
  134.             if (switchidx(i).c == id)
  135.             {
  136.                 return i;
  137.             }
  138.         }
  139.         return -1;
  140.     }
  141.    
  142.     int swapvaluesinput=0;
  143.     int givesize = 0;
  144.    
  145.     int lastposSidebar = 0;
  146.     int lastposStack = 0;
  147.     long nexttickSidebar = 0;
  148.     long nexttickStack = 0;
  149.     int accelSidebar = 0;
  150.     int accelStack = 0;
  151.     private int getSidebarScroll()
  152.     {
  153.         boolean scrollup = sidebarup.isKeyDown();
  154.         boolean scrolldown = sidebardown.isKeyDown();
  155.         if((scrollup && scrolldown))
  156.         {
  157.             lastposSidebar = 0;
  158.             return 0;
  159.         }
  160.         if((!scrollup && !scrolldown))
  161.         {
  162.             nexttickSidebar = 0; // if neither is down,
  163.             return 0;
  164.         }
  165.         if((scrollup && lastposSidebar != 1) || (scrolldown && lastposSidebar != -1))
  166.             nexttickSidebar = 0; // or if it changed, set the last tick to 0 (We don't want people waiting for no reason)
  167.        
  168.         if(nexttickSidebar == 0) accelSidebar = 0; // if there's no previous ticks for any reason, wipe the acceleration.
  169.        
  170.         if(nexttickSidebar > System.currentTimeMillis())
  171.             return 0; // not time to do anything yet. Return 0.
  172.        
  173.         accelSidebar++;
  174.         lastposSidebar = (scrollup ? 1 : -1);
  175.         int newaccel = (accelSidebar / 6);
  176.         if(newaccel > 3) newaccel = 3;
  177.         double temp = sidebarscroll.value * (1 - ((double)newaccel / 6D));
  178.         nexttickSidebar = (long)temp + System.currentTimeMillis();
  179.         return (scrollup ? -1 : 1);
  180.     }
  181.    
  182.     private int getStackScroll()
  183.     {
  184.         boolean scrollup = stacksizeup.isKeyDown();
  185.         boolean scrolldown = stacksizedown.isKeyDown();
  186.         if((scrollup && scrolldown))
  187.         {
  188.             lastposStack = 0;
  189.             return 0;
  190.         }
  191.         if((!scrollup && !scrolldown))
  192.         {
  193.             nexttickStack = 0; // if neither is down,
  194.             return 0;
  195.         }
  196.         if((scrollup && lastposStack != 1) || (scrolldown && lastposStack != -1))
  197.             nexttickStack = 0; // or if it changed, set the last tick to 0 (We don't want people waiting for no reason)
  198.        
  199.         if(nexttickStack == 0) accelStack = 0; // if there's no previous ticks for any reason, wipe the acceleration.
  200.        
  201.         if(nexttickStack > System.currentTimeMillis())
  202.             return 0; // not time to do anything yet. Return 0.
  203.         lastposStack = (scrollup ? 1 : -1);
  204.         accelStack++;
  205.        
  206.         int newaccel = (accelStack / 6);
  207.         if(newaccel > 3) newaccel = 3;
  208.         double temp = stacksizescroll.value * (1 - ((double)newaccel / 6D));
  209.         nexttickStack = (long)temp + System.currentTimeMillis();
  210.         return (scrollup ? 1 : -1);
  211.     }
  212.    
  213.     public void OSDHook(Minecraft minecraft, boolean ismenu)
  214.     {
  215.         if(ismenu)
  216.             return;
  217.         if(isfirstrun)
  218.         {
  219.             isfirstrun = false;
  220.             if(pj.m != null)
  221.                 for (int i=0; i < pj.m.length; i++)
  222.                 {
  223.                     if(pj.m[i] != null)
  224.                     {
  225.                         blocks.add(pj.m[i]);
  226.                     }
  227.                 }
  228.             if(eo.c != null)
  229.                 for (int i=0; i < eo.c.length; i++)
  230.                 {
  231.                     if(eo.c[i] != null)
  232.                     {
  233.                         items.add(eo.c[i]);
  234.                     }
  235.                 }
  236.         }
  237.         boolean changessize = false;
  238.         if((minecraft.e.z && enablemodsmp.value) || (!minecraft.e.z && enablemodssp.value))
  239.         {
  240.             zidx += getSidebarScroll();
  241.             int stack = getStackScroll();
  242.             if(stack != 0) changessize = true;
  243.             givesize += stack;
  244.             if(1 > givesize)
  245.                 givesize = 64;
  246.             if(givesize > 64)
  247.             {
  248.                 if(!enableinf.value || minecraft.e.z)
  249.                     givesize = 1;
  250.                 else
  251.                 {
  252.                     if(givesize == 65 || givesize == InfNum)
  253.                         givesize = InfNum;
  254.                     else
  255.                         givesize = 1;
  256.                 }
  257.             }
  258.         }
  259.        
  260.         if((minecraft.e.z && enablemodsmp.value))
  261.         {
  262.             if (swapvaluesinput != 0)
  263.             {
  264.                 if (!Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
  265.                 {
  266.                     swapvaluesinput = 0;
  267.                 }
  268.             }
  269.             else if (Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
  270.             {
  271.                 swapvaluesinput = 1;
  272.                 if (minecraft.g.f.b() != null)
  273.                 {
  274.                     int ii=idx_at_id(minecraft.g.f.b().c);
  275.                     if(ii >= 0)
  276.                     {
  277.                         zidx = ii;
  278.                     }
  279.                 }
  280.             }
  281.             else if (Keyboard.isKeyDown(bringitemdown.value))
  282.             {
  283.                 swapvaluesinput = -1;
  284.                
  285.                 if(givesize > 0)
  286.                 {
  287.                     minecraft.g.a("/give "+(enablesmpzan.value ? "" : minecraft.g.o+" ")+switchidx(zidx).c+" "+givesize);
  288.                     if(enableautoresetsmp.get())
  289.                     {
  290.                         givesize = 0;
  291.                     }
  292.                 }
  293.                 else
  294.                 {
  295.                     minecraft.g.a("/give "+(enablesmpzan.value ? "" : minecraft.g.o+" ")+switchidx(zidx).c);
  296.                 }
  297.             }
  298.         }
  299.         else if ( !minecraft.e.z && enablemodssp.value)
  300.         {
  301.             if (minecraft.g.f.b() == null && bringitemdown.isKeyDown())
  302.             {
  303.                 minecraft.g.f.a(minecraft.g.f.c,switchidx(zidx));
  304.             }
  305.             if((changessize || bringitemdown.isKeyDown()) && minecraft.g.f.b() != null)
  306.                 minecraft.g.f.b().a = givesize;
  307.             if (swapvaluesinput != 0)
  308.             {
  309.                 if (!Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
  310.                 {
  311.                     swapvaluesinput = 0;
  312.                 }
  313.             }
  314.             else if (Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
  315.             {
  316.                 swapvaluesinput = 1;
  317.                 if (minecraft.g.f.b() != null)
  318.                 {
  319.                     int ii=idx_at_id(minecraft.g.f.b().c);
  320.                     if(ii >= 0)
  321.                     {
  322.                         zidx = ii;
  323.                     }
  324.                 }
  325.             }
  326.             else if (Keyboard.isKeyDown(bringitemdown.value))
  327.             {
  328.                 swapvaluesinput = -1;
  329.                 if (minecraft.g.f.b() != null)
  330.                 {
  331.                     minecraft.g.f.b().c = switchidx(zidx).c;
  332.                 }
  333.                 else
  334.                 {
  335.                     minecraft.g.f.a(minecraft.g.f.c,switchidx(zidx));
  336.                     //add new ..
  337.                 }
  338.             }
  339.             if(enableinf.value)
  340.             {
  341.                 for (int i = 0; i < minecraft.g.f.a.length; i++) {
  342.                       if ((minecraft.g.f.a[i] == null) || (minecraft.g.f.a[i].a <= 64))
  343.                         continue;
  344.                       minecraft.g.f.a[i].a = InfNum;
  345.                     }
  346.             }
  347.         }
  348.         else
  349.         {
  350.             return;
  351.         }
  352.        
  353.         while(zidx<0)
  354.         {
  355.             zidx += blocks.size() + items.size();
  356.         }
  357.         while(zidx>=blocks.size() + items.size())
  358.         {
  359.             zidx -= blocks.size() + items.size();
  360.         }
  361.         ren.doit(zidx, minecraft);
  362.     }
  363.  
  364.     public String Version() {
  365.         return "1.2_01 - 4";
  366.     }
  367. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement