Add basic clouds rendering
Bit broken though, they are static, dark foggy and take like 5 seconds to show up after generating a new level.master
parent
9d876ead16
commit
1c6f1f2a64
|
@ -5,6 +5,8 @@
|
|||
package com.mojang.minecraft;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
import com.mojang.minecraft.renderer.Tesselator;
|
||||
import com.mojang.minecraft.renderer.Frustum;
|
||||
import com.mojang.minecraft.phys.AABB;
|
||||
|
@ -12,7 +14,6 @@ import com.mojang.minecraft.level.tile.Tile;
|
|||
import com.mojang.minecraft.gui.PauseScreen;
|
||||
import com.mojang.minecraft.gui.MenuScreen;
|
||||
import com.mojang.minecraft.level.Chunk;
|
||||
import java.awt.Component;
|
||||
import javax.swing.JOptionPane;
|
||||
import java.io.OutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -36,7 +37,6 @@ import com.mojang.minecraft.gui.Screen;
|
|||
import com.mojang.minecraft.gui.Font;
|
||||
import com.mojang.minecraft.renderer.Textures;
|
||||
import org.lwjgl.input.Cursor;
|
||||
import java.awt.Canvas;
|
||||
import java.util.ArrayList;
|
||||
import com.mojang.minecraft.particle.ParticleEngine;
|
||||
import com.mojang.minecraft.level.LevelRenderer;
|
||||
|
@ -81,6 +81,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
FloatBuffer lb;
|
||||
private String title;
|
||||
|
||||
|
||||
public Minecraft(final Canvas parent, final int width, final int height,
|
||||
final boolean fullscreen) {
|
||||
this.fullscreen = false;
|
||||
|
@ -112,6 +113,22 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
this.height = height;
|
||||
this.fullscreen = fullscreen;
|
||||
this.textures = new Textures();
|
||||
class mcMenu
|
||||
{
|
||||
mcMenu(){
|
||||
Frame f= new Frame(nameLevel);
|
||||
MenuBar mb=new MenuBar();
|
||||
Menu menu=new Menu("Menu");
|
||||
MenuItem i1=new MenuItem("New Level");
|
||||
menu.add(i1);
|
||||
mb.add(menu);
|
||||
f.setMenuBar(mb);
|
||||
f.setSize(400,100);
|
||||
f.setLayout(null);
|
||||
f.setVisible(true);
|
||||
}
|
||||
}
|
||||
new mcMenu();
|
||||
}
|
||||
|
||||
public void init() throws LWJGLException, IOException {
|
||||
|
@ -220,7 +237,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void attemptSaveLevel() {
|
||||
try {
|
||||
Minecraft.levelIo.save(Minecraft.level, new FileOutputStream(
|
||||
|
@ -518,6 +535,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
this.particleEngine.render(this.player, a, 0);
|
||||
this.checkGlError("Rendered particles");
|
||||
this.setupFog(1);
|
||||
this.levelRenderer.a(a);
|
||||
this.levelRenderer.render(this.player, 1);
|
||||
// for (int i = 0; i < this.entities.size(); ++i) {
|
||||
// final Entity zombie = this.entities.get(i);
|
||||
|
|
|
@ -95,28 +95,29 @@ public class LevelRenderer implements LevelListener
|
|||
}
|
||||
}
|
||||
|
||||
//clouds do not work because deobfuscating is hard.
|
||||
/* public final void a(float n) {
|
||||
public final void a(float float1) {
|
||||
GL11.glEnable(3553);
|
||||
GL11.glBindTexture(3553, this.textures.loadTexture("/clouds.png", 9728));
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
final c a = com.mojang.minecraft.Textures.c.a;
|
||||
final Tesselator a = Tesselator.instance;
|
||||
float n = 0.0f;
|
||||
final float n2 = 4.8828125E-4f;
|
||||
final float n3 = (float)(this.a.depth + 2);
|
||||
n = (this.f + n) * n2 * 0.03f;
|
||||
a.b();
|
||||
for (int i = -2048; i < this.a.width + 2048; i += 512) {
|
||||
for (int j = -2048; j < this.a.height + 2048; j += 512) {
|
||||
this.textures.loadTexture((float)i, n3, (float)(j + 512), i * n2 + n, (j + 512) * n2);
|
||||
a.a((float)(i + 512), n3, (float)(j + 512), (i + 512) * n2 + n, (j + 512) * n2);
|
||||
a.a((float)(i + 512), n3, (float)j, (i + 512) * n2 + n, j * n2);
|
||||
a.a((float)i, n3, (float)j, i * n2 + n, j * n2);
|
||||
a.a((float)i, n3, (float)j, i * n2 + n, j * n2);
|
||||
a.a((float)(i + 512), n3, (float)j, (i + 512) * n2 + n, j * n2);
|
||||
a.a((float)(i + 512), n3, (float)(j + 512), (i + 512) * n2 + n, (j + 512) * n2);
|
||||
a.a((float)i, n3, (float)(j + 512), i * n2 + n, (j + 512) * n2);
|
||||
n = (float)(this.level.depth + 2);
|
||||
float1 = (this.c + float1) * n2 * 0.03f;
|
||||
a.begin();
|
||||
for (int i = -2048; i < this.level.width + 2048; i += 512) {
|
||||
for (int j = -2048; j < this.level.height + 2048; j += 512) {
|
||||
a.vertexUV((float)i, n, (float)(j + 512), i * n2 + float1, (j + 512) * n2);
|
||||
a.vertexUV((float)(i + 512), n, (float)(j + 512), (i + 512) * n2 + float1, (j + 512) * n2);
|
||||
a.vertexUV((float)(i + 512), n, (float)j, (i + 512) * n2 + float1, j * n2);
|
||||
a.vertexUV((float)i, n, (float)j, i * n2 + float1, j * n2);
|
||||
a.vertexUV((float)i, n, (float)j, i * n2 + float1, j * n2);
|
||||
a.vertexUV((float)(i + 512), n, (float)j, (i + 512) * n2 + float1, j * n2);
|
||||
a.vertexUV((float)(i + 512), n, (float)(j + 512), (i + 512) * n2 + float1, (j + 512) * n2);
|
||||
a.vertexUV((float)i, n, (float)(j + 512), i * n2 + float1, (j + 512) * n2);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public List<Chunk> getAllDirtyChunks() {
|
||||
ArrayList<Chunk> dirty = null;
|
||||
|
|
Loading…
Reference in New Issue