Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Vector;
- import net.minecraft.client.Minecraft;
- import org.lwjgl.input.*;
- import org.lwjgl.opengl.GL11;
- public class mod_IngameInvedit extends BaseMod{
- public class osdrenderer extends nc {
- public osdrenderer()
- {
- super();
- renderer = new al();
- }
- @SuppressWarnings("static-access")
- public void doit(int centeridx,Minecraft minecraft)
- {
- GL11.glDisable(3042 /*GL_BLEND*/);
- GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
- ((p)null).b();
- lw kl1 = new lw(minecraft.c, minecraft.d);
- //renderer.a(minecraft.o, minecraft.n, minecraft.g.e.a(), kl1.a() - 24, kl1.b()/2);
- //renderer.a(minecraft.o, minecraft.n, minecraft.g.e.a(), 0, 0);
- for (int i = -3; i <= 3; i++)
- {
- renderer.a(minecraft.o, minecraft.n, switchidx(centeridx + i), kl1.a() - (i == 0 ? 30 : 24), kl1.b()/2 + 19*i);
- }
- ((p)null).a();
- GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
- if(switchidx(centeridx).l() != null)
- {
- String S = ((n)null).a().b(switchidx(centeridx).l());
- if(givesize > 0)
- {
- if(S == null)
- S=""+givesize;
- else
- S = "("+givesize+") "+S;
- }
- if (S != null && S.length() > 0)
- minecraft.o.a(S,(kl1.a() - minecraft.o.a(S)) - 10,kl1.b() - 10, 0xFFFFFF);
- }
- }
- public al renderer;
- }
- public String displayMessage = "";
- public boolean isfirstrun = true;
- public Vector<pj> blocks;
- public Vector<eo> items;
- public static osdrenderer ren;
- private static int InfNum = 99;
- public int zidx = 0;
- private ModSettings Settings;
- private ModSettingScreen Screen;
- private SettingInt sidebarscroll;
- private SettingInt stacksizescroll;
- private SettingKey sidebarup;
- private SettingKey sidebardown;
- private SettingKey stacksizeup;
- private SettingKey stacksizedown;
- private SettingKey bringitemdown;
- private SettingKey seektoitem;
- private SettingBoolean enableinf;
- private SettingBoolean enableautoresetsmp;
- private SettingBoolean enablemodssp;
- private SettingBoolean enablemodsmp;
- private SettingBoolean enablesmpzan;
- public mod_IngameInvedit()
- {
- ren = new osdrenderer();
- blocks = new Vector<pj>();
- items = new Vector<eo>();
- Settings = new ModSettings("mod_IngameInveditClone");
- Screen = new ModSettingScreen("IngameInvedit");
- sidebarscroll=Settings.addSetting(Screen, "Sidebar Initial MS Per Sroll","sidebar_frame_per_scroll", 100, 10,1,500);
- stacksizescroll=Settings.addSetting(Screen, "Stacksize Initial MS Per Sroll","stacksize_frame_per_scroll", 100, 10,1,500);
- sidebarup = Settings.addSetting(Screen, "Sidebar Up","sidebar_scrollup", Keyboard.KEY_EQUALS);
- stacksizeup = Settings.addSetting(Screen, "Stacksize Up","stacksize_scrollup", Keyboard.KEY_MINUS);
- sidebardown = Settings.addSetting(Screen, "Sidebar Down","sidebar_scrolldown", Keyboard.KEY_RBRACKET);
- stacksizedown = Settings.addSetting(Screen, "Stacksize down","stacksize_scrolldown", Keyboard.KEY_LBRACKET);
- bringitemdown = Settings.addSetting(Screen, "Change Inv. Item","bringitemdown", Keyboard.KEY_P);
- seektoitem = Settings.addSetting(Screen, "Seek to Item","seektoitem", Keyboard.KEY_0);
- enableautoresetsmp = Settings.addSetting(Screen, "Stacksize Reset SMP","autoreset",true,"ON","OFF");
- enableinf = Settings.addSetting(Screen, "Infinite Stacks SSP","infinitestacks",true,"ON","OFF");
- enablemodssp = Settings.addSetting(Screen, "Enable mod SSP","isenabled",true,"ON", "OFF");
- enablemodsmp = Settings.addSetting(Screen, "Enable mod SMP","isenabledsmp",false,"ON", "OFF");
- enablesmpzan = Settings.addSetting(Screen, "Enable Zan Servermod Mode","zanmode",false,"ON", "OFF");
- Settings.load();
- }
- public gz switchidx(int idx)
- {
- while(idx<0)
- {
- idx += blocks.size() + items.size();
- }
- while(idx>=blocks.size() + items.size())
- {
- idx -= blocks.size() + items.size();
- }
- if(idx < blocks.size())
- {
- return new gz(blocks.get(idx));
- }
- else
- {
- return new gz(items.get(idx - blocks.size()));
- }
- }
- public int idx_at_id(int id)
- {
- for(int i=0; i<blocks.size() + items.size(); i++)
- {
- if (switchidx(i).c == id)
- {
- return i;
- }
- }
- return -1;
- }
- int swapvaluesinput=0;
- int givesize = 0;
- int lastposSidebar = 0;
- int lastposStack = 0;
- long nexttickSidebar = 0;
- long nexttickStack = 0;
- int accelSidebar = 0;
- int accelStack = 0;
- private int getSidebarScroll()
- {
- boolean scrollup = sidebarup.isKeyDown();
- boolean scrolldown = sidebardown.isKeyDown();
- if((scrollup && scrolldown))
- {
- lastposSidebar = 0;
- return 0;
- }
- if((!scrollup && !scrolldown))
- {
- nexttickSidebar = 0; // if neither is down,
- return 0;
- }
- if((scrollup && lastposSidebar != 1) || (scrolldown && lastposSidebar != -1))
- nexttickSidebar = 0; // or if it changed, set the last tick to 0 (We don't want people waiting for no reason)
- if(nexttickSidebar == 0) accelSidebar = 0; // if there's no previous ticks for any reason, wipe the acceleration.
- if(nexttickSidebar > System.currentTimeMillis())
- return 0; // not time to do anything yet. Return 0.
- accelSidebar++;
- lastposSidebar = (scrollup ? 1 : -1);
- int newaccel = (accelSidebar / 6);
- if(newaccel > 3) newaccel = 3;
- double temp = sidebarscroll.value * (1 - ((double)newaccel / 6D));
- nexttickSidebar = (long)temp + System.currentTimeMillis();
- return (scrollup ? -1 : 1);
- }
- private int getStackScroll()
- {
- boolean scrollup = stacksizeup.isKeyDown();
- boolean scrolldown = stacksizedown.isKeyDown();
- if((scrollup && scrolldown))
- {
- lastposStack = 0;
- return 0;
- }
- if((!scrollup && !scrolldown))
- {
- nexttickStack = 0; // if neither is down,
- return 0;
- }
- if((scrollup && lastposStack != 1) || (scrolldown && lastposStack != -1))
- nexttickStack = 0; // or if it changed, set the last tick to 0 (We don't want people waiting for no reason)
- if(nexttickStack == 0) accelStack = 0; // if there's no previous ticks for any reason, wipe the acceleration.
- if(nexttickStack > System.currentTimeMillis())
- return 0; // not time to do anything yet. Return 0.
- lastposStack = (scrollup ? 1 : -1);
- accelStack++;
- int newaccel = (accelStack / 6);
- if(newaccel > 3) newaccel = 3;
- double temp = stacksizescroll.value * (1 - ((double)newaccel / 6D));
- nexttickStack = (long)temp + System.currentTimeMillis();
- return (scrollup ? 1 : -1);
- }
- public void OSDHook(Minecraft minecraft, boolean ismenu)
- {
- if(ismenu)
- return;
- if(isfirstrun)
- {
- isfirstrun = false;
- if(pj.m != null)
- for (int i=0; i < pj.m.length; i++)
- {
- if(pj.m[i] != null)
- {
- blocks.add(pj.m[i]);
- }
- }
- if(eo.c != null)
- for (int i=0; i < eo.c.length; i++)
- {
- if(eo.c[i] != null)
- {
- items.add(eo.c[i]);
- }
- }
- }
- boolean changessize = false;
- if((minecraft.e.z && enablemodsmp.value) || (!minecraft.e.z && enablemodssp.value))
- {
- zidx += getSidebarScroll();
- int stack = getStackScroll();
- if(stack != 0) changessize = true;
- givesize += stack;
- if(1 > givesize)
- givesize = 64;
- if(givesize > 64)
- {
- if(!enableinf.value || minecraft.e.z)
- givesize = 1;
- else
- {
- if(givesize == 65 || givesize == InfNum)
- givesize = InfNum;
- else
- givesize = 1;
- }
- }
- }
- if((minecraft.e.z && enablemodsmp.value))
- {
- if (swapvaluesinput != 0)
- {
- if (!Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
- {
- swapvaluesinput = 0;
- }
- }
- else if (Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
- {
- swapvaluesinput = 1;
- if (minecraft.g.f.b() != null)
- {
- int ii=idx_at_id(minecraft.g.f.b().c);
- if(ii >= 0)
- {
- zidx = ii;
- }
- }
- }
- else if (Keyboard.isKeyDown(bringitemdown.value))
- {
- swapvaluesinput = -1;
- if(givesize > 0)
- {
- minecraft.g.a("/give "+(enablesmpzan.value ? "" : minecraft.g.o+" ")+switchidx(zidx).c+" "+givesize);
- if(enableautoresetsmp.get())
- {
- givesize = 0;
- }
- }
- else
- {
- minecraft.g.a("/give "+(enablesmpzan.value ? "" : minecraft.g.o+" ")+switchidx(zidx).c);
- }
- }
- }
- else if ( !minecraft.e.z && enablemodssp.value)
- {
- if (minecraft.g.f.b() == null && bringitemdown.isKeyDown())
- {
- minecraft.g.f.a(minecraft.g.f.c,switchidx(zidx));
- }
- if((changessize || bringitemdown.isKeyDown()) && minecraft.g.f.b() != null)
- minecraft.g.f.b().a = givesize;
- if (swapvaluesinput != 0)
- {
- if (!Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
- {
- swapvaluesinput = 0;
- }
- }
- else if (Keyboard.isKeyDown(seektoitem.value) && !Keyboard.isKeyDown(bringitemdown.value))
- {
- swapvaluesinput = 1;
- if (minecraft.g.f.b() != null)
- {
- int ii=idx_at_id(minecraft.g.f.b().c);
- if(ii >= 0)
- {
- zidx = ii;
- }
- }
- }
- else if (Keyboard.isKeyDown(bringitemdown.value))
- {
- swapvaluesinput = -1;
- if (minecraft.g.f.b() != null)
- {
- minecraft.g.f.b().c = switchidx(zidx).c;
- }
- else
- {
- minecraft.g.f.a(minecraft.g.f.c,switchidx(zidx));
- //add new ..
- }
- }
- if(enableinf.value)
- {
- for (int i = 0; i < minecraft.g.f.a.length; i++) {
- if ((minecraft.g.f.a[i] == null) || (minecraft.g.f.a[i].a <= 64))
- continue;
- minecraft.g.f.a[i].a = InfNum;
- }
- }
- }
- else
- {
- return;
- }
- while(zidx<0)
- {
- zidx += blocks.size() + items.size();
- }
- while(zidx>=blocks.size() + items.size())
- {
- zidx -= blocks.size() + items.size();
- }
- ren.doit(zidx, minecraft);
- }
- public String Version() {
- return "1.2_01 - 4";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement