Compare commits
14 Commits
31d09f3c50
...
011edd8647
Author | SHA1 | Date | |
---|---|---|---|
|
011edd8647 | ||
|
f9fea9dfbf | ||
|
7d78af5b4c | ||
|
458e47b0d5 | ||
|
3f03c09656 | ||
|
0cb102fb0b | ||
|
2c83e4e899 | ||
|
5094081717 | ||
|
eca31d4823 | ||
|
5f2acc6c46 | ||
|
b19b0c99e4 | ||
|
d1284dbee1 | ||
|
319cac8223 | ||
|
e8059cbfc6 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Ignore Gradle project-specific cache directory
|
||||||
|
.gradle
|
||||||
|
|
||||||
|
# Ignore Gradle build output directory
|
||||||
|
build
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33
README.md
33
README.md
|
@ -1,5 +1,34 @@
|
||||||
# Infdev-20100630-1
|
# Infdev-20100630-1-WebGL
|
||||||
WebGL port of Minecraft Infdev-20100630-1
|
This project aims to be a 1:1 replica of Minecraft Infdev 20100630-1 ported to the browser using WebGL and TeaVM.
|
||||||
|
|
||||||
|
## STILL IN TESTING!
|
||||||
|
THIS PROJECT IS STILL IN TESTING, IT WILL CONTAIN BUGS AND GLITCHES SO DON'T GET TOO ATTACHED TO YOUR WORLDS!
|
||||||
|
|
||||||
|
GAME IS EXTREMELY LAGGY...
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Feel free to contribute, just open a pull request and DM on Discord (peytonplayz585) because I probably won't check pull requests that often.
|
||||||
|
|
||||||
|
## Bugs
|
||||||
|
- Saving of Entities/Tile Entities have been removed due to a crash
|
||||||
|
- Water doesn't render correctly
|
||||||
|
- Game is EXTREMELY laggy
|
||||||
|
- Lighting is broken
|
||||||
|
- Mob spawning removed due to a crash
|
||||||
|
|
||||||
|
## Pros & Cons
|
||||||
|
|
||||||
|
Pros:
|
||||||
|
- Can be played in the browser (No Download)
|
||||||
|
- ITS FREE!
|
||||||
|
- More features
|
||||||
|
|
||||||
|
Cons:
|
||||||
|
- EXTREMELY laggy
|
||||||
|
- It's pirated
|
||||||
|
- Has bugs & some features may have to be removed for performance issues
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
fuck microsoft :trollface:
|
fuck microsoft :trollface:
|
||||||
|
<br>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -62,7 +62,7 @@ public class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void run0() {
|
public static void run0() {
|
||||||
instance = new Minecraft(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), false);
|
instance = new Minecraft(Display.getWidth(), Display.getHeight(), false);
|
||||||
instance.session = new Session("Player", "fuckmojang123");
|
instance.session = new Session("Player", "fuckmojang123");
|
||||||
instance.session.mpPassParameter = "randpasslol";
|
instance.session.mpPassParameter = "randpasslol";
|
||||||
mcThread = new Thread(instance, "Minecraft main thread");
|
mcThread = new Thread(instance, "Minecraft main thread");
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
package net.PeytonPlayz585.io;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
|
||||||
|
|
||||||
public class File {
|
|
||||||
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
public File(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File(String parent, String child) {
|
|
||||||
this.path = parent + "/" + child;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File(File parent, String child) {
|
|
||||||
this.path = parent.getPath() + "/" + child;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean exists() {
|
|
||||||
if(LWJGLMain.directoryExists(path) || LWJGLMain.fileExists(path)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean mkdirs() {
|
|
||||||
String[] directories = path.split("/");
|
|
||||||
String currentPath = "";
|
|
||||||
|
|
||||||
for (String directory : directories) {
|
|
||||||
currentPath += directory + "/";
|
|
||||||
if (!LWJGLMain.directoryExists(currentPath) && !LWJGLMain.pathExists(currentPath)) {
|
|
||||||
LWJGLMain.writeFile(currentPath, new byte[0]);
|
|
||||||
if(LWJGLMain.readFile(currentPath) == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean mkdir() {
|
|
||||||
if (!LWJGLMain.listFiles(path, false, false).isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LWJGLMain.writeFile(path, new byte[0]);
|
|
||||||
if(LWJGLMain.readFile(path) != null) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getBytes() {
|
|
||||||
return LWJGLMain.readFile(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeBytes(byte[] data) {
|
|
||||||
LWJGLMain.writeFile(path, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long length() {
|
|
||||||
return LWJGLMain.getFileSize(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete() {
|
|
||||||
LWJGLMain.writeFile(path, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public File[] listFiles() {
|
|
||||||
Collection<LWJGLMain.FileEntry> fileEntries = LWJGLMain.listFiles(path, false, false);
|
|
||||||
File[] files = new File[fileEntries.size()];
|
|
||||||
int i = 0;
|
|
||||||
for (LWJGLMain.FileEntry fileEntry : fileEntries) {
|
|
||||||
files[i++] = new File(fileEntry.path);
|
|
||||||
}
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDirectory() {
|
|
||||||
return LWJGLMain.directoryExists(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renameTo(File var4) {
|
|
||||||
LWJGLMain.renameFile(path, var4.getPath());
|
|
||||||
}
|
|
||||||
}
|
|
50
src/main/java/net/PeytonPlayz585/io/FileSystemUtils.java
Normal file
50
src/main/java/net/PeytonPlayz585/io/FileSystemUtils.java
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
package net.PeytonPlayz585.io;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
import net.minecraft.src.IProgressUpdate;
|
||||||
|
|
||||||
|
public class FileSystemUtils {
|
||||||
|
|
||||||
|
public static void recursiveDeleteDirectory(String dir) {
|
||||||
|
Collection<LWJGLMain.FileEntry> lst = LWJGLMain.listFiles(dir, true, true);
|
||||||
|
for(LWJGLMain.FileEntry t : lst) {
|
||||||
|
if(!t.isDirectory) {
|
||||||
|
LWJGLMain.deleteFile(t.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(LWJGLMain.FileEntry t : lst) {
|
||||||
|
if(t.isDirectory) {
|
||||||
|
LWJGLMain.deleteFile(t.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LWJGLMain.deleteFile(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void recursiveDeleteDirectoryWithProgress(String dir, String title, String subText, IProgressUpdate progress) {
|
||||||
|
progress.displayLoadingString(title, "(please wait)");
|
||||||
|
Collection<LWJGLMain.FileEntry> lst = LWJGLMain.listFiles(dir, true, true);
|
||||||
|
int totalDeleted = 0;
|
||||||
|
int lastTotalDeleted = 0;
|
||||||
|
for(LWJGLMain.FileEntry t : lst) {
|
||||||
|
if(!t.isDirectory) {
|
||||||
|
LWJGLMain.deleteFile(t.path);
|
||||||
|
++totalDeleted;
|
||||||
|
if(totalDeleted - lastTotalDeleted >= 10) {
|
||||||
|
lastTotalDeleted = totalDeleted;
|
||||||
|
int percentage = (int) Math.ceil(((double) totalDeleted / lst.size()) * 100);
|
||||||
|
progress.displayLoadingString(title, subText.replace("%i", "" + totalDeleted));
|
||||||
|
progress.setLoadingProgress(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(LWJGLMain.FileEntry t : lst) {
|
||||||
|
if(t.isDirectory) {
|
||||||
|
LWJGLMain.deleteFile(t.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LWJGLMain.deleteFile(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -923,7 +923,8 @@ public class LWJGLMain {
|
||||||
for(int i = 0; i < pixels.length; ++i) {
|
for(int i = 0; i < pixels.length; ++i) {
|
||||||
pixels[i] = (pxls.get(i * 4) << 16) | (pxls.get(i * 4 + 1) << 8) | pxls.get(i * 4 + 2) | (pxls.get(i * 4 + 3) << 24);
|
pixels[i] = (pxls.get(i * 4) << 16) | (pxls.get(i * 4 + 1) << 8) | pxls.get(i * 4 + 2) | (pxls.get(i * 4 + 3) << 24);
|
||||||
}
|
}
|
||||||
ret.complete(new MinecraftImageData(pixels, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
|
IntBuffer buffer = IntBuffer.wrap(pixels);
|
||||||
|
ret.complete(new MinecraftImageData(buffer, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toLoad.addEventListener("error", new EventListener<Event>() {
|
toLoad.addEventListener("error", new EventListener<Event>() {
|
||||||
|
|
|
@ -1,40 +1,55 @@
|
||||||
package net.PeytonPlayz585.opengl;
|
package net.PeytonPlayz585.opengl;
|
||||||
|
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
public class MinecraftImageData {
|
public class MinecraftImageData {
|
||||||
|
|
||||||
public final int[] data;
|
public final IntBuffer data;
|
||||||
public final int w;
|
public final int w;
|
||||||
public final int h;
|
public final int h;
|
||||||
public final boolean alpha;
|
public final boolean alpha;
|
||||||
|
private final int wh;
|
||||||
|
|
||||||
public MinecraftImageData(int pw, int ph, boolean palpha) {
|
public MinecraftImageData(int pw, int ph, boolean palpha) {
|
||||||
this.w = pw;
|
this.w = pw;
|
||||||
this.h = ph;
|
this.h = ph;
|
||||||
this.alpha = palpha;
|
this.alpha = palpha;
|
||||||
this.data = new int[pw * ph];
|
this.data = IntBuffer.allocate(pw * ph);
|
||||||
|
this.wh = pw * ph;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftImageData(int[] pdata, int pw, int ph, boolean palpha) {
|
public MinecraftImageData(IntBuffer pdata, int pw, int ph, boolean palpha) {
|
||||||
if (pdata.length != pw * ph) {
|
if (pdata.capacity() != pw * ph) {
|
||||||
throw new IllegalArgumentException("array size does not equal image size");
|
throw new IllegalArgumentException("buffer capacity does not equal image size");
|
||||||
}
|
}
|
||||||
this.w = pw;
|
w = pw;
|
||||||
this.h = ph;
|
h = ph;
|
||||||
this.alpha = palpha;
|
alpha = palpha;
|
||||||
if (!palpha) {
|
wh = pw * ph;
|
||||||
for (int i = 0; i < pdata.length; ++i) {
|
if (!alpha) {
|
||||||
pdata[i] = pdata[i] | 0xFF000000;
|
for (int i = 0; i < wh; ++i) {
|
||||||
|
pdata.put(i, pdata.get(i) | 0xFF000000);
|
||||||
}
|
}
|
||||||
|
pdata.rewind();
|
||||||
}
|
}
|
||||||
this.data = pdata;
|
data = pdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftImageData getSubImage(int x, int y, int pw, int ph) {
|
public MinecraftImageData getSubImage(int x, int y, int pw, int ph) {
|
||||||
int[] img = new int[pw * ph];
|
int start = y * w + x;
|
||||||
for (int i = 0; i < ph; ++i) {
|
IntBuffer subBuffer = data.slice();
|
||||||
System.arraycopy(data, (i + y) * this.w + x, img, i * pw, pw);
|
subBuffer.position(start);
|
||||||
}
|
subBuffer.limit(start + pw * ph);
|
||||||
return new MinecraftImageData(img, pw, ph, alpha);
|
int[] temp = new int[pw * ph];
|
||||||
|
subBuffer.get(temp);
|
||||||
|
IntBuffer newBuffer = IntBuffer.wrap(temp);
|
||||||
|
return new MinecraftImageData(newBuffer, pw, ph, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] data() {
|
||||||
|
int[] array = new int[wh];
|
||||||
|
data.rewind();
|
||||||
|
data.get(array);
|
||||||
|
return array;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -182,7 +182,7 @@ public abstract class BlockFluid extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return this.blockMaterial == Material.water ? 1 : 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||||
|
|
|
@ -1,72 +1,83 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import net.PeytonPlayz585.io.File;
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class ChunkLoader implements IChunkLoader {
|
public class ChunkLoader implements IChunkLoader {
|
||||||
private File saveDir;
|
|
||||||
private boolean createIfNecessary;
|
|
||||||
|
|
||||||
public ChunkLoader(File var1, boolean var2) {
|
private String saveDir;
|
||||||
this.saveDir = var1;
|
|
||||||
this.createIfNecessary = var2;
|
public ChunkLoader(String dir) {
|
||||||
|
saveDir = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
private File chunkFileForXZ(int var1, int var2) {
|
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
String var3 = "c." + Integer.toString(var1, 36) + "." + Integer.toString(var2, 36) + ".dat";
|
|
||||||
String var4 = Integer.toString(var1 & 63, 36);
|
private String chunkFileForXZ(int x, int z) {
|
||||||
String var5 = Integer.toString(var2 & 63, 36);
|
int unsignedX = x + 30233088;
|
||||||
File var6 = new File(this.saveDir, var4);
|
int unsignedZ = z + 30233088;
|
||||||
if(!var6.exists()) {
|
int radix = CHUNK_CHARS.length();
|
||||||
if(!this.createIfNecessary) {
|
StringBuilder path = new StringBuilder(10);
|
||||||
return null;
|
for(int i = 0; i < 5; ++i) {
|
||||||
|
path.append(CHUNK_CHARS.charAt(unsignedX % radix));
|
||||||
|
unsignedX /= radix;
|
||||||
|
path.append(CHUNK_CHARS.charAt(unsignedZ % radix));
|
||||||
|
unsignedZ /= radix;
|
||||||
|
}
|
||||||
|
return path.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
var6.mkdir();
|
public Chunk loadChunk(World var1, int x, int z) {
|
||||||
}
|
String name = chunkFileForXZ(x, z);
|
||||||
|
String path = saveDir + "/" + name;
|
||||||
var6 = new File(var6, var5);
|
byte[] dat = LWJGLMain.readFile(path);
|
||||||
if(!var6.exists()) {
|
if(dat != null) {
|
||||||
if(!this.createIfNecessary) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6.mkdir();
|
|
||||||
}
|
|
||||||
|
|
||||||
var6 = new File(var6, var3);
|
|
||||||
return !var6.exists() && !this.createIfNecessary ? null : var6;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Chunk loadChunk(World var1, int var2, int var3) {
|
|
||||||
File var4 = this.chunkFileForXZ(var2, var3);
|
|
||||||
if(var4 != null && var4.exists()) {
|
|
||||||
try {
|
try {
|
||||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var4.getBytes())));
|
NBTTagCompound nbt = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(dat)));
|
||||||
return loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
int xx = nbt.getInteger("xPos");
|
||||||
} catch (Exception var7) {
|
int zz = nbt.getInteger("zPos");
|
||||||
var7.printStackTrace();
|
if(x != xx || z != zz) {
|
||||||
}
|
String name2 = chunkFileForXZ(xx, zz);
|
||||||
|
System.err.println("The chunk file '" + name + "' was supposed to be at [" + x + ", " + z + "], but the file contained a chunk from [" + xx + ", " + zz +
|
||||||
|
"]. It's data will be moved to file '" + name2 + "', and a new empty chunk will be created for file '" + name + "' for [" + x + ", " + z + "]");
|
||||||
|
LWJGLMain.renameFile(path, saveDir + "/" + name2);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return loadChunkIntoWorldFromCompound(var1, nbt);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Corrupt chunk '" + name + "' was found at: [" + x + ", " + z + "]");
|
||||||
|
System.err.println("The file will be deleted");
|
||||||
|
LWJGLMain.deleteFile(path);
|
||||||
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveChunk(World var1, Chunk var2) {
|
public void saveChunk(World var1, Chunk var2) {
|
||||||
File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
|
|
||||||
NBTTagCompound toSave = new NBTTagCompound();
|
NBTTagCompound toSave = new NBTTagCompound();
|
||||||
storeChunkInCompound(var2, var1, toSave);
|
storeChunkInCompound(var2, var1, toSave);
|
||||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
||||||
try {
|
try (DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(bao))) {
|
||||||
NBTBase.writeNamedTag(toSave, new DataOutputStream(bao));
|
NBTBase.writeNamedTag(toSave, dos);
|
||||||
|
dos.flush();
|
||||||
|
byte[] data = bao.toByteArray();
|
||||||
|
LWJGLMain.writeFile(saveDir + "/" + chunkFileForXZ(var2.xPosition, var2.zPosition), data);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Failed to serialize chunk at [" + var2.xPosition + ", " + var2.zPosition + "] to byte array");
|
System.err.println("Failed to serialize chunk at [" + var2.xPosition + ", " + var2.zPosition + "] to byte array");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var3.writeBytes(bao.toByteArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void storeChunkInCompound(Chunk var1, World var2, NBTTagCompound var3) {
|
public void storeChunkInCompound(Chunk var1, World var2, NBTTagCompound var3) {
|
||||||
|
@ -82,33 +93,33 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
var1.hasEntities = false;
|
var1.hasEntities = false;
|
||||||
NBTTagList var4 = new NBTTagList();
|
NBTTagList var4 = new NBTTagList();
|
||||||
|
|
||||||
Iterator var6;
|
// Iterator var6;
|
||||||
NBTTagCompound var8;
|
// NBTTagCompound var8;
|
||||||
for(int var5 = 0; var5 < var1.entities.length; ++var5) {
|
// for(int var5 = 0; var5 < var1.entities.length; ++var5) {
|
||||||
var6 = var1.entities[var5].iterator();
|
// var6 = var1.entities[var5].iterator();
|
||||||
|
//
|
||||||
while(var6.hasNext()) {
|
// while(var6.hasNext()) {
|
||||||
Entity var7 = (Entity)var6.next();
|
// Entity var7 = (Entity)var6.next();
|
||||||
var1.hasEntities = true;
|
// var1.hasEntities = true;
|
||||||
var8 = new NBTTagCompound();
|
// var8 = new NBTTagCompound();
|
||||||
if(var7.addEntityID(var8)) {
|
// if(var7.addEntityID(var8)) {
|
||||||
var4.setTag(var8);
|
// var4.setTag(var8);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
var3.setTag("Entities", var4);
|
// var3.setTag("Entities", var4);
|
||||||
NBTTagList var9 = new NBTTagList();
|
// NBTTagList var9 = new NBTTagList();
|
||||||
var6 = var1.chunkTileEntityMap.values().iterator();
|
// var6 = var1.chunkTileEntityMap.values().iterator();
|
||||||
|
//
|
||||||
while(var6.hasNext()) {
|
// while(var6.hasNext()) {
|
||||||
TileEntity var10 = (TileEntity)var6.next();
|
// TileEntity var10 = (TileEntity)var6.next();
|
||||||
var8 = new NBTTagCompound();
|
// var8 = new NBTTagCompound();
|
||||||
var10.writeToNBT(var8);
|
// var10.writeToNBT(var8);
|
||||||
var9.setTag(var8);
|
// var9.setTag(var8);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
var3.setTag("TileEntities", var9);
|
// var3.setTag("TileEntities", var9);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Chunk loadChunkIntoWorldFromCompound(World var0, NBTTagCompound var1) {
|
public static Chunk loadChunkIntoWorldFromCompound(World var0, NBTTagCompound var1) {
|
||||||
|
@ -136,28 +147,28 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
var4.doNothing();
|
var4.doNothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagList var5 = var1.getTagList("Entities");
|
// NBTTagList var5 = var1.getTagList("Entities");
|
||||||
if(var5 != null) {
|
// if(var5 != null) {
|
||||||
for(int var6 = 0; var6 < var5.tagCount(); ++var6) {
|
// for(int var6 = 0; var6 < var5.tagCount(); ++var6) {
|
||||||
NBTTagCompound var7 = (NBTTagCompound)var5.tagAt(var6);
|
// NBTTagCompound var7 = (NBTTagCompound)var5.tagAt(var6);
|
||||||
Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
// Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
||||||
var4.hasEntities = true;
|
// var4.hasEntities = true;
|
||||||
if(var8 != null) {
|
// if(var8 != null) {
|
||||||
var4.addEntity(var8);
|
// var4.addEntity(var8);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
NBTTagList var10 = var1.getTagList("TileEntities");
|
// NBTTagList var10 = var1.getTagList("TileEntities");
|
||||||
if(var10 != null) {
|
// if(var10 != null) {
|
||||||
for(int var11 = 0; var11 < var10.tagCount(); ++var11) {
|
// for(int var11 = 0; var11 < var10.tagCount(); ++var11) {
|
||||||
NBTTagCompound var12 = (NBTTagCompound)var10.tagAt(var11);
|
// NBTTagCompound var12 = (NBTTagCompound)var10.tagAt(var11);
|
||||||
TileEntity var9 = TileEntity.createAndLoadEntity(var12);
|
// TileEntity var9 = TileEntity.createAndLoadEntity(var12);
|
||||||
if(var9 != null) {
|
// if(var9 != null) {
|
||||||
var4.addTileEntity(var9);
|
// var4.addTileEntity(var9);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return var4;
|
return var4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -725,4 +725,21 @@ public abstract class Entity {
|
||||||
var1.riddenByEntity = this;
|
var1.riddenByEntity = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void turn(float var1, float var2) {
|
||||||
|
float var3 = this.rotationPitch;
|
||||||
|
float var4 = this.rotationYaw;
|
||||||
|
this.rotationYaw = (float)((double)this.rotationYaw + (double)var1 * 0.15D);
|
||||||
|
this.rotationPitch = (float)((double)this.rotationPitch - (double)var2 * 0.15D);
|
||||||
|
if(this.rotationPitch < -90.0F) {
|
||||||
|
this.rotationPitch = -90.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.rotationPitch > 90.0F) {
|
||||||
|
this.rotationPitch = 90.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.prevRotationPitch += this.rotationPitch - var3;
|
||||||
|
this.prevRotationYaw += this.rotationYaw - var4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,41 +255,54 @@ public class EntityRenderer {
|
||||||
int var3;
|
int var3;
|
||||||
int var9;
|
int var9;
|
||||||
int var10;
|
int var10;
|
||||||
if(this.mc.inGameHasFocus) {
|
// if(this.mc.inGameHasFocus) {
|
||||||
int var2 = Mouse.getDX() * 0;
|
// int var2 = Mouse.getDX() * 0;
|
||||||
var3 = Mouse.getDY() * 0;
|
// var3 = Mouse.getDY() * 0;
|
||||||
this.mc.mouseHelper.mouseXYChange();
|
// this.mc.mouseHelper.mouseXYChange();
|
||||||
byte var4 = 1;
|
// byte var4 = 1;
|
||||||
|
// if(this.mc.gameSettings.invertMouse) {
|
||||||
|
// var4 = -1;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// boolean var5 = false;
|
||||||
|
// boolean var6 = false;
|
||||||
|
// var9 = var2 + this.mc.mouseHelper.deltaX;
|
||||||
|
// var10 = var3 - this.mc.mouseHelper.deltaY;
|
||||||
|
// if(var2 != 0 || this.mouseDX != 0) {
|
||||||
|
// System.out.println("xxo: " + var2 + ", " + this.mouseDX + ": " + this.mouseDX + ", xo: " + var9);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(this.mouseDX != 0) {
|
||||||
|
// this.mouseDX = 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(this.mouseDY != 0) {
|
||||||
|
// this.mouseDY = 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(var2 != 0) {
|
||||||
|
// this.mouseDX = var2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(var3 != 0) {
|
||||||
|
// this.mouseDY = var3;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// this.mc.thePlayer.setAngles((float)var9, (float)(var10 * var4));
|
||||||
|
// }
|
||||||
|
|
||||||
|
int var5 = Mouse.getDX();
|
||||||
|
int var6 = Mouse.getDY();;
|
||||||
|
byte var91 = 1;
|
||||||
|
|
||||||
if(this.mc.gameSettings.invertMouse) {
|
if(this.mc.gameSettings.invertMouse) {
|
||||||
var4 = -1;
|
var91 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean var5 = false;
|
if(this.mc.inGameHasFocus && this.mc.theWorld != null) {
|
||||||
boolean var6 = false;
|
this.mc.thePlayer.turn((float)var5, (float)(var6 * var91));
|
||||||
var9 = var2 + this.mc.mouseHelper.deltaX;
|
|
||||||
var10 = var3 - this.mc.mouseHelper.deltaY;
|
|
||||||
if(var2 != 0 || this.mouseDX != 0) {
|
|
||||||
System.out.println("xxo: " + var2 + ", " + this.mouseDX + ": " + this.mouseDX + ", xo: " + var9);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.mouseDX != 0) {
|
|
||||||
this.mouseDX = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.mouseDY != 0) {
|
|
||||||
this.mouseDY = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var2 != 0) {
|
|
||||||
this.mouseDX = var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var3 != 0) {
|
|
||||||
this.mouseDY = var3;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mc.thePlayer.setAngles((float)var9, (float)(var10 * var4));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.mc.skipRenderWorld) {
|
if(!this.mc.skipRenderWorld) {
|
||||||
ScaledResolution var7 = new ScaledResolution(this.mc.displayWidth, this.mc.displayHeight);
|
ScaledResolution var7 = new ScaledResolution(this.mc.displayWidth, this.mc.displayHeight);
|
||||||
|
@ -377,24 +390,24 @@ public class EntityRenderer {
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
|
||||||
if(this.mc.gameSettings.fancyGraphics) {
|
//if(this.mc.gameSettings.fancyGraphics) {
|
||||||
GL11.glColorMask(false, false, false, false);
|
//GL11.glColorMask(false, false, false, false);
|
||||||
int var13 = var3.sortAndRender(var2, 1, (double)var1);
|
//int var13 = var3.sortAndRender(var2, 1, (double)var1);
|
||||||
GL11.glColorMask(true, true, true, true);
|
//GL11.glColorMask(true, true, true, true);
|
||||||
if(this.mc.gameSettings.anaglyph) {
|
//if(this.mc.gameSettings.anaglyph) {
|
||||||
if(var11 == 0) {
|
//if(var11 == 0) {
|
||||||
GL11.glColorMask(false, true, true, false);
|
//GL11.glColorMask(false, true, true, false);
|
||||||
} else {
|
//} else {
|
||||||
GL11.glColorMask(true, false, false, false);
|
//GL11.glColorMask(true, false, false, false);
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(var13 > 0) {
|
//if(var13 > 0) {
|
||||||
var3.renderAllRenderLists(1, (double)var1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var3.sortAndRender(var2, 1, (double)var1);
|
var3.sortAndRender(var2, 1, (double)var1);
|
||||||
}
|
//}
|
||||||
|
//} else {
|
||||||
|
//var3.sortAndRender(var2, 1, (double)var1);
|
||||||
|
//}
|
||||||
|
|
||||||
GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
enum EnumOS {
|
|
||||||
linux,
|
|
||||||
solaris,
|
|
||||||
windows,
|
|
||||||
macos,
|
|
||||||
unknown;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
enum EnumOSIsom {
|
|
||||||
linux,
|
|
||||||
solaris,
|
|
||||||
windows,
|
|
||||||
macos,
|
|
||||||
unknown;
|
|
||||||
}
|
|
|
@ -1,6 +1,9 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@ -15,7 +18,7 @@ public class FontRenderer {
|
||||||
MinecraftImageData bufferedimage = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes(s));
|
MinecraftImageData bufferedimage = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes(s));
|
||||||
int i = bufferedimage.w;
|
int i = bufferedimage.w;
|
||||||
int j = bufferedimage.h;
|
int j = bufferedimage.h;
|
||||||
int ai[] = bufferedimage.data;
|
int ai[] = bufferedimage.data();
|
||||||
for (int k = 0; k < 256; k++) {
|
for (int k = 0; k < 256; k++) {
|
||||||
int l = k % 16;
|
int l = k % 16;
|
||||||
int k1 = k / 16;
|
int k1 = k / 16;
|
||||||
|
@ -169,4 +172,13 @@ public class FontRenderer {
|
||||||
private IntBuffer buffer;
|
private IntBuffer buffer;
|
||||||
|
|
||||||
public static final char formatChar = '\247';
|
public static final char formatChar = '\247';
|
||||||
|
|
||||||
|
public List<String> listFormattedStringToWidth(String title2) {
|
||||||
|
java.util.ArrayList arraylist = new java.util.ArrayList();
|
||||||
|
String[] string = title2.split("\n");
|
||||||
|
for (String list : string) {
|
||||||
|
arraylist.add(list);
|
||||||
|
}
|
||||||
|
return arraylist;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,22 +1,28 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
public class Frustrum implements ICamera {
|
public class Frustrum implements ICamera {
|
||||||
private ClippingHelper clippingHelper = ClippingHelperImplementation.getInstance();
|
private final ClippingHelper clippingHelper = ClippingHelperImplementation.getInstance();
|
||||||
private double xPosition;
|
private double xPosition;
|
||||||
private double yPosition;
|
private double yPosition;
|
||||||
private double zPosition;
|
private double zPosition;
|
||||||
|
|
||||||
public void setPosition(double var1, double var3, double var5) {
|
public void setPosition(double x, double y, double z) {
|
||||||
this.xPosition = var1;
|
xPosition = x;
|
||||||
this.yPosition = var3;
|
yPosition = y;
|
||||||
this.zPosition = var5;
|
zPosition = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBoxInFrustum(double var1, double var3, double var5, double var7, double var9, double var11) {
|
public boolean isBoxInFrustum(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||||
return this.clippingHelper.isBoxInFrustum(var1 - this.xPosition, var3 - this.yPosition, var5 - this.zPosition, var7 - this.xPosition, var9 - this.yPosition, var11 - this.zPosition);
|
minX -= xPosition;
|
||||||
|
minY -= yPosition;
|
||||||
|
minZ -= zPosition;
|
||||||
|
maxX -= xPosition;
|
||||||
|
maxY -= yPosition;
|
||||||
|
maxZ -= zPosition;
|
||||||
|
return clippingHelper.isBoxInFrustum(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBoundingBoxInFrustum(AxisAlignedBB var1) {
|
public boolean isBoundingBoxInFrustum(AxisAlignedBB boundingBox) {
|
||||||
return this.isBoxInFrustum(var1.minX, var1.minY, var1.minZ, var1.maxX, var1.maxY, var1.maxZ);
|
return isBoxInFrustum(boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import net.PeytonPlayz585.io.File;
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class GuiCreateWorld extends GuiScreen {
|
public class GuiCreateWorld extends GuiScreen {
|
||||||
protected GuiScreen parentGuiScreen;
|
protected GuiScreen parentGuiScreen;
|
||||||
|
@ -12,16 +12,14 @@ public class GuiCreateWorld extends GuiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
File var1 = Minecraft.getMinecraftDir();
|
|
||||||
|
|
||||||
for(int var2 = 0; var2 < 5; ++var2) {
|
for(int var2 = 0; var2 < 5; ++var2) {
|
||||||
NBTTagCompound var3 = World.getLevelData(var1, "World" + (var2 + 1));
|
NBTTagCompound var3 = World.getLevelData("World" + (var2 + 1));
|
||||||
if(var3 == null) {
|
if(var3 == null) {
|
||||||
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, "- empty -"));
|
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, "- empty -"));
|
||||||
} else {
|
} else {
|
||||||
String var4 = "World " + (var2 + 1);
|
String var4 = "World " + (var2 + 1);
|
||||||
long var5 = var3.getLong("SizeOnDisk");
|
double var5 = LWJGLMain.getFileSize("World" + (var2 + 1) + "/level.dat");
|
||||||
var4 = var4 + " (" + (float)(var5 / 1024L * 100L / 1024L) / 100.0F + " MB)";
|
var4 = var4 + " (" + (double) var5 / 100 + " MB)";
|
||||||
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, var4));
|
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, var4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +28,7 @@ public class GuiCreateWorld extends GuiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSaveFileName(int var1) {
|
protected String getSaveFileName(int var1) {
|
||||||
File var2 = Minecraft.getMinecraftDir();
|
return World.getLevelData("World" + var1) != null ? "World" + var1 : null;
|
||||||
return World.getLevelData(var2, "World" + var1) != null ? "World" + var1 : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initButtons() {
|
public void initButtons() {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import net.PeytonPlayz585.io.File;
|
|
||||||
|
|
||||||
public class GuiDeleteWorld extends GuiCreateWorld {
|
public class GuiDeleteWorld extends GuiCreateWorld {
|
||||||
public GuiDeleteWorld(GuiScreen var1) {
|
public GuiDeleteWorld(GuiScreen var1) {
|
||||||
super(var1);
|
super(var1);
|
||||||
|
@ -22,8 +20,7 @@ public class GuiDeleteWorld extends GuiCreateWorld {
|
||||||
|
|
||||||
public void deleteWorld(boolean var1, int var2) {
|
public void deleteWorld(boolean var1, int var2) {
|
||||||
if(var1) {
|
if(var1) {
|
||||||
File var3 = Minecraft.getMinecraftDir();
|
World.deleteWorld(this.getSaveFileName(var2));
|
||||||
World.deleteWorld(var3, this.getSaveFileName(var2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mc.displayGuiScreen(this.parentGuiScreen);
|
this.mc.displayGuiScreen(this.parentGuiScreen);
|
||||||
|
|
|
@ -29,9 +29,9 @@ public class GuiIngame extends Gui {
|
||||||
FontRenderer var8 = this.mc.fontRenderer;
|
FontRenderer var8 = this.mc.fontRenderer;
|
||||||
this.mc.entityRenderer.setupOverlayRendering();
|
this.mc.entityRenderer.setupOverlayRendering();
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
if(this.mc.gameSettings.fancyGraphics) {
|
// if(this.mc.gameSettings.fancyGraphics) {
|
||||||
this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
// this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
||||||
}
|
// }
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/gui.png"));
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/gui.png"));
|
||||||
|
|
45
src/main/java/net/minecraft/src/GuiMessage.java
Normal file
45
src/main/java/net/minecraft/src/GuiMessage.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GuiMessage extends GuiScreen {
|
||||||
|
|
||||||
|
private String title1;
|
||||||
|
private String title2;
|
||||||
|
private final List listLines2 = new ArrayList();
|
||||||
|
private GuiScreen parent;
|
||||||
|
|
||||||
|
public GuiMessage(GuiScreen var1, String var2, String var3) {
|
||||||
|
parent = var1;
|
||||||
|
title1 = var2;
|
||||||
|
title2 = var3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initGui() {
|
||||||
|
this.controlList.clear();
|
||||||
|
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 72, "I Understand!"));
|
||||||
|
this.listLines2.clear();
|
||||||
|
this.listLines2.addAll(this.fontRenderer.listFormattedStringToWidth(this.title2));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void actionPerformed(GuiButton var1) {
|
||||||
|
if(var1.id == 0) {
|
||||||
|
this.mc.displayGuiScreen(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreen(int var1, int var2, float var3) {
|
||||||
|
this.drawDefaultBackground();
|
||||||
|
this.drawCenteredString(fontRenderer, title1, this.width / 2 - 5, 70, 16777215);
|
||||||
|
int i = 90;
|
||||||
|
|
||||||
|
for (Object s : this.listLines2) {
|
||||||
|
this.drawCenteredString(this.fontRenderer, (String) s, this.width / 2 - 5, i, 16777215);
|
||||||
|
i += 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.drawScreen(var1, var2, var3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ public class GuiScreen extends Gui {
|
||||||
protected Minecraft mc;
|
protected Minecraft mc;
|
||||||
public int width;
|
public int width;
|
||||||
public int height;
|
public int height;
|
||||||
protected List controlList = new ArrayList();
|
protected List<GuiButton> controlList = new ArrayList<GuiButton>();
|
||||||
public boolean allowUserInput = false;
|
public boolean allowUserInput = false;
|
||||||
protected FontRenderer fontRenderer;
|
protected FontRenderer fontRenderer;
|
||||||
|
|
||||||
|
|
|
@ -5,5 +5,7 @@ public interface IProgressUpdate {
|
||||||
|
|
||||||
void displayLoadingString(String var1);
|
void displayLoadingString(String var1);
|
||||||
|
|
||||||
|
void displayLoadingString(String var1, String var2);
|
||||||
|
|
||||||
void setLoadingProgress(int var1);
|
void setLoadingProgress(int var1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,23 @@ public class LoadingScreenRenderer implements IProgressUpdate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayLoadingString(String s, String s1) {
|
||||||
|
if (!mc.running) {
|
||||||
|
if (printText) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
throw new MinecraftError();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
systemTime = 0L;
|
||||||
|
currentlyDisplayedProgress = s1;
|
||||||
|
currentlyDisplayedText = s;
|
||||||
|
setLoadingProgress(-1);
|
||||||
|
systemTime = 0L;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setLoadingProgress(int var1) {
|
public void setLoadingProgress(int var1) {
|
||||||
if(!this.mc.running) {
|
if(!this.mc.running) {
|
||||||
if(!this.printText) {
|
if(!this.printText) {
|
||||||
|
|
|
@ -1,23 +1,30 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
public class MathHelper {
|
public class MathHelper {
|
||||||
private static final float[] SIN_TABLE = new float[65536];
|
private static final float[] SIN_TABLE = new float[4096];
|
||||||
private static final float SIN_CONVERSION_FACTOR = 10430.378F;
|
|
||||||
private static final float COS_CONVERSION_FACTOR = 16384.0F;
|
|
||||||
private static final float INVERSE_SIN_TABLE_LENGTH = 1.0F / SIN_TABLE.length;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (int i = 0; i < SIN_TABLE.length; ++i) {
|
for (int j = 0; j < 4096; ++j) {
|
||||||
SIN_TABLE[i] = (float) Math.sin(i * 2 * Math.PI * INVERSE_SIN_TABLE_LENGTH);
|
SIN_TABLE[j] = (float)Math.sin((double)(((float)j + 0.5F) / 4096.0F * ((float)Math.PI * 2F)));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int l = 0; l < 360; l += 90) {
|
||||||
|
SIN_TABLE[(int)((float)l * 11.377778F) & 4095] = (float)Math.sin((double)((float)l * 0.017453292F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final float sin(float var0) {
|
/**
|
||||||
return SIN_TABLE[(int) (var0 * SIN_CONVERSION_FACTOR) & 65535];
|
* sin looked up in a table
|
||||||
|
*/
|
||||||
|
public static float sin(float p_76126_0_) {
|
||||||
|
return SIN_TABLE[(int)(p_76126_0_ * 651.8986F) & 4095];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final float cos(float var0) {
|
/**
|
||||||
return SIN_TABLE[(int) (var0 * SIN_CONVERSION_FACTOR + COS_CONVERSION_FACTOR) & 65535];
|
* cos looked up in the sin table with the appropriate offset
|
||||||
|
*/
|
||||||
|
public static float cos(float value) {
|
||||||
|
return SIN_TABLE[(int)((value + ((float)Math.PI / 2F)) * 651.8986F) & 4095];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final float sqrt_float(float var0) {
|
public static final float sqrt_float(float var0) {
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
import org.lwjgl.LWJGLException;
|
import org.lwjgl.LWJGLException;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.Display;
|
import org.lwjgl.opengl.Display;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import net.PeytonPlayz585.io.File;
|
|
||||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class Minecraft implements Runnable {
|
public class Minecraft implements Runnable {
|
||||||
public PlayerController playerController = new PlayerControllerSP(this);
|
public PlayerController playerController = new PlayerControllerSP(this);
|
||||||
private boolean fullscreen = false;
|
|
||||||
public int displayWidth;
|
public int displayWidth;
|
||||||
public int displayHeight;
|
public int displayHeight;
|
||||||
private Timer timer = new Timer(20.0F);
|
private Timer timer = new Timer(20.0F);
|
||||||
|
@ -29,8 +29,6 @@ public class Minecraft implements Runnable {
|
||||||
public EntityRenderer entityRenderer = new EntityRenderer(this);
|
public EntityRenderer entityRenderer = new EntityRenderer(this);
|
||||||
private int ticksRan = 0;
|
private int ticksRan = 0;
|
||||||
private int leftClickCounter = 0;
|
private int leftClickCounter = 0;
|
||||||
private int tempDisplayWidth;
|
|
||||||
private int tempDisplayHeight;
|
|
||||||
public String objectMouseOverString = null;
|
public String objectMouseOverString = null;
|
||||||
public int rightClickDelayTimer = 0;
|
public int rightClickDelayTimer = 0;
|
||||||
public GuiIngame ingameGUI;
|
public GuiIngame ingameGUI;
|
||||||
|
@ -38,14 +36,11 @@ public class Minecraft implements Runnable {
|
||||||
public ModelBiped playerModelBiped = new ModelBiped(0.0F);
|
public ModelBiped playerModelBiped = new ModelBiped(0.0F);
|
||||||
public MovingObjectPosition objectMouseOver = null;
|
public MovingObjectPosition objectMouseOver = null;
|
||||||
public GameSettings gameSettings;
|
public GameSettings gameSettings;
|
||||||
//public SoundManager sndManager = new SoundManager();
|
|
||||||
public MouseHelper mouseHelper;
|
public MouseHelper mouseHelper;
|
||||||
public File mcDataDir;
|
|
||||||
public static long[] tickTimes = new long[512];
|
public static long[] tickTimes = new long[512];
|
||||||
public static int numRecordedFrameTimes = 0;
|
public static int numRecordedFrameTimes = 0;
|
||||||
private TextureWaterFX textureWaterFX = new TextureWaterFX();
|
private TextureWaterFX textureWaterFX = new TextureWaterFX();
|
||||||
private TextureLavaFX textureLavaFX = new TextureLavaFX();
|
private TextureLavaFX textureLavaFX = new TextureLavaFX();
|
||||||
private static File minecraftDir = null;
|
|
||||||
volatile boolean running = true;
|
volatile boolean running = true;
|
||||||
public String debug = "";
|
public String debug = "";
|
||||||
long prevFrameTime = -1L;
|
long prevFrameTime = -1L;
|
||||||
|
@ -53,22 +48,18 @@ public class Minecraft implements Runnable {
|
||||||
private int mouseTicksRan = 0;
|
private int mouseTicksRan = 0;
|
||||||
public boolean isRaining = false;
|
public boolean isRaining = false;
|
||||||
long systemTime = System.currentTimeMillis();
|
long systemTime = System.currentTimeMillis();
|
||||||
|
private static Minecraft mc;
|
||||||
|
|
||||||
public Minecraft(int var4, int var5, boolean var6) {
|
public Minecraft(int var4, int var5, boolean var6) {
|
||||||
this.tempDisplayWidth = var4;
|
|
||||||
this.tempDisplayHeight = var5;
|
|
||||||
this.fullscreen = var6;
|
|
||||||
new ThreadSleepForever(this, "Timer hack thread");
|
new ThreadSleepForever(this, "Timer hack thread");
|
||||||
this.displayWidth = var4;
|
this.displayWidth = var4;
|
||||||
this.displayHeight = var5;
|
this.displayHeight = var5;
|
||||||
this.fullscreen = var6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServer(String var1, int var2) {
|
public void setServer(String var1, int var2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startGame() throws LWJGLException {
|
public void startGame() {
|
||||||
this.mcDataDir = getMinecraftDir();
|
|
||||||
this.gameSettings = new GameSettings(this);
|
this.gameSettings = new GameSettings(this);
|
||||||
this.renderEngine = new RenderEngine(this.gameSettings);
|
this.renderEngine = new RenderEngine(this.gameSettings);
|
||||||
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
|
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
|
||||||
|
@ -88,7 +79,6 @@ public class Minecraft implements Runnable {
|
||||||
GL11.glLoadIdentity();
|
GL11.glLoadIdentity();
|
||||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||||
this.checkGLError("Startup");
|
this.checkGLError("Startup");
|
||||||
//this.sndManager.loadSoundSettings(this.gameSettings);
|
|
||||||
this.renderEngine.registerTextureFX(this.textureLavaFX);
|
this.renderEngine.registerTextureFX(this.textureLavaFX);
|
||||||
this.renderEngine.registerTextureFX(this.textureWaterFX);
|
this.renderEngine.registerTextureFX(this.textureWaterFX);
|
||||||
this.renderEngine.registerTextureFX(new TextureWaterFlowFX());
|
this.renderEngine.registerTextureFX(new TextureWaterFlowFX());
|
||||||
|
@ -97,14 +87,14 @@ public class Minecraft implements Runnable {
|
||||||
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
|
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
|
||||||
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
|
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
|
||||||
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
||||||
this.displayGuiScreen(new GuiMainMenu());
|
Minecraft.getMinecraft().displayGuiMessage(new GuiMainMenu(), "EARLY BETA TESTING!", "THIS PROJECT IS STILL IN TESTING!\nTHERE WILL BE BUGS!");
|
||||||
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
||||||
this.checkGLError("Post startup");
|
this.checkGLError("Post startup");
|
||||||
this.ingameGUI = new GuiIngame(this);
|
this.ingameGUI = new GuiIngame(this);
|
||||||
this.playerController.init();
|
this.playerController.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadScreen() throws LWJGLException {
|
private void loadScreen() {
|
||||||
ScaledResolution var1 = new ScaledResolution(this.displayWidth, this.displayHeight);
|
ScaledResolution var1 = new ScaledResolution(this.displayWidth, this.displayHeight);
|
||||||
int var2 = var1.getScaledWidth();
|
int var2 = var1.getScaledWidth();
|
||||||
int var3 = var1.getScaledHeight();
|
int var3 = var1.getScaledHeight();
|
||||||
|
@ -136,44 +126,6 @@ public class Minecraft implements Runnable {
|
||||||
this.fontRenderer.drawStringWithShadow("Loading...", 8, this.displayHeight / 2 - 16, -1);
|
this.fontRenderer.drawStringWithShadow("Loading...", 8, this.displayHeight / 2 - 16, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getMinecraftDir() {
|
|
||||||
if(minecraftDir == null) {
|
|
||||||
minecraftDir = getAppDir("minecraft");
|
|
||||||
}
|
|
||||||
|
|
||||||
return minecraftDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getAppDir(String var0) {
|
|
||||||
String var1 = System.getProperty("user.home", ".");
|
|
||||||
File var2;
|
|
||||||
switch(OSMap.osValues[getOs().ordinal()]) {
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
var2 = new File(var1, '.' + var0 + '/');
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
var2 = new File(var1, '.' + var0 + '/');
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
var2 = new File(var1, "Library/Application Support/" + var0);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
var2 = new File(var1, var0 + '/');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!var2.exists() && !var2.mkdirs()) {
|
|
||||||
throw new RuntimeException("The working directory could not be created: " + var2);
|
|
||||||
} else {
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static EnumOS getOs() {
|
|
||||||
String var0 = System.getProperty("os.name").toLowerCase();
|
|
||||||
return var0.contains("win") ? EnumOS.windows : (var0.contains("mac") ? EnumOS.macos : (var0.contains("solaris") ? EnumOS.solaris : (var0.contains("sunos") ? EnumOS.solaris : (var0.contains("linux") ? EnumOS.linux : (var0.contains("unix") ? EnumOS.linux : EnumOS.unknown)))));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayGuiScreen(GuiScreen var1) {
|
public void displayGuiScreen(GuiScreen var1) {
|
||||||
if(!(this.currentScreen instanceof GuiErrorScreen)) {
|
if(!(this.currentScreen instanceof GuiErrorScreen)) {
|
||||||
if(this.currentScreen != null) {
|
if(this.currentScreen != null) {
|
||||||
|
@ -201,6 +153,11 @@ public class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayGuiMessage(GuiScreen var1, String var2, String var3) {
|
||||||
|
GuiMessage guimessage = new GuiMessage(var1, var2, var3);
|
||||||
|
this.displayGuiScreen(guimessage);
|
||||||
|
}
|
||||||
|
|
||||||
private void checkGLError(String var1) {
|
private void checkGLError(String var1) {
|
||||||
int var2 = GL11.glGetError();
|
int var2 = GL11.glGetError();
|
||||||
if(var2 != 0) {
|
if(var2 != 0) {
|
||||||
|
@ -223,16 +180,8 @@ public class Minecraft implements Runnable {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
this.running = true;
|
this.running = true;
|
||||||
|
|
||||||
try {
|
|
||||||
this.startGame();
|
this.startGame();
|
||||||
} catch (Exception var10) {
|
|
||||||
var10.printStackTrace();
|
|
||||||
new UnexpectedThrowable("Failed to start game", var10);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
long var1 = System.currentTimeMillis();
|
long var1 = System.currentTimeMillis();
|
||||||
int var3 = 0;
|
int var3 = 0;
|
||||||
|
|
||||||
|
@ -258,7 +207,6 @@ public class Minecraft implements Runnable {
|
||||||
this.timer.renderPartialTicks = 1.0F;
|
this.timer.renderPartialTicks = 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks);
|
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
if(this.theWorld != null) {
|
if(this.theWorld != null) {
|
||||||
while(this.theWorld.updatingLighting()) {
|
while(this.theWorld.updatingLighting()) {
|
||||||
|
@ -278,7 +226,7 @@ public class Minecraft implements Runnable {
|
||||||
|
|
||||||
Thread.yield();
|
Thread.yield();
|
||||||
Display.update();
|
Display.update();
|
||||||
if(LWJGLMain.canvas.getWidth() != this.displayWidth || LWJGLMain.canvas.getHeight() != this.displayHeight) {
|
if(Display.getWidth() != this.displayWidth || Display.getHeight() != this.displayHeight) {
|
||||||
this.displayWidth = LWJGLMain.canvas.getWidth();
|
this.displayWidth = LWJGLMain.canvas.getWidth();
|
||||||
this.displayHeight = LWJGLMain.canvas.getHeight();
|
this.displayHeight = LWJGLMain.canvas.getHeight();
|
||||||
if(this.displayWidth <= 0) {
|
if(this.displayWidth <= 0) {
|
||||||
|
@ -293,7 +241,11 @@ public class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.gameSettings.limitFramerate) {
|
if(this.gameSettings.limitFramerate) {
|
||||||
|
try {
|
||||||
Thread.sleep(5L);
|
Thread.sleep(5L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.checkGLError("Post render");
|
this.checkGLError("Post render");
|
||||||
|
@ -305,14 +257,6 @@ public class Minecraft implements Runnable {
|
||||||
var1 += 1000L;
|
var1 += 1000L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (MinecraftError var11) {
|
|
||||||
} catch (Exception var12) {
|
|
||||||
var12.printStackTrace();
|
|
||||||
new UnexpectedThrowable("Unexpected error", var12);
|
|
||||||
} finally {
|
|
||||||
this.shutdownMinecraftApplet();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayDebugInfo() {
|
private void displayDebugInfo() {
|
||||||
|
@ -363,7 +307,7 @@ public class Minecraft implements Runnable {
|
||||||
var9 = var9 * var9 / 255;
|
var9 = var9 * var9 / 255;
|
||||||
int var10 = var9 * var9 / 255;
|
int var10 = var9 * var9 / 255;
|
||||||
var10 = var10 * var10 / 255;
|
var10 = var10 * var10 / 255;
|
||||||
var3.setColorOpaque_I(-16777216 + var10 + var9 * 256 + var8 * 65536);
|
var3.setColorOpaque_I(-16777216 + var10 + var9 * 256 + var8 * 4096);
|
||||||
long var11 = tickTimes[var7] / 200000L;
|
long var11 = tickTimes[var7] / 200000L;
|
||||||
var3.addVertex((double)((float)var7 + 0.5F), (double)((float)((long)this.displayHeight - var11) + 0.5F), 0.0D);
|
var3.addVertex((double)((float)var7 + 0.5F), (double)((float)((long)this.displayHeight - var11) + 0.5F), 0.0D);
|
||||||
var3.addVertex((double)((float)var7 + 0.5F), (double)((float)this.displayHeight + 0.5F), 0.0D);
|
var3.addVertex((double)((float)var7 + 0.5F), (double)((float)this.displayHeight + 0.5F), 0.0D);
|
||||||
|
@ -705,7 +649,7 @@ public class Minecraft implements Runnable {
|
||||||
public void startWorld(String var1) {
|
public void startWorld(String var1) {
|
||||||
this.changeWorld1((World)null);
|
this.changeWorld1((World)null);
|
||||||
System.gc();
|
System.gc();
|
||||||
World var2 = new World(new File(getMinecraftDir(), "saves"), var1);
|
World var2 = new World(var1);
|
||||||
if(var2.isNewWorld) {
|
if(var2.isNewWorld) {
|
||||||
this.changeWorld2(var2, "Generating level");
|
this.changeWorld2(var2, "Generating level");
|
||||||
} else {
|
} else {
|
||||||
|
@ -804,20 +748,6 @@ public class Minecraft implements Runnable {
|
||||||
BlockSand.fallInstantly = false;
|
BlockSand.fallInstantly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void installResource(String var1, File var2) {
|
|
||||||
int var3 = var1.indexOf("/");
|
|
||||||
String var4 = var1.substring(0, var3);
|
|
||||||
var1 = var1.substring(var3 + 1);
|
|
||||||
if(var4.equalsIgnoreCase("sound")) {
|
|
||||||
//this.sndManager.addSound(var1, var2);
|
|
||||||
} else if(var4.equalsIgnoreCase("newsound")) {
|
|
||||||
//this.sndManager.addSound(var1, var2);
|
|
||||||
} else if(var4.equalsIgnoreCase("music")) {
|
|
||||||
//this.sndManager.addMusic(var1, var2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String debugInfoRenders() {
|
public String debugInfoRenders() {
|
||||||
return this.renderGlobal.getDebugInfoRenders();
|
return this.renderGlobal.getDebugInfoRenders();
|
||||||
}
|
}
|
||||||
|
@ -848,4 +778,36 @@ public class Minecraft implements Runnable {
|
||||||
this.playerController.onRespawn(this.thePlayer);
|
this.playerController.onRespawn(this.thePlayer);
|
||||||
this.preloadWorld("Respawning");
|
this.preloadWorld("Respawning");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Minecraft getMinecraft() {
|
||||||
|
return mc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setLighting(boolean var1) {
|
||||||
|
if(!var1) {
|
||||||
|
GL11.glDisable(2896);
|
||||||
|
GL11.glDisable(16384);
|
||||||
|
} else {
|
||||||
|
GL11.glEnable(2896);
|
||||||
|
GL11.glEnable(16384);
|
||||||
|
GL11.glEnable(2903);
|
||||||
|
GL11.glColorMaterial(1032, 5634);
|
||||||
|
float var4 = 0.7F;
|
||||||
|
float var2 = 0.3F;
|
||||||
|
Vec3D var3 = (new Vec3D(0.0F, -1.0F, 0.5F)).normalize();
|
||||||
|
GL11.glLight(16384, 4611, this.createBuffer((float)var3.xCoord, (float)var3.yCoord, (float)var3.zCoord, 0.0F));
|
||||||
|
GL11.glLight(16384, 4609, this.createBuffer(var2, var2, var2, 1.0F));
|
||||||
|
GL11.glLight(16384, 4608, this.createBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
|
GL11.glLightModel(2899, this.createBuffer(var4, var4, var4, 1.0F));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FloatBuffer createBuffer(float var1, float var2, float var3, float var4) {
|
||||||
|
buffer.clear();
|
||||||
|
buffer.put(var1).put(var2).put(var3).put(var4);
|
||||||
|
buffer.flip();
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FloatBuffer buffer = GLAllocation.createFloatBuffer(16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
class OSMap {
|
|
||||||
static final int[] osValues = new int[EnumOS.values().length];
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
osValues[EnumOS.linux.ordinal()] = 1;
|
|
||||||
} catch (NoSuchFieldError var4) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
osValues[EnumOS.solaris.ordinal()] = 2;
|
|
||||||
} catch (NoSuchFieldError var3) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
osValues[EnumOS.windows.ordinal()] = 3;
|
|
||||||
} catch (NoSuchFieldError var2) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
osValues[EnumOS.macos.ordinal()] = 4;
|
|
||||||
} catch (NoSuchFieldError var1) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
class OSMapIsom {
|
|
||||||
static final int[] osValues = new int[EnumOSIsom.values().length];
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
osValues[EnumOSIsom.linux.ordinal()] = 1;
|
|
||||||
} catch (NoSuchFieldError var4) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
osValues[EnumOSIsom.solaris.ordinal()] = 2;
|
|
||||||
} catch (NoSuchFieldError var3) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
osValues[EnumOSIsom.windows.ordinal()] = 3;
|
|
||||||
} catch (NoSuchFieldError var2) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
osValues[EnumOSIsom.macos.ordinal()] = 4;
|
|
||||||
} catch (NoSuchFieldError var1) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -61,45 +61,45 @@ public abstract class Render {
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderShadow(Entity var1, double var2, double var4, double var6, float var8, float var9) {
|
// private void renderShadow(Entity var1, double var2, double var4, double var6, float var8, float var9) {
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
// GL11.glEnable(GL11.GL_BLEND);
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
RenderEngine var10 = this.renderManager.renderEngine;
|
// RenderEngine var10 = this.renderManager.renderEngine;
|
||||||
var10.bindTexture(var10.getTexture("%%/shadow.png"));
|
// var10.bindTexture(var10.getTexture("%%/shadow.png"));
|
||||||
World var11 = this.getWorldFromRenderManager();
|
// World var11 = this.getWorldFromRenderManager();
|
||||||
GL11.glDepthMask(false);
|
// GL11.glDepthMask(false);
|
||||||
float var12 = this.shadowSize;
|
// float var12 = this.shadowSize;
|
||||||
double var13 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9;
|
// double var13 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9;
|
||||||
double var15 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9;
|
// double var15 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9;
|
||||||
double var17 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9;
|
// double var17 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9;
|
||||||
int var19 = MathHelper.floor_double(var13 - (double)var12);
|
// int var19 = MathHelper.floor_double(var13 - (double)var12);
|
||||||
int var20 = MathHelper.floor_double(var13 + (double)var12);
|
// int var20 = MathHelper.floor_double(var13 + (double)var12);
|
||||||
int var21 = MathHelper.floor_double(var15 - (double)var12);
|
// int var21 = MathHelper.floor_double(var15 - (double)var12);
|
||||||
int var22 = MathHelper.floor_double(var15);
|
// int var22 = MathHelper.floor_double(var15);
|
||||||
int var23 = MathHelper.floor_double(var17 - (double)var12);
|
// int var23 = MathHelper.floor_double(var17 - (double)var12);
|
||||||
int var24 = MathHelper.floor_double(var17 + (double)var12);
|
// int var24 = MathHelper.floor_double(var17 + (double)var12);
|
||||||
double var25 = var2 - var13;
|
// double var25 = var2 - var13;
|
||||||
double var27 = var4 - var15;
|
// double var27 = var4 - var15;
|
||||||
double var29 = var6 - var17;
|
// double var29 = var6 - var17;
|
||||||
Tessellator var31 = Tessellator.instance;
|
// Tessellator var31 = Tessellator.instance;
|
||||||
var31.startDrawingQuads();
|
// var31.startDrawingQuads();
|
||||||
|
//
|
||||||
for(int var32 = var19; var32 <= var20; ++var32) {
|
// for(int var32 = var19; var32 <= var20; ++var32) {
|
||||||
for(int var33 = var21; var33 <= var22; ++var33) {
|
// for(int var33 = var21; var33 <= var22; ++var33) {
|
||||||
for(int var34 = var23; var34 <= var24; ++var34) {
|
// for(int var34 = var23; var34 <= var24; ++var34) {
|
||||||
int var35 = var11.getBlockId(var32, var33 - 1, var34);
|
// int var35 = var11.getBlockId(var32, var33 - 1, var34);
|
||||||
if(var35 > 0 && var11.getBlockLightValue(var32, var33, var34) > 3) {
|
// if(var35 > 0 && var11.getBlockLightValue(var32, var33, var34) > 3) {
|
||||||
this.renderShadowOnBlock(Block.blocksList[var35], var2, var4, var6, var32, var33, var34, var8, var12, var25, var27, var29);
|
// this.renderShadowOnBlock(Block.blocksList[var35], var2, var4, var6, var32, var33, var34, var8, var12, var25, var27, var29);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
var31.draw();
|
// var31.draw();
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glDisable(GL11.GL_BLEND);
|
// GL11.glDisable(GL11.GL_BLEND);
|
||||||
GL11.glDepthMask(true);
|
// GL11.glDepthMask(true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
private World getWorldFromRenderManager() {
|
private World getWorldFromRenderManager() {
|
||||||
return this.renderManager.worldObj;
|
return this.renderManager.worldObj;
|
||||||
|
@ -212,7 +212,7 @@ public abstract class Render {
|
||||||
double var10 = this.renderManager.getDistanceToCamera(var1.posX, var1.posY, var1.posZ);
|
double var10 = this.renderManager.getDistanceToCamera(var1.posX, var1.posY, var1.posZ);
|
||||||
float var12 = (float)((1.0D - var10 / 256.0D) * (double)this.shadowOpaque);
|
float var12 = (float)((1.0D - var10 / 256.0D) * (double)this.shadowOpaque);
|
||||||
if(var12 > 0.0F) {
|
if(var12 > 0.0F) {
|
||||||
this.renderShadow(var1, var2, var4, var6, var12, var9);
|
//this.renderShadow(var1, var2, var4, var6, var12, var9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,18 +34,12 @@ public class RenderEngine {
|
||||||
singleIntBuffer.clear();
|
singleIntBuffer.clear();
|
||||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||||
int i = singleIntBuffer.get(0);
|
int i = singleIntBuffer.get(0);
|
||||||
if (s.startsWith("%clamp%")) {
|
if (s.startsWith("%%")) {
|
||||||
clampTexture = true;
|
clampTexture = true;
|
||||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(7))), i);
|
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(7))), i);
|
||||||
clampTexture = false;
|
clampTexture = false;
|
||||||
} else if (s.startsWith("%blur%")) {
|
|
||||||
blurTexture = true;
|
|
||||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(6))), i);
|
|
||||||
blurTexture = false;
|
|
||||||
} else {
|
} else {
|
||||||
if(s.equals("/terrain.png")) {
|
|
||||||
useMipmaps = true;
|
useMipmaps = true;
|
||||||
}
|
|
||||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s)), i);
|
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s)), i);
|
||||||
useMipmaps = false;
|
useMipmaps = false;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +97,7 @@ public class RenderEngine {
|
||||||
}
|
}
|
||||||
int j = bufferedimage.w;
|
int j = bufferedimage.w;
|
||||||
int k = bufferedimage.h;
|
int k = bufferedimage.h;
|
||||||
int ai[] = bufferedimage.data;
|
int ai[] = bufferedimage.data();
|
||||||
byte abyte0[] = new byte[j * k * 4];
|
byte abyte0[] = new byte[j * k * 4];
|
||||||
for (int l = 0; l < ai.length; l++) {
|
for (int l = 0; l < ai.length; l++) {
|
||||||
int j1 = ai[l] >> 24 & 0xff;
|
int j1 = ai[l] >> 24 & 0xff;
|
||||||
|
@ -161,7 +155,7 @@ public class RenderEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTextureForDownloadableImage(String s, String s1) {
|
public int getTextureForDownloadableImage(String s, String s1) {
|
||||||
return getTexture("/mob/char.png");
|
return getTexture("/char.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerTextureFX(TextureFX texturefx) {
|
public void registerTextureFX(TextureFX texturefx) {
|
||||||
|
@ -181,16 +175,19 @@ public class RenderEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindTexture(int i) {
|
public void bindTexture(int i) {
|
||||||
|
Minecraft.getMinecraft().setLighting(true);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
Minecraft.getMinecraft().setLighting(false);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
|
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
|
||||||
|
Minecraft.getMinecraft().setLighting(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean useMipmaps = false;
|
public static boolean useMipmaps = false;
|
||||||
private HashMap<String, Integer> textureMap;
|
private static HashMap<String, Integer> textureMap;
|
||||||
private HashMap<Integer, MinecraftImageData> textureNameToImageMap;
|
private HashMap<Integer, MinecraftImageData> textureNameToImageMap;
|
||||||
private IntBuffer singleIntBuffer;
|
private IntBuffer singleIntBuffer;
|
||||||
private ByteBuffer imageDataB1;
|
private ByteBuffer imageDataB1;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
private int renderersBeingRendered;
|
private int renderersBeingRendered;
|
||||||
private int renderersSkippingRenderPass;
|
private int renderersSkippingRenderPass;
|
||||||
private List glRenderLists = new ArrayList();
|
private List glRenderLists = new ArrayList();
|
||||||
private RenderList[] allRenderLists = new RenderList[]{new RenderList(), new RenderList(), new RenderList(), new RenderList()};
|
//private RenderList[] allRenderLists = new RenderList[]{new RenderList(), new RenderList(), new RenderList(), new RenderList()};
|
||||||
int dummyRenderInt = 0;
|
int dummyRenderInt = 0;
|
||||||
int unusedGLCallList = GLAllocation.generateDisplayLists(1);
|
int unusedGLCallList = GLAllocation.generateDisplayLists(1);
|
||||||
double prevSortX = -9999.0D;
|
double prevSortX = -9999.0D;
|
||||||
|
@ -59,16 +59,6 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
this.renderEngine = var2;
|
this.renderEngine = var2;
|
||||||
byte var3 = 64;
|
byte var3 = 64;
|
||||||
this.glRenderListBase = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3);
|
this.glRenderListBase = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3);
|
||||||
// this.occlusionEnabled = var1.getOpenGlCapsChecker().checkARBOcclusion();
|
|
||||||
// if(this.occlusionEnabled) {
|
|
||||||
// this.occlusionResult.clear();
|
|
||||||
// this.glOcclusionQueryBase = GLAllocation.createIntBuffer(var3 * var3 * var3);
|
|
||||||
// this.glOcclusionQueryBase.clear();
|
|
||||||
// this.glOcclusionQueryBase.position(0);
|
|
||||||
// this.glOcclusionQueryBase.limit(var3 * var3 * var3);
|
|
||||||
// ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase);
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
|
GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
|
||||||
|
@ -223,10 +213,6 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.theWorld, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.glRenderListBase + var2);
|
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.theWorld, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.glRenderListBase + var2);
|
||||||
// if(this.occlusionEnabled) {
|
|
||||||
// this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].glOcclusionQuery = this.glOcclusionQueryBase.get(var3);
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isWaitingOnOcclusionQuery = false;
|
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isWaitingOnOcclusionQuery = false;
|
||||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isVisible = true;
|
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isVisible = true;
|
||||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isInFrustum = true;
|
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isInFrustum = true;
|
||||||
|
@ -383,103 +369,9 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
byte var17 = 0;
|
byte var17 = 0;
|
||||||
int var33;
|
return var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
|
||||||
// if(this.occlusionEnabled && !this.mc.gameSettings.anaglyph && var2 == 0) {
|
|
||||||
// byte var18 = 0;
|
|
||||||
// int var19 = 16;
|
|
||||||
// this.checkOcclusionQueryResult(var18, var19);
|
|
||||||
//
|
|
||||||
// for(int var20 = var18; var20 < var19; ++var20) {
|
|
||||||
// this.sortedWorldRenderers[var20].isVisible = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// var33 = var17 + this.renderSortedRenderers(var18, var19, var2, var3);
|
|
||||||
//
|
|
||||||
// do {
|
|
||||||
// int var34 = var19;
|
|
||||||
// var19 *= 2;
|
|
||||||
// if(var19 > this.sortedWorldRenderers.length) {
|
|
||||||
// var19 = this.sortedWorldRenderers.length;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// GL11.glDisable(GL11.GL_TEXTURE_2D);
|
|
||||||
// GL11.glDisable(GL11.GL_LIGHTING);
|
|
||||||
// GL11.glDisable(GL11.GL_ALPHA_TEST);
|
|
||||||
// GL11.glDisable(GL11.GL_FOG);
|
|
||||||
// GL11.glColorMask(false, false, false, false);
|
|
||||||
// GL11.glDepthMask(false);
|
|
||||||
// this.checkOcclusionQueryResult(var34, var19);
|
|
||||||
// GL11.glPushMatrix();
|
|
||||||
// float var35 = 0.0F;
|
|
||||||
// float var21 = 0.0F;
|
|
||||||
// float var22 = 0.0F;
|
|
||||||
//
|
|
||||||
// for(int var23 = var34; var23 < var19; ++var23) {
|
|
||||||
// if(this.sortedWorldRenderers[var23].skipAllRenderPasses()) {
|
|
||||||
// this.sortedWorldRenderers[var23].isInFrustum = false;
|
|
||||||
// } else {
|
|
||||||
// if(!this.sortedWorldRenderers[var23].isInFrustum) {
|
|
||||||
// this.sortedWorldRenderers[var23].isVisible = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(this.sortedWorldRenderers[var23].isInFrustum && !this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery) {
|
|
||||||
// float var24 = MathHelper.sqrt_float(this.sortedWorldRenderers[var23].distanceToEntitySquared(var1));
|
|
||||||
// int var25 = (int)(1.0F + var24 / 128.0F);
|
|
||||||
// if(this.cloudTickCounter % var25 == var23 % var25) {
|
|
||||||
// WorldRenderer var26 = this.sortedWorldRenderers[var23];
|
|
||||||
// float var27 = (float)((double)var26.posXMinus - var5);
|
|
||||||
// float var28 = (float)((double)var26.posYMinus - var7);
|
|
||||||
// float var29 = (float)((double)var26.posZMinus - var9);
|
|
||||||
// float var30 = var27 - var35;
|
|
||||||
// float var31 = var28 - var21;
|
|
||||||
// float var32 = var29 - var22;
|
|
||||||
// if(var30 != 0.0F || var31 != 0.0F || var32 != 0.0F) {
|
|
||||||
// GL11.glTranslatef(var30, var31, var32);
|
|
||||||
// var35 += var30;
|
|
||||||
// var21 += var31;
|
|
||||||
// var22 += var32;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// ARBOcclusionQuery.glBeginQueryARB(GL15.GL_SAMPLES_PASSED, this.sortedWorldRenderers[var23].glOcclusionQuery);
|
|
||||||
// this.sortedWorldRenderers[var23].callOcclusionQueryList();
|
|
||||||
// ARBOcclusionQuery.glEndQueryARB(GL15.GL_SAMPLES_PASSED);
|
|
||||||
// this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// GL11.glPopMatrix();
|
|
||||||
// GL11.glColorMask(true, true, true, true);
|
|
||||||
// GL11.glDepthMask(true);
|
|
||||||
// GL11.glEnable(GL11.GL_TEXTURE_2D);
|
|
||||||
// GL11.glEnable(GL11.GL_ALPHA_TEST);
|
|
||||||
// GL11.glEnable(GL11.GL_FOG);
|
|
||||||
// var33 += this.renderSortedRenderers(var34, var19, var2, var3);
|
|
||||||
// } while(var19 < this.sortedWorldRenderers.length);
|
|
||||||
// } else {
|
|
||||||
var33 = var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
|
|
||||||
//}
|
|
||||||
|
|
||||||
return var33;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void checkOcclusionQueryResult(int var1, int var2) {
|
|
||||||
// for(int var3 = var1; var3 < var2; ++var3) {
|
|
||||||
// if(this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery) {
|
|
||||||
// this.occlusionResult.clear();
|
|
||||||
// ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT_AVAILABLE, this.occlusionResult);
|
|
||||||
// if(this.occlusionResult.get(0) != 0) {
|
|
||||||
// this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery = false;
|
|
||||||
// this.occlusionResult.clear();
|
|
||||||
// ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT, this.occlusionResult);
|
|
||||||
// this.sortedWorldRenderers[var3].isVisible = this.occlusionResult.get(0) != 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
private int renderSortedRenderers(int var1, int var2, int var3, double var4) {
|
private int renderSortedRenderers(int var1, int var2, int var3, double var4) {
|
||||||
this.glRenderLists.clear();
|
this.glRenderLists.clear();
|
||||||
int var6 = 0;
|
int var6 = 0;
|
||||||
|
@ -509,42 +401,18 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
double var20 = var19.lastTickPosX + (var19.posX - var19.lastTickPosX) * var4;
|
double var20 = var19.lastTickPosX + (var19.posX - var19.lastTickPosX) * var4;
|
||||||
double var10 = var19.lastTickPosY + (var19.posY - var19.lastTickPosY) * var4;
|
double var10 = var19.lastTickPosY + (var19.posY - var19.lastTickPosY) * var4;
|
||||||
double var12 = var19.lastTickPosZ + (var19.posZ - var19.lastTickPosZ) * var4;
|
double var12 = var19.lastTickPosZ + (var19.posZ - var19.lastTickPosZ) * var4;
|
||||||
int var14 = 0;
|
|
||||||
|
|
||||||
int var15;
|
for (int i2 = 0; i2 < glRenderLists.size(); i2++) {
|
||||||
for(var15 = 0; var15 < this.allRenderLists.length; ++var15) {
|
WorldRenderer worldrenderer = (WorldRenderer) glRenderLists.get(i2);
|
||||||
this.allRenderLists[var15].reset();
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float)(worldrenderer.posXMinus - var20), (float)(worldrenderer.posYMinus - var10), (float)(worldrenderer.posZMinus - var12));
|
||||||
|
GL11.glCallList(worldrenderer.getGLCallListForPass(var3));
|
||||||
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var15 = 0; var15 < this.glRenderLists.size(); ++var15) {
|
|
||||||
WorldRenderer var16 = (WorldRenderer)this.glRenderLists.get(var15);
|
|
||||||
int var17 = -1;
|
|
||||||
|
|
||||||
for(int var18 = 0; var18 < var14; ++var18) {
|
|
||||||
if(this.allRenderLists[var18].isRenderedAt(var16.posXMinus, var16.posYMinus, var16.posZMinus)) {
|
|
||||||
var17 = var18;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var17 < 0) {
|
|
||||||
var17 = var14++;
|
|
||||||
this.allRenderLists[var17].setLocation(var16.posXMinus, var16.posYMinus, var16.posZMinus, var20, var10, var12);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.allRenderLists[var17].render(var16.getGLCallListForPass(var3));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.renderAllRenderLists(var3, var4);
|
|
||||||
return var6;
|
return var6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderAllRenderLists(int var1, double var2) {
|
|
||||||
for(int var4 = 0; var4 < this.allRenderLists.length; ++var4) {
|
|
||||||
this.allRenderLists[var4].render();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateClouds() {
|
public void updateClouds() {
|
||||||
++this.cloudTickCounter;
|
++this.cloudTickCounter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
package net.minecraft.src;
|
//package net.minecraft.src;
|
||||||
|
//
|
||||||
import java.nio.IntBuffer;
|
//import java.nio.IntBuffer;
|
||||||
import org.lwjgl.opengl.GL11;
|
//import org.lwjgl.opengl.GL11;
|
||||||
|
//
|
||||||
public class RenderList {
|
//public class RenderList {
|
||||||
private int posX;
|
// private int posX;
|
||||||
private int posY;
|
// private int posY;
|
||||||
private int posZ;
|
// private int posZ;
|
||||||
private float playerPosX;
|
// private float playerPosX;
|
||||||
private float playerPosY;
|
// private float playerPosY;
|
||||||
private float playerPosZ;
|
// private float playerPosZ;
|
||||||
private IntBuffer buffer = GLAllocation.createIntBuffer(65536);
|
// private IntBuffer buffer = GLAllocation.createIntBuffer(65536);
|
||||||
private boolean render = false;
|
// private boolean render = false;
|
||||||
private boolean isCached = false;
|
// private boolean isCached = false;
|
||||||
|
//
|
||||||
public void setLocation(int var1, int var2, int var3, double var4, double var6, double var8) {
|
// public void setLocation(int var1, int var2, int var3, double var4, double var6, double var8) {
|
||||||
this.render = true;
|
// this.render = true;
|
||||||
this.buffer.clear();
|
// this.buffer.clear();
|
||||||
this.posX = var1;
|
// this.posX = var1;
|
||||||
this.posY = var2;
|
// this.posY = var2;
|
||||||
this.posZ = var3;
|
// this.posZ = var3;
|
||||||
this.playerPosX = (float)var4;
|
// this.playerPosX = (float)var4;
|
||||||
this.playerPosY = (float)var6;
|
// this.playerPosY = (float)var6;
|
||||||
this.playerPosZ = (float)var8;
|
// this.playerPosZ = (float)var8;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isRenderedAt(int var1, int var2, int var3) {
|
// public boolean isRenderedAt(int var1, int var2, int var3) {
|
||||||
return !this.render ? false : var1 == this.posX && var2 == this.posY && var3 == this.posZ;
|
// return !this.render ? false : var1 == this.posX && var2 == this.posY && var3 == this.posZ;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void render(int var1) {
|
// public void render(int var1) {
|
||||||
this.buffer.put(var1);
|
// this.buffer.put(var1);
|
||||||
if(this.buffer.remaining() == 0) {
|
// if(this.buffer.remaining() == 0) {
|
||||||
this.render();
|
// this.render();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void render() {
|
// public void render() {
|
||||||
if(this.render) {
|
// if(this.render) {
|
||||||
if(!this.isCached) {
|
// if(!this.isCached) {
|
||||||
this.buffer.flip();
|
// this.buffer.flip();
|
||||||
this.isCached = true;
|
// this.isCached = true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(this.buffer.remaining() > 0) {
|
// if(this.buffer.remaining() > 0) {
|
||||||
GL11.glPushMatrix();
|
// GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float)this.posX - this.playerPosX, (float)this.posY - this.playerPosY, (float)this.posZ - this.playerPosZ);
|
// GL11.glTranslatef((float)this.posX - this.playerPosX, (float)this.posY - this.playerPosY, (float)this.posZ - this.playerPosZ);
|
||||||
GL11.glCallLists(this.buffer);
|
// GL11.glCallLists(this.buffer);
|
||||||
GL11.glPopMatrix();
|
// GL11.glPopMatrix();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void reset() {
|
// public void reset() {
|
||||||
this.render = false;
|
// this.render = false;
|
||||||
this.isCached = false;
|
// this.isCached = false;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -78,7 +78,6 @@ public class SpawnerAnimals {
|
||||||
try {
|
try {
|
||||||
var32 = (EntityLiving)this.entities[var8].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
var32 = (EntityLiving)this.entities[var8].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||||
} catch (Exception var30) {
|
} catch (Exception var30) {
|
||||||
var30.printStackTrace();
|
|
||||||
return var5;
|
return var5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class TerrainTextureManager {
|
||||||
field_1184_e = new int[5120];
|
field_1184_e = new int[5120];
|
||||||
field_1183_f = new int[34];
|
field_1183_f = new int[34];
|
||||||
field_1182_g = new int[768];
|
field_1182_g = new int[768];
|
||||||
int ai[] = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes("/terrain.png")).data;
|
int ai[] = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes("/terrain.png")).data();
|
||||||
for (int j = 0; j < 256; j++) {
|
for (int j = 0; j < 256; j++) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
|
|
|
@ -7,88 +7,25 @@ import org.teavm.jso.typedarrays.Int32Array;
|
||||||
|
|
||||||
public class Tessellator {
|
public class Tessellator {
|
||||||
|
|
||||||
/** The byte buffer used for GL allocation. */
|
|
||||||
private Int32Array intBuffer;
|
private Int32Array intBuffer;
|
||||||
private Float32Array floatBuffer;
|
private Float32Array floatBuffer;
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of vertices to be drawn in the next draw call. Reset to 0 between
|
|
||||||
* draw calls.
|
|
||||||
*/
|
|
||||||
private int vertexCount = 0;
|
private int vertexCount = 0;
|
||||||
|
|
||||||
/** The first coordinate to be used for the texture. */
|
|
||||||
private float textureU;
|
private float textureU;
|
||||||
|
|
||||||
/** The second coordinate to be used for the texture. */
|
|
||||||
private float textureV;
|
private float textureV;
|
||||||
|
|
||||||
/** The color (RGBA) value to be used for the following draw call. */
|
|
||||||
private int color;
|
private int color;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the current draw object for this tessellator has color values.
|
|
||||||
*/
|
|
||||||
private boolean hasColor = false;
|
private boolean hasColor = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the current draw object for this tessellator has texture coordinates.
|
|
||||||
*/
|
|
||||||
private boolean hasTexture = false;
|
private boolean hasTexture = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the current draw object for this tessellator has normal values.
|
|
||||||
*/
|
|
||||||
private boolean hasNormals = false;
|
|
||||||
|
|
||||||
/** The index into the raw buffer to be used for the next data. */
|
|
||||||
private int rawBufferIndex = 0;
|
private int rawBufferIndex = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of vertices manually added to the given draw call. This differs
|
|
||||||
* from vertexCount because it adds extra vertices when converting quads to
|
|
||||||
* triangles.
|
|
||||||
*/
|
|
||||||
private int addedVertices = 0;
|
private int addedVertices = 0;
|
||||||
|
|
||||||
/** Disables all color information for the following draw call. */
|
|
||||||
private boolean isColorDisabled = false;
|
private boolean isColorDisabled = false;
|
||||||
|
|
||||||
/** The draw mode currently being used by the tessellator. */
|
|
||||||
private int drawMode;
|
private int drawMode;
|
||||||
|
|
||||||
/**
|
|
||||||
* An offset to be applied along the x-axis for all vertices in this draw call.
|
|
||||||
*/
|
|
||||||
private double xOffset;
|
private double xOffset;
|
||||||
|
|
||||||
/**
|
|
||||||
* An offset to be applied along the y-axis for all vertices in this draw call.
|
|
||||||
*/
|
|
||||||
private double yOffset;
|
private double yOffset;
|
||||||
|
|
||||||
/**
|
|
||||||
* An offset to be applied along the z-axis for all vertices in this draw call.
|
|
||||||
*/
|
|
||||||
private double zOffset;
|
private double zOffset;
|
||||||
|
public static final Tessellator instance = new Tessellator(524288);
|
||||||
/** The normal to be applied to the face being drawn. */
|
|
||||||
private int normal;
|
|
||||||
|
|
||||||
/** The static instance of the Tessellator. */
|
|
||||||
public static final Tessellator instance = new Tessellator(525000);
|
|
||||||
|
|
||||||
/** Whether this tessellator is currently in draw mode. */
|
|
||||||
private boolean isDrawing = false;
|
private boolean isDrawing = false;
|
||||||
|
|
||||||
/** Whether we are currently using VBO or not. */
|
|
||||||
private boolean useVBO = false;
|
|
||||||
|
|
||||||
/** The size of the buffers used (in integers). */
|
|
||||||
private int bufferSize;
|
|
||||||
|
|
||||||
private Tessellator(int par1) {
|
private Tessellator(int par1) {
|
||||||
this.bufferSize = par1;
|
|
||||||
ArrayBuffer a = ArrayBuffer.create(par1 * 4);
|
ArrayBuffer a = ArrayBuffer.create(par1 * 4);
|
||||||
this.intBuffer = Int32Array.create(a);
|
this.intBuffer = Int32Array.create(a);
|
||||||
this.floatBuffer = Float32Array.create(a);
|
this.floatBuffer = Float32Array.create(a);
|
||||||
|
@ -114,10 +51,6 @@ public class Tessellator {
|
||||||
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasNormals) {
|
|
||||||
GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glDrawArrays(this.drawMode, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 7));
|
GL11.glDrawArrays(this.drawMode, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 7));
|
||||||
|
|
||||||
if (this.hasTexture) {
|
if (this.hasTexture) {
|
||||||
|
@ -127,10 +60,6 @@ public class Tessellator {
|
||||||
if (this.hasColor) {
|
if (this.hasColor) {
|
||||||
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasNormals) {
|
|
||||||
GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int var1 = this.rawBufferIndex * 4;
|
int var1 = this.rawBufferIndex * 4;
|
||||||
|
@ -167,7 +96,6 @@ public class Tessellator {
|
||||||
this.isDrawing = true;
|
this.isDrawing = true;
|
||||||
this.reset();
|
this.reset();
|
||||||
this.drawMode = par1;
|
this.drawMode = par1;
|
||||||
this.hasNormals = false;
|
|
||||||
this.hasColor = false;
|
this.hasColor = false;
|
||||||
this.hasTexture = false;
|
this.hasTexture = false;
|
||||||
this.isColorDisabled = false;
|
this.isColorDisabled = false;
|
||||||
|
@ -281,10 +209,6 @@ public class Tessellator {
|
||||||
intBuffer0.set(bufferIndex + 5, this.color);
|
intBuffer0.set(bufferIndex + 5, this.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasNormals) {
|
|
||||||
intBuffer0.set(bufferIndex + 6, this.normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rawBufferIndex += 7;
|
this.rawBufferIndex += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,23 +43,22 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||||
return "Chest";
|
return "Chest";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound var1) {
|
public final void readFromNBT(NBTTagCompound var1) {
|
||||||
super.readFromNBT(var1);
|
NBTTagList var5 = var1.getTagList("Items");
|
||||||
NBTTagList var2 = var1.getTagList("Items");
|
this.chestContents = new ItemStack[27];
|
||||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
|
||||||
|
|
||||||
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
for(int var2 = 0; var2 < var5.tagCount(); ++var2) {
|
||||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
NBTTagCompound var3 = (NBTTagCompound)var5.tagAt(var2);
|
||||||
int var5 = var4.getByte("Slot") & 255;
|
int var4 = var3.getByte("Slot") & 255;
|
||||||
if(var5 >= 0 && var5 < this.chestContents.length) {
|
if(var4 >= 0 && var4 < this.chestContents.length) {
|
||||||
this.chestContents[var5] = new ItemStack(var4);
|
this.chestContents[var4] = new ItemStack(var3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound var1) {
|
public final void writeToNBT(NBTTagCompound var1) {
|
||||||
super.writeToNBT(var1);
|
var1.setString("id", "Chest");
|
||||||
NBTTagList var2 = new NBTTagList();
|
NBTTagList var2 = new NBTTagList();
|
||||||
|
|
||||||
for(int var3 = 0; var3 < this.chestContents.length; ++var3) {
|
for(int var3 = 0; var3 < this.chestContents.length; ++var3) {
|
||||||
|
|
|
@ -46,10 +46,10 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||||
return "Chest";
|
return "Chest";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound var1) {
|
public final void readFromNBT(NBTTagCompound var1) {
|
||||||
super.readFromNBT(var1);
|
super.readFromNBT(var1);
|
||||||
NBTTagList var2 = var1.getTagList("Items");
|
NBTTagList var2 = var1.getTagList("Items");
|
||||||
this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
|
this.furnaceItemStacks = new ItemStack[this.furnaceItemStacks.length];
|
||||||
|
|
||||||
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||||
|
@ -61,13 +61,15 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||||
|
|
||||||
this.furnaceBurnTime = var1.getShort("BurnTime");
|
this.furnaceBurnTime = var1.getShort("BurnTime");
|
||||||
this.furnaceCookTime = var1.getShort("CookTime");
|
this.furnaceCookTime = var1.getShort("CookTime");
|
||||||
this.currentItemBurnTime = this.getItemBurnTime(this.furnaceItemStacks[1]);
|
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
|
||||||
|
System.out.println("Lit: " + this.furnaceBurnTime + "/" + this.currentItemBurnTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound var1) {
|
public final void writeToNBT(NBTTagCompound var1) {
|
||||||
super.writeToNBT(var1);
|
super.writeToNBT(var1);
|
||||||
var1.setShort("BurnTime", (short)this.furnaceBurnTime);
|
var1.setShort("BurnTime", (short)this.furnaceBurnTime);
|
||||||
var1.setShort("CookTime", (short)this.furnaceCookTime);
|
var1.setShort("CookTime", (short)this.furnaceCookTime);
|
||||||
|
var1.setString("id", "Furnace");
|
||||||
NBTTagList var2 = new NBTTagList();
|
NBTTagList var2 = new NBTTagList();
|
||||||
|
|
||||||
for(int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) {
|
for(int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound var1) {
|
public void writeToNBT(NBTTagCompound var1) {
|
||||||
super.writeToNBT(var1);
|
super.writeToNBT(var1);
|
||||||
|
var1.setString("id", "MobSpawner");
|
||||||
var1.setString("EntityId", this.mobID);
|
var1.setString("EntityId", this.mobID);
|
||||||
var1.setShort("Delay", (short)this.delay);
|
var1.setShort("Delay", (short)this.delay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ public class TileEntitySign extends TileEntity {
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound var1) {
|
public void writeToNBT(NBTTagCompound var1) {
|
||||||
super.writeToNBT(var1);
|
super.writeToNBT(var1);
|
||||||
|
var1.setString("id", "Sign");
|
||||||
var1.setString("Text1", this.signText[0]);
|
var1.setString("Text1", this.signText[0]);
|
||||||
var1.setString("Text2", this.signText[1]);
|
var1.setString("Text2", this.signText[1]);
|
||||||
var1.setString("Text3", this.signText[2]);
|
var1.setString("Text3", this.signText[2]);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class Vec3D {
|
||||||
return ((Vec3D)vectorList.get(nextVector++)).setComponents(var0, var2, var4);
|
return ((Vec3D)vectorList.get(nextVector++)).setComponents(var0, var2, var4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vec3D(double var1, double var3, double var5) {
|
public Vec3D(double var1, double var3, double var5) {
|
||||||
if(var1 == -0.0D) {
|
if(var1 == -0.0D) {
|
||||||
var1 = 0.0D;
|
var1 = 0.0D;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import net.PeytonPlayz585.io.File;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,6 +12,9 @@ import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.io.FileSystemUtils;
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class World implements IBlockAccess {
|
public class World implements IBlockAccess {
|
||||||
private List lightingToUpdate;
|
private List lightingToUpdate;
|
||||||
private List loadedEntityList;
|
private List loadedEntityList;
|
||||||
|
@ -39,7 +41,7 @@ public class World implements IBlockAccess {
|
||||||
public boolean isNewWorld;
|
public boolean isNewWorld;
|
||||||
private List worldAccesses;
|
private List worldAccesses;
|
||||||
private IChunkProvider chunkProvider;
|
private IChunkProvider chunkProvider;
|
||||||
private File saveDirectory;
|
private static String saveDirectory;
|
||||||
public long randomSeed;
|
public long randomSeed;
|
||||||
private NBTTagCompound nbtCompoundPlayer;
|
private NBTTagCompound nbtCompoundPlayer;
|
||||||
public long setSizeOnDisk;
|
public long setSizeOnDisk;
|
||||||
|
@ -47,52 +49,33 @@ public class World implements IBlockAccess {
|
||||||
private ArrayList collidingBoundingBoxes;
|
private ArrayList collidingBoundingBoxes;
|
||||||
private List entitiesWithinAABBExcludingEntity;
|
private List entitiesWithinAABBExcludingEntity;
|
||||||
|
|
||||||
public static NBTTagCompound getLevelData(File var0, String var1) {
|
public static NBTTagCompound getLevelData(String var1) {
|
||||||
File var2 = new File(var0, "saves");
|
byte[] data = LWJGLMain.readFile(var1 + "/level.dat");
|
||||||
File var3 = new File(var2, var1);
|
System.out.println(var1 + "/level.dat");
|
||||||
if(!var3.exists()) {
|
if(data != null) {
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
File var4 = new File(var3, "level.dat");
|
|
||||||
if(var4.exists()) {
|
|
||||||
try {
|
try {
|
||||||
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var4.getBytes())));
|
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||||
return var6;
|
return var6;
|
||||||
} catch (Exception var7) {
|
} catch (IOException e) {
|
||||||
var7.printStackTrace();
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteWorld(File var0, String var1) {
|
public static void deleteWorld(String var1) {
|
||||||
File var2 = new File(var0, "saves");
|
String dir = var1 + "/";
|
||||||
File var3 = new File(var2, var1);
|
FileSystemUtils.recursiveDeleteDirectoryWithProgress(dir, "Deleting World!", "Please Wait...", Minecraft.getMinecraft().loadingScreen);
|
||||||
if(var3.exists()) {
|
|
||||||
deleteWorldFiles(var3.listFiles());
|
|
||||||
var3.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteWorldFiles(File[] var0) {
|
public World(String var2) {
|
||||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
this(var2, (new Random()).nextLong());
|
||||||
if(var0[var1].isDirectory()) {
|
|
||||||
deleteWorldFiles(var0[var1].listFiles());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var0[var1].delete();
|
public World(String var2, long var3) {
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public World(File var1, String var2) {
|
|
||||||
this(var1, var2, (new Random()).nextLong());
|
|
||||||
}
|
|
||||||
|
|
||||||
public World(File var1, String var2, long var3) {
|
|
||||||
this.lightingToUpdate = new ArrayList();
|
this.lightingToUpdate = new ArrayList();
|
||||||
this.loadedEntityList = new ArrayList();
|
this.loadedEntityList = new ArrayList();
|
||||||
this.unloadedEntityList = new ArrayList();
|
this.unloadedEntityList = new ArrayList();
|
||||||
|
@ -115,14 +98,13 @@ public class World implements IBlockAccess {
|
||||||
this.collidingBoundingBoxes = new ArrayList();
|
this.collidingBoundingBoxes = new ArrayList();
|
||||||
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
||||||
this.levelName = var2;
|
this.levelName = var2;
|
||||||
var1.mkdirs();
|
this.saveDirectory = var2;
|
||||||
this.saveDirectory = new File(var1, var2);
|
byte[] data = LWJGLMain.readFile(saveDirectory + "/level.dat");
|
||||||
this.saveDirectory.mkdirs();
|
System.out.println(saveDirectory + "/level.dat");
|
||||||
File var5 = new File(this.saveDirectory, "level.dat");
|
this.isNewWorld = data == null ? false : true;
|
||||||
this.isNewWorld = !var5.exists();
|
if(data != null) {
|
||||||
if(var5.exists()) {
|
|
||||||
try {
|
try {
|
||||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var5.getBytes())));
|
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||||
NBTTagCompound var7 = var6.getCompoundTag("Data");
|
NBTTagCompound var7 = var6.getCompoundTag("Data");
|
||||||
this.randomSeed = var7.getLong("RandomSeed");
|
this.randomSeed = var7.getLong("RandomSeed");
|
||||||
this.spawnX = var7.getInteger("SpawnX");
|
this.spawnX = var7.getInteger("SpawnX");
|
||||||
|
@ -142,7 +124,7 @@ public class World implements IBlockAccess {
|
||||||
var9 = true;
|
var9 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.chunkProvider = this.getChunkProvider(this.saveDirectory);
|
this.chunkProvider = this.getChunkProvider(saveDirectory);
|
||||||
if(var9) {
|
if(var9) {
|
||||||
this.spawnX = 0;
|
this.spawnX = 0;
|
||||||
this.spawnY = 64;
|
this.spawnY = 64;
|
||||||
|
@ -155,8 +137,8 @@ public class World implements IBlockAccess {
|
||||||
this.calculateInitialSkylight();
|
this.calculateInitialSkylight();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IChunkProvider getChunkProvider(File var1) {
|
protected IChunkProvider getChunkProvider(String var1) {
|
||||||
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1, true), new ChunkProviderGenerate(this, this.randomSeed));
|
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1), new ChunkProviderGenerate(this, this.randomSeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpawnLocation() {
|
public void setSpawnLocation() {
|
||||||
|
@ -228,29 +210,29 @@ public class World implements IBlockAccess {
|
||||||
var2.setTag("Data", var1);
|
var2.setTag("Data", var1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File var3 = new File(this.saveDirectory, "level.dat_new");
|
byte[] var3 = LWJGLMain.readFile(saveDirectory + "/level.dat_new");
|
||||||
File var4 = new File(this.saveDirectory, "level.dat_old");
|
byte[] var4 = LWJGLMain.readFile(saveDirectory + "/level.dat_old");
|
||||||
File var5 = new File(this.saveDirectory, "level.dat");
|
byte[] var5 = LWJGLMain.readFile(saveDirectory + "/level.dat");
|
||||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
||||||
NBTBase.writeNamedTag(var2, new DataOutputStream(bao));
|
NBTBase.writeNamedTag(var2, new DataOutputStream(bao));
|
||||||
var3.writeBytes(bao.toByteArray());
|
LWJGLMain.writeFile(saveDirectory + "/level.dat_new", bao.toByteArray());
|
||||||
if(var4.exists()) {
|
if(LWJGLMain.readFile(saveDirectory + "/level.dat_old") != null) {
|
||||||
var4.delete();
|
LWJGLMain.deleteFile(saveDirectory + "/level.dat_old");
|
||||||
}
|
}
|
||||||
|
|
||||||
var5.renameTo(var4);
|
LWJGLMain.renameFile(saveDirectory + "/level.dat", saveDirectory + "/level.dat_old");
|
||||||
if(var5.exists()) {
|
if(LWJGLMain.readFile(saveDirectory + "/level.dat") != null) {
|
||||||
var5.delete();
|
LWJGLMain.deleteFile(saveDirectory + "/level.dat");
|
||||||
}
|
}
|
||||||
|
|
||||||
var3.renameTo(var5);
|
LWJGLMain.renameFile(saveDirectory + "/level.dat_new", saveDirectory + "/level.dat");
|
||||||
if(var3.exists()) {
|
|
||||||
var3.delete();
|
if(LWJGLMain.readFile(saveDirectory + "/level.dat_new") != null) {
|
||||||
|
LWJGLMain.deleteFile(saveDirectory + "/level.dat_new");
|
||||||
}
|
}
|
||||||
} catch (Exception var6) {
|
} catch (Exception var6) {
|
||||||
var6.printStackTrace();
|
var6.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveWorld(int var1) {
|
public boolean saveWorld(int var1) {
|
||||||
|
|
|
@ -74,10 +74,6 @@ public class WorldRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupGLTranslation() {
|
|
||||||
GL11.glTranslatef((float)this.posXClip, (float)this.posYClip, (float)this.posZClip);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateRenderer() {
|
public void updateRenderer() {
|
||||||
if(this.needsUpdate) {
|
if(this.needsUpdate) {
|
||||||
++chunksUpdated;
|
++chunksUpdated;
|
||||||
|
@ -113,14 +109,8 @@ public class WorldRenderer {
|
||||||
if(!var14) {
|
if(!var14) {
|
||||||
var14 = true;
|
var14 = true;
|
||||||
GL11.glNewList(this.glRenderList + var11, GL11.GL_COMPILE);
|
GL11.glNewList(this.glRenderList + var11, GL11.GL_COMPILE);
|
||||||
GL11.glPushMatrix();
|
|
||||||
this.setupGLTranslation();
|
|
||||||
float var19 = 1.000001F;
|
|
||||||
GL11.glTranslatef((float)(-this.sizeDepth) / 2.0F, (float)(-this.sizeHeight) / 2.0F, (float)(-this.sizeDepth) / 2.0F);
|
|
||||||
GL11.glScalef(var19, var19, var19);
|
|
||||||
GL11.glTranslatef((float)this.sizeDepth / 2.0F, (float)this.sizeHeight / 2.0F, (float)this.sizeDepth / 2.0F);
|
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.setTranslationD((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
|
tessellator.setTranslationD((double) (this.posXClip-this.posX), (double) (this.posYClip-this.posY), (double) (this.posZClip-this.posZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var11 == 0 && Block.blocksList[var18] instanceof BlockContainer) {
|
if(var11 == 0 && Block.blocksList[var18] instanceof BlockContainer) {
|
||||||
|
@ -144,7 +134,6 @@ public class WorldRenderer {
|
||||||
|
|
||||||
if(var14) {
|
if(var14) {
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
GL11.glPopMatrix();
|
|
||||||
GL11.glEndList();
|
GL11.glEndList();
|
||||||
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
|
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,7 +13,11 @@ public class Display {
|
||||||
LWJGLMain.updateDisplay();
|
LWJGLMain.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HTMLCanvasElement getDisplayMode() {
|
public static int getWidth() {
|
||||||
return LWJGLMain.canvas;
|
return LWJGLMain.getCanvasWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getHeight() {
|
||||||
|
return LWJGLMain.getCanvasHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user