Skip to content

Instantly share code, notes, and snippets.

@PhoenixVX
Last active October 22, 2022 23:53
Show Gist options
  • Save PhoenixVX/86d973448d8e6832e611f4dd0cc01758 to your computer and use it in GitHub Desktop.
Save PhoenixVX/86d973448d8e6832e611f4dd0cc01758 to your computer and use it in GitHub Desktop.
package net.minecraft.src;
public class FakeWorld extends World {
public FakeWorld() {
super();
}
}
public class GuiButton extends Gui {
// fields...
// Create variable width/height buttons
protected GuiButton(int i1, int i2, int i3, int i4, int i5, String string6) {
this.width = i4;
this.height = i5;
this.enabled = true;
this.enabled2 = true;
this.id = i1;
this.xPosition = i2;
this.yPosition = i3;
this.width = i4;
this.height = i5;
this.displayString = string6;
}
}
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class GuiMainMenu extends GuiScreen {
private float updateCounter = 0.0F;
private String[] splashes = new String[]{"Pre-beta!", "As seen on TV!", "Awesome!", "100% pure!", "May contain nuts!", "Better than Prey!", "More polygons!", "Sexy!", "Limited edition!", "Flashing letters!", "Made by Notch!", "Coming soon!", "Best in class!", "When it\'s finished!", "Absolutely dragon free!", "Excitement!", "More than 5000 sold!", "One of a kind!", "700+ hits on YouTube!", "Indev!", "Spiders everywhere!", "Check it out!", "Holy cow, man!", "It\'s a game!", "Made in Sweden!", "Uses LWJGL!", "Reticulating splines!", "Minecraft!", "Yaaay!", "Alpha version!", "Singleplayer!", "Keyboard compatible!", "Undocumented!", "Ingots!", "Exploding creepers!", "That\'s not a moon!", "l33t!", "Create!", "Survive!", "Dungeon!", "Exclusive!", "The bee\'s knees!", "Down with O.P.P.!", "Closed source!", "Classy!", "Wow!", "Not on steam!", "9.95 euro!", "Half price!", "Oh man!", "Check it out!", "Awesome community!", "Pixels!", "Teetsuuuuoooo!", "Kaaneeeedaaaa!", "Now with difficulty!", "Enhanced!", "90% bug free!", "Pretty!", "12 herbs and spices!", "Fat free!", "Absolutely no memes!", "Free dental!", "Ask your doctor!", "Minors welcome!", "Cloud computing!", "Legal in Finland!", "Hard to label!", "Technically good!", "Bringing home the bacon!", "Indie!", "GOTY!", "Ceci n\'est pas une title screen!", "Euclidian!", "Now in 3D!", "Inspirational!", "Herregud!", "Complex cellular automata!", "Yes, sir!", "Played by cowboys!", "OpenGL 1.1!", "Thousands of colors!", "Try it!", "Age of Wonders is better!", "Try the mushroom stew!", "Sensational!", "Hot tamale, hot hot tamale!", "Play him off, keyboard cat!", "Guaranteed!", "Macroscopic!", "Bring it on!", "Random splash!", "Call your mother!", "Monster infighting!", "Loved by millions!", "Ultimate edition!", "Freaky!", "You\'ve got a brand new key!", "Water proof!", "Uninflammable!", "Whoa, dude!", "All inclusive!", "Tell your friends!", "NP is not in P!", "Notch <3 Ez!", "Music by C418!"};
private String splashString = this.splashes[(int)(Math.random() * (double)this.splashes.length)];
public void updateScreen() {
this.updateCounter += 0.01F;
}
protected void keyTyped(char c1, int i2) {
}
public void initGui() {
this.controlList.clear();
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 48, "Single player"));
this.controlList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, "Multi player"));
this.controlList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 96, "Play tutorial level"));
this.controlList.add(new GuiButton(4, this.width / 2 + 115, this.height / 4 + 142, 75, 20, "Characters"));
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Options..."));
((GuiButton)this.controlList.get(1)).enabled = false;
((GuiButton)this.controlList.get(2)).enabled = false;
if(this.mc.session == null) {
((GuiButton)this.controlList.get(1)).enabled = false;
}
}
protected void actionPerformed(GuiButton guiButton1) {
if(guiButton1.id == 0) {
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
if(guiButton1.id == 1) {
this.mc.displayGuiScreen(new GuiCreateWorld(this));
}
}
public void drawScreen(int i1, int i2, float f3) {
this.drawDefaultBackground();
Tessellator tessellator4 = Tessellator.instance;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/logo.png"));
short s5 = 256;
byte b6 = 49;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
tessellator4.setColorOpaque_I(0xFFFFFF);
this.drawTexturedModalRect((this.width - s5) / 2, 30, 0, 0, s5, b6);
GL11.glPushMatrix();
GL11.glTranslatef((float)(this.width / 2 + 90), 70.0F, 0.0F);
GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
float f7 = 1.8F - MathHelper.abs(MathHelper.sin((float)(System.currentTimeMillis() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F);
f7 = f7 * 100.0F / (float)(this.fontRenderer.getStringWidth(this.splashString) + 32);
GL11.glScalef(f7, f7, f7);
this.drawCenteredString(this.fontRenderer, this.splashString, 0, -8, 16776960);
GL11.glPopMatrix();
String string8 = "Copyright Mojang Specifications. Do not distribute.";
this.drawString(this.fontRenderer, string8, this.width - this.fontRenderer.getStringWidth(string8) - 2, this.height - 10, 0xFFFFFF);
long j9 = Runtime.getRuntime().maxMemory();
long j11 = Runtime.getRuntime().totalMemory();
long j13 = Runtime.getRuntime().freeMemory();
long j15 = j9 - j13;
string8 = "Free memory: " + j15 * 100L / j9 + "% of " + j9 / 1024L / 1024L + "MB";
this.drawString(this.fontRenderer, string8, this.width - this.fontRenderer.getStringWidth(string8) - 2, 2, 8421504);
string8 = "Allocated memory: " + j11 * 100L / j9 + "% (" + j11 / 1024L / 1024L + "MB)";
this.drawString(this.fontRenderer, string8, this.width - this.fontRenderer.getStringWidth(string8) - 2, 12, 8421504);
// Draw entity
int xSize = 176;
int ySize = 166;
int i3 = (this.width - xSize) / 2;
int i4 = (this.height - ySize) / 2;
float xSize_lo = (float)i1;
float ySize_lo = (float)i2;
FakeWorld fakeWorld = new FakeWorld();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glPushMatrix();
//GL11.glTranslatef((float)(i3 + 51), (float)(i4 + 75), 50.0F);
GL11.glTranslatef((float)(i3 + 240), (float)(i4 + 140), 50.0F);
float f5 = 60.0F;
GL11.glScalef(-f5, f5, f5);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
this.mc.thePlayer = new EntityPlayerSP(this.mc, fakeWorld, this.mc.session);
RenderManager.instance.cacheActiveRenderInfo(fakeWorld, this.mc.renderEngine, this.mc.fontRenderer, this.mc.thePlayer, this.mc.gameSettings, f3);
float f6 = this.mc.thePlayer.renderYawOffset;
float rotYaw = this.mc.thePlayer.rotationYaw;
float f8 = this.mc.thePlayer.rotationPitch;
float f9 = (float)(i3 + 51) - xSize_lo;
float f10 = (float)(i4 + 75 - 50) - ySize_lo;
GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-((float)Math.atan((double)(f10 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
this.mc.thePlayer.renderYawOffset = (float)Math.atan((double)(f9 / 40.0F)) * 20.0F;
this.mc.thePlayer.rotationYaw = (float)Math.atan((double)(f9 / 40.0F)) * 40.0F;
this.mc.thePlayer.rotationPitch = -((float)Math.atan((double)(f10 / 40.0F))) * 20.0F;
GL11.glTranslatef(0.0F, this.mc.thePlayer.yOffset, 0.0F);
RenderManager.instance.renderEntityWithPosYaw(this.mc.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
this.mc.thePlayer.renderYawOffset = f6;
this.mc.thePlayer.rotationYaw = rotYaw;
this.mc.thePlayer.rotationPitch = f8;
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
super.drawScreen(i1, i2, f3);
}
}
package net.minecraft.src;
public class World implements IBlockAccess {
// fields...
// Create non-functioning world
public World () {
this.lightingToUpdate = new ArrayList();
this.loadedEntityList = new ArrayList();
this.unloadedEntityList = new ArrayList();
this.scheduledTickTreeSet = new TreeSet();
this.scheduledTickSet = new HashSet();
this.loadedTileEntityList = new ArrayList();
this.worldTime = 0L;
this.skyColor = 8961023L;
this.fogColor = 12638463L;
this.cloudColor = 16777215L;
this.skylightSubtracted = 0;
this.updateLCG = (new Random()).nextInt();
this.DIST_HASH_MAGIC = 1013904223;
this.editingBlocks = false;
this.rand = new Random();
this.isNewWorld = false;
this.worldAccesses = new ArrayList();
this.randomSeed = 0L;
this.setSizeOnDisk = 0L;
this.collidingBoundingBoxes = new ArrayList();
this.entitiesWithinAABBExcludingEntity = new ArrayList();
this.levelName = "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment