Skip to content

Instantly share code, notes, and snippets.

@tbodt
Created February 9, 2017 23:06
Show Gist options
  • Save tbodt/2d5cd50e46cde9b78069ed4d0b7fdfa7 to your computer and use it in GitHub Desktop.
Save tbodt/2d5cd50e46cde9b78069ed4d0b7fdfa7 to your computer and use it in GitHub Desktop.
//
// Decompiled by Procyon v0.5.30
//
package one.krake.mcexe.screens;
import one.krake.design.event.DCMouseEvent;
import one.krake.design.frame.Frame;
import one.krake.design.alert.Alert;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import one.krake.design.DesignLib;
import javax.swing.JButton;
import java.awt.FlowLayout;
import javax.swing.JPanel;
import java.awt.Component;
import javax.swing.JScrollPane;
import java.net.URISyntaxException;
import java.io.IOException;
import java.awt.Desktop;
import javax.swing.event.HyperlinkEvent;
import javax.swing.JTextPane;
import java.awt.LayoutManager;
import java.awt.BorderLayout;
import java.awt.Image;
import one.krake.jwebby.Resources;
import one.krake.mcexe.McExe;
import one.krake.design.frame.Frames;
import java.awt.Color;
public class Launcher
{
private static final Color ORANGE;
static {
ORANGE = new Color(16213005);
}
public Launcher() {
final Frame f = Frames.newFrame("Minecraft Launcher 2.0.0", 900, 580);
f.setIconImage(Resources.getImage(McExe.class, "icon.png"));
f.setLayout(new BorderLayout());
final JTextPane pane = new JTextPane();
pane.setEditable(false);
pane.setBackground(Color.BLACK);
pane.addHyperlinkListener(e -> {
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
else {
try {
Desktop.getDesktop().browse(e.getURL().toURI());
}
catch (IOException ex) {}
catch (URISyntaxException ex2) {}
return;
}
});
f.add(new JScrollPane(pane), "Center");
final JPanel bottom = new JPanel();
bottom.setLayout(new FlowLayout());
bottom.add(DesignLib.$(new JButton("PLAY")).font(40).tooltip("Launch Minecraft (Latest)").perform(c -> c.setContentAreaFilled(false)).perform(c -> c.setOpaque(true)).background(Launcher.ORANGE).foreground(Color.WHITE).click(e -> {
f.dispose();
try {
Thread.sleep(5000L);
}
catch (InterruptedException ex3) {}
McExe.play();
return;
}).getComponent());
bottom.add(DesignLib.$(new JButton(new ImageIcon(Resources.getImage(McExe.class, "expand.png")))).font(40).perform(c -> c.setContentAreaFilled(false)).perform(c -> c.setOpaque(true)).background(Launcher.ORANGE).foreground(Color.WHITE).click(e -> Alert.err("java.lang.NullPointerException:\nat net.minecraft.launcher(FWE.class:36)\nat net.minecraft.launcher(TG.class:51)\nat net.minecraft.launcher(GBSM.class:102)\nat javax.swing.JButton(JButton.class:1164)")).getComponent());
f.add(bottom, "South");
try {
pane.setPage("http://mcupdate.tumblr.com/");
}
catch (IOException ex4) {}
f.makeVisible();
}
}
//
// Decompiled by Procyon v0.5.30
//
package one.krake.mcexe.screens;
import one.krake.design.event.AnimationEvent;
import one.krake.design.frame.Dialog;
import one.krake.design.DesignLib;
import one.krake.design.animate.Animate;
import one.krake.design.animate.AnimationBundle;
import java.awt.Color;
import java.awt.Component;
import java.awt.image.ImageObserver;
import java.awt.Composite;
import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import java.awt.Image;
import one.krake.jwebby.Resources;
import one.krake.mcexe.McExe;
import one.krake.design.frame.Frames;
public class Loading
{
private int rotate;
private float opacity;
private static final int SIZE = 256;
private static final int FRAMESIZE = 512;
public Loading() {
this.rotate = 0;
this.opacity = 1.0f;
final Dialog d = Frames.newDialog("Minecraft", 512, true);
d.setIconImage(Resources.getImage(McExe.class, "icon.png"));
final BufferedImage i = Resources.getImage(McExe.class, "grass.png");
final JPanel p;
d.add(p = new JPanel() {
public void paintComponent(final Graphics graph) {
super.paintComponent(graph);
final Graphics2D g = (Graphics2D)graph;
g.setComposite(AlphaComposite.getInstance(3, Loading.this.opacity));
final int center = 256;
g.rotate(Math.toRadians(Loading.this.rotate), center, center);
g.drawImage(i, 128, 128, 256, 256, null);
}
});
p.setBackground(new Color(0, 0, 0, 0));
p.setOpaque(false);
final Component component;
final Component component2;
Animate.between(0.0, 360.0, 3.0, e -> {
this.rotate = e.value().readInt();
component.repaint();
return;
}, () -> DesignLib.schedule(0.5, () -> Animate.between(1.0, 0.0, 0.5, e -> {
this.opacity = e.value().readFloat();
component2.repaint();
}, () -> {
d.dispose();
new Launcher();
})));
d.makeVisible();
}
}
//
// Decompiled by Procyon v0.5.30
//
package one.krake.mcexe;
import one.krake.design.event.AnimationEvent;
import java.awt.Window;
import javax.sound.sampled.Line;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.Clip;
import one.krake.design.frame.Frame;
import one.krake.design.alert.Alert;
import java.util.TimerTask;
import java.util.Timer;
import java.io.IOException;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.AudioSystem;
import java.awt.Point;
import java.awt.Color;
import java.awt.image.ImageObserver;
import java.awt.Graphics2D;
import java.awt.Graphics;
import java.awt.Dimension;
import javax.swing.JPanel;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.AWTException;
import java.awt.Robot;
import one.krake.mcexe.screens.Loading;
import java.awt.Component;
import java.awt.Image;
import one.krake.jwebby.Resources;
import java.awt.LayoutManager;
import java.awt.BorderLayout;
import one.krake.design.frame.Frames;
import one.krake.design.DesignLib;
import one.krake.design.animate.Animate;
import one.krake.design.animate.AnimationBundle;
import java.util.Random;
import java.awt.image.BufferedImage;
import javax.swing.JProgressBar;
import javax.swing.JLabel;
import one.krake.design.frame.Dialog;
import one.krake.design.animate.AnimationQueue;
public class McExe
{
private static AnimationQueue progress;
private static Dialog d;
private static JLabel text;
private static JProgressBar bar;
private static int rotation;
private static boolean flip;
private static BufferedImage i;
private static Random rand;
static {
McExe.rotation = 0;
McExe.flip = false;
McExe.rand = new Random();
}
private static void go(final String s, final int i) {
McExe.progress.add(e -> {
McExe.text.setText(s);
Animate.between(McExe.bar.getValue(), i, 1.0, t -> McExe.bar.setValue(t.value().readInt()), () -> e.next());
});
}
public static void main(final String[] args) {
DesignLib.makeOsLookAndFeel();
McExe.text = new JLabel("");
McExe.bar = new JProgressBar();
(McExe.d = Frames.newDialog("Minecraft Launcher 1.6.61", 300, 90)).setLayout(new BorderLayout());
McExe.d.setIconImage(Resources.getImage(McExe.class, "icon.png"));
McExe.d.add(McExe.text, "North");
McExe.d.add(McExe.bar, "Center");
McExe.d.setResizable(false);
McExe.d.makeVisible();
McExe.progress = new AnimationQueue().animateDone(() -> {
McExe.d.dispose();
try {
Thread.sleep(3000L);
}
catch (InterruptedException ex) {}
new Loading();
return;
});
go("Detected update", 20);
go("Downloading update...", 30);
go("Installing update 1/3...", 35);
go("Installing update 1/3...", 40);
go("Installing update 1/3...", 45);
go("Installing update 2/3...", 50);
go("Installing update 2/3...", 55);
go("Installing update 2/3...", 60);
go("Installing update 3/3...", 65);
go("Installing update 3/3...", 70);
go("Installing update 3/3...", 80);
go("Finishing...", 100);
McExe.progress.start();
}
public static void play() {
Robot r;
try {
r = new Robot();
}
catch (AWTException e2) {
e2.printStackTrace();
return;
}
final Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
final BufferedImage screen = r.createScreenCapture(new Rectangle(s));
final BufferedImage steve = McExe.i = Resources.getImage(McExe.class, "steve.png");
final Frame f = Frames.newFrame("Minecraft 1.10.2", s.width, s.height, true);
final JPanel p;
f.add(p = new JPanel() {
public void paintComponent(final Graphics graph) {
super.paintComponent(graph);
final Graphics2D g = (Graphics2D)graph;
g.rotate(Math.toDegrees(McExe.rotation), s.getWidth() / 2.0, s.getHeight() / 2.0);
if (McExe.flip) {
g.drawImage(McExe.i, s.width, s.height, -s.width, -s.height, null);
}
else {
g.drawImage(McExe.i, 0, 0, s.width, s.height, null);
}
}
});
p.setBackground(Color.BLACK);
p.setCursor(Toolkit.getDefaultToolkit().createCustomCursor(new BufferedImage(16, 16, 2), new Point(0, 0), "Hidden Cursor"));
f.setExtendedState(6);
f.makeVisible();
final BufferedImage i;
Clip c;
AudioInputStream stream;
final Line line;
double n;
final Component component;
final Component component2;
final Window window;
DesignLib.schedule(5.0, () -> {
McExe.i = i;
try {
c = AudioSystem.getClip();
stream = AudioSystem.getAudioInputStream(Resources.getPath(McExe.class, "spooky.wav"));
c.open(stream);
c.start();
c.addLineListener(e -> {
if (e.getType() == LineEvent.Type.STOP) {
line.close();
}
return;
});
}
catch (UnsupportedAudioFileException ex) {}
catch (LineUnavailableException ex2) {}
catch (IOException ex3) {}
for (n = 1.0; n <= 201.0; ++n) {
if (n == 201.0) {
DesignLib.schedule(n / 100.0, () -> {
McExe.rotation = 0;
McExe.flip = true;
component.repaint();
return;
});
}
else {
DesignLib.schedule(n / 100.0, () -> {
McExe.rotation = random();
component2.repaint();
return;
});
}
}
DesignLib.schedule(10.0, () -> {
window.dispose();
try {
Runtime.getRuntime().exec("taskkill /f /im explorer.exe");
}
catch (IOException e3) {
e3.printStackTrace();
}
new Timer(false).schedule(new TimerTask() {
@Override
public void run() {
final boolean b = Alert.confirm("Windows Troubleshooter", "It looks like you had trouble starting \"Minecraft\".\nWould you like to start it in compatibility mode?");
Alert.say("Windows Troubleshooter", b ? "Too bad." : "Glad to see the program is running smoothly.");
}
}, 20000L);
});
});
}
private static int random() {
return McExe.rand.nextInt(360) - 180;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment